ADC DMA not updating all channels
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-02-24 10:02 PM
I'm using an STM32L4S9 MCU and I'm having trouble getting all the channels to update after starting HAL_ADC_Start_DMA. I'm doing a regular 12 bit conversion on 5 channels, trigger by software, waiting for conversion completed in the adc call back handler, then reading the data from the array that I pointed to when starting the adc conversion. The first two channels will consistently update, the next three don't. I have 5 channels set to scan in the ADC settings. A uint16_t array [5]. DMA is set to half word. I can change the scan channel order and array [0] and array[1] are always updated. The other 3 are always 4095. I've sped things up, slowed them down, but it seems like all then channel are not getting read, or not getting transferred.
I have simular code and settings working on a nucleo board with a different MCU. It looks like everything matches between the two. I also tried youtube examples etc.
I'm away from my computer so I can't upload the code at the moment.
I didn't find any other threads with this issue, maybe I didn't search the correct terms so let me know if it's already been covered. I'm hoping someone has ran into this problem and will know what setting I'm missing in the 32L4S9.
Thanks
- Labels:
-
ADC
-
DMA
-
STM32L4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-02-28 03:30 PM
I figured this out, the channels I thought were not updating were updating. I was using a voltage divider feeding into some of the ADC channels for testing, expecting to see about 2000 on the ADC channel. I discovered that the adc was going full scale above 1.2 V, I was expecting full scale at the 3.3 volts that I had connected to the Vref pin. The MCU was using the internal reference voltage of 1.2 volts for ADC Vref. The default is to use the Vref pin, and everything I could find also indicated it should be using the 3.3 Volts on Vref pin.
I probed the circuit board and had 3.3V going to the Vref pin, and all solder joints looked good using a magnifying glass, but I went ahead and touched up the solder joints on the MCU to the board. Connected it back up and it worked. Apparently, it was a cold solder joint not making connection from the Vref pin to the board.
Hope this helps the next person that has unexpected ADC values or where it appears the ADC isn't working.
Thanks