cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with ADC DMA and timer

muntu_the_killer
Associate II
Posted on October 01, 2013 at 12:17

The original post was too long to process during our migration. Please click on the attachment to read the original post.
3 REPLIES 3
Posted on October 01, 2013 at 12:52

What processor, at what speed?

This is all rather a mess, the timebase suggests a sample rate closer to 1 Hz than 200 Hz (5ms), yet you use only 3-cycles for the ADC which will give hideous readings. Why would you not use a TIM based trigger for the ADC/TIM? Why would you not have a very deep DMA buffer?

The number of channels is ONE, you want a scan list of ONE channel per ADC. The #defines are missing so can't confirm the pins involved.

Writing to the SD card you want to be writing blocks >512 bytes, and ideally multiple KB tending toward a cluster in size.

The DMA interrupt is not enabled via the NVIC. Again try to avoid an interrupt for every 3 samples. Some odd processing going on, not sure why/how. Do you want the convert to millivolts, or scale in some way? If the numbers are in the form you want just do a memcpy, or make the buffer large enough and split in two, so the SD write can occur in-place.

The DMA is configured for 32-bit words, 3 x 32-bit words into array of 3 x 16-bit words does not fit.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
muntu_the_killer
Associate II
Posted on October 01, 2013 at 13:24

Hi Clive,

first of all, thanks for responding. I'm using STM3241G-EVAL board with STM32F417IGH6. I used some sample programs to write my code, and for this reason there may be some errors.

In my final program, i want to interrupt timer evvery 5ms, but now, to see the leds I use 2s of period.

Secondly, I don't know how to use a TIM based trigger for the ADC/TIM and how it works.

About the channels, I need to take 2 samples in ADC1, in channels 16 and 18. So, is not correct the number of channels?

I will write 5mb in my SD card, but now is just a program  testing.

How can I enable the DMA interrupt via NVIC? I tried doing it as the timer, but it doesn't work.

Finally, I want the values without conversion, I will use another program to convert the ADC values. I will change uint_32 for uint_16.

Thank you very much.

Miquel

Posted on October 01, 2013 at 23:21

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6dJ&d=%2Fa%2F0X0000000bs7%2FK27_aPZAW0PcrHJubcvoyXUDMfgTUBLW7n0SnLKbCwM&asPdf=false
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..