ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Суббота
13 июля
474202 Топик полностью
pav256 (17.12.2013 17:31, просмотров: 157) ответил йцукен на Мне кажется (не пробовал), что если снять бит CONT, не трогая бит SCAN, текущий опрос каналов должен докатиться до конца и остановиться в предсказуемом месте.
Вопрос когда снимать CONT? Когда DMA все передаст? Тогда АЦП уже будет заблокирован (OVR = 1) и это не поможет (пробовал). Снимать раньше? Когда? Когда нужное количество выборок еще не набрано? В даташите по этому поводу всего ничего: "11.8.1 Using the DMA Since converted regular channel values are stored into a unique data register, it is useful to use DMA for conversion of more than one regular channel. This avoids the loss of the data already stored in the ADC_DR register. When the DMA mode is enabled (DMA bit set to 1 in the ADC_CR2 register), after each conversion of a regular channel, a DMA request is generated. This allows the transfer of the converted data from the ADC_DR register to the destination location selected by the software. Despite this, if data are lost (overrun), the OVR bit in the ADC_SR register is set and an interrupt is generated (if the OVRIE enable bit is set). DMA transfers are then disabled and DMA requests are no longer accepted. In this case, if a DMA request is made, the regular conversion in progress is aborted and further regular triggers are ignored. It is then necessary to clear the OVR flag and the DMAEN bit in the used DMA stream, and to reinitialize both the DMA and the ADC to have the wanted converted channel data transferred to the right memory location. Only then can the conversion be resumed and the data transfer, enabled again. Injected channel conversions are not impacted by overrun errors. When OVR = 1 in DMA mode, the DMA requests are blocked after the last valid data have been transferred, which means that all the data transferred to the RAM can be considered as valid. At the end of the last DMA transfer (number of transfers configured in the DMA controller’s DMA_SxRTR register): ● No new DMA request is issued to the DMA controller if the DDS bit is cleared to 0 in the ADC_CR2 register (this avoids generating an overrun error). However the DMA bit is not cleared by hardware. It must be written to 0, then to 1 to start a new transfer. ● Requests can continue to be generated if the DDS bit is set to 1. This allows configuring the DMA in double-buffer circular mode. To recover the ADC from OVR state when the DMA is used, follow the steps below: 1. Reinitialize the DMA (adjust destination address and NDTR counter) 2. Clear the ADC OVR bit in ADC_SR register 3. Trigger the ADC to start the conversion." Как себя ведет указатель на опрашиваемый канал при установке/сбросе того или иного флага вообще ничего не нашел.