ADC DMA Doesnt Read Properly [Need Help and Advice]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-03 9:59 PM
Hi, so previously on other post I've been getting trouble with Poll Conversion of ADC using STM32F4 Discovery Board. Therefore i decided to use DMA instead.
I made the program using STM32CUBEMX and Keil uVision to read 5 different channels. All data then transmitted via USART.
The problem now is my array (uint16_t adcvalarr[5]) only got the 1st index filled with value. Shown below is the result of transmitted data from Watch window and printf debug window.  
Watch Window: 
Debug printf viewer (from left to right: iteration number, array[0], array[1], array[2], array[3], array[4])
I have also tried using potentiometer to alter ADC values of each channel but none of it seems to change the value in the array either. Is my ADC fried up or is it just something wrong with my code?
My main.c code is too long so i'll try to put it in the comment instead
===================================================================================
Thanks in advance! Any kind of info/insight will help me greatly.
- Labels:
-
ADC
-
Bug-report
-
DMA
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-06 8:47 PM
Yes, if the input is shorted to GND and you're still getting 800-900, there is definitely something wrong with the hardware. Probably a protection diode is busted, perhaps it saw an overvoltage event.
This is assuming no errors in your test setup.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-07 12:59 AM
Make
uint16_t adcvalarr[5]={0};
global (i.e. outside of any function), and also volatile.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-07 4:59 AM
I'm gonna accept that harsh possibility as a truth. Most likely thats what causes hardfault whenever i use the polling version..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-07 7:01 AM
On the contrary, I wouldn't expect that to cause a hard fault. The polling version and the DMA version are exercising the same internal pathways. Probably a different bug happening there. But polling for multiple channels in a sequence doesn't really work on the F4 series.

- « Previous
-
- 1
- 2
- Next »