2017-01-30 10:29 AM
Hi there,
I am using the Stm 32L476 and I am trying to use 2 ADCs with 2 channels each with 12 Bit. So 4 Channels all together. I am using the ADCs in Regular simultanuous multimode with DMA so I am able to transmit the data from DMA to USART afterwards. Now I encountered a problem, that sometimes I get spikes of almost 255 Bits in my data.In Matlab I receive the data, so 2 Bytes for each ADC. The spikes happen, when the Byte with the LSB has an overflow.One example with two consecutive ADC values consisting of two bytes:1.)00000110 01111100 (6 252)2.)00000110 00000000 (6 0)
It seems like the ADC transmits the first byte with the MSB and after that it gets an overflow in the second one, but cant correct it in the first byte. The next ADC value has the corrected first Byte. So each spike always consists of only one value.
If I use the ADCs with 12,5 Cycles sampling time and with a prescaler of 64 (f=16MHz), it works fine and I cannot see any spikes. Nevertheless it would be nice if I can run the ADCs faster...Can somebody imagine what goes wrong here?Thanks a lot in advance!
#multimode #spikes #12bit-adcs #overflow #stm32l4762017-01-30 12:55 PM
> I am using the ADCs in Regular simultanuous multimode with DMA
How exactly?
> so I am able to transmit the data from DMA to USART afterwards.
So you *don't* use Circular mode in DMA, wait until DMA finished, transmit data through USART without re-enabling the DMA, right?
JW
2017-01-30 02:43 PM
Hi,
Thank you for your answer first! I run them in scan mode and cont. conversation mode. Channel 1 and 3 with adc 1 and 2 and 4 with adc 2. Tomorrow I will upload the code.
I run them in circular mode. And in the conversion complete callback I transmit the data via uart, which runs in normal mode.
Thank you,
Bene
2017-01-30 02:46 PM
I run them in circular mode. And in the conversion complete callback I transmit the data via uart, which runs in normal mode.
OK so how do you know the DMA from ADC is not overwriting the buffer while you are transmitting via UART?
JW
2017-01-30 11:46 PM
Ah ok... This could be the problem. Thank you! So could I start the ADCs in normal-mode again in th
HAL_UART_TxCpltCallback ? Or is there a better solution? DoubleBuffering?
2017-01-31 04:02 AM
Ok! I did it now like this:
StartMultimode in main()
StopMultimode and Start Transmit via UART in the ADC_Conversion_Complete_CallbackStartMultimode in UART_Transmit_CallbackLike this it works. Is it ok like this or is there even a better possibility?
Thanks a lot!2017-01-31 04:05 AM
Probably it's OK but I don't Cube so I can't help you with the Cube-related details.
JW
2017-01-31 05:28 AM
Ok. No problem! Thank you a lot!