2010-10-31 03:19 PM
Save ADC result to different DMA size
2011-05-17 05:13 AM
How much accuracy do you need? Have you calculated how many bits of resolution you want? There are only two bytes of data stored with each conversion anyway...
Do you want 8 | 10 | 12bits of resolution? Do you have any issues with manipulating your 100 sample buffer after the conversions have completed? i.e. you could go through and post-process the samples from your buffer to down-sample then, or set your ADC up to sample fewer bits and then just run a filter through your buffer.2011-05-17 05:13 AM
You could try using byte DMA after adding one to DMA_CPAR1. Use left justified ADC format. But if you can afford a 500 byte buffer what you already have works.
2011-05-17 05:13 AM
Hi there,
Thanks for fast replies.
Sorry, in the first message I didn't mean two significant 'bytes'.. I meant nibbles. So I am after 8-bit information. ADC conversion provides 12-bit data so I'd like to ignore the last four bits. I only want 8-bit information as I'm after 1000 records and don't really need the accurate information anyway.
BTW, I'm using STM32F101C4.
Picguy, I've tried your solution of adding 1 to DMA_CPAR1 with Left justified ADC. But the result seems to be still getting the least significant byte (they all are 0xX0 ).
Maybe I have to access data through interrupt to edit it..:s
2011-05-17 05:13 AM
>Picguy, I've tried your solution of adding 1 to DMA_CPAR1 with Left justified ADC. But the result seems to be still getting the least significant byte (they all are 0xX0 ).
It seemed like a good idea. You might check DMA_CPAR1 after the DMA is finished. If it has the expected odd address my idea has failed. I may be using the same STM32F101C4 as you. In my case I am doing DTMF decode on 4 lines at once. Let’s just say that I am being very frugal with my use of floating point. I sample all 4 channels at 8KHz (125 uSec) continuously using circular buffering. Interrupting after every conversion I (circularly) subtract 100 from DMA_CMAR1 and save this to simplify my C-code. Don’t buy up all the parts as we may a few hundred from distributors ASAP if our hardware guy finds a demand from his contacts in the independent telcos. Lead times look loooong. BTW, I wrote a DTMF decode on an 8051 in assembly. It was like pulling teeth. Recasting to my 72MHz STM3210E-EVAL using software floating point was a piece of cake. But it took almost 10 milliseconds. Spreadsheet math showed that I could do much of the work as integer. That integer math in assembly took a little planning. Raw input scaling allowed me to put the binary point between two words simplifying everything.2011-05-17 05:13 AM
I've had no success with the solution above so I decided to just manually save the data in the ADC interrupt. So not using DMA to save data no longer.
Picguy, Not sure if I follow all your comments but thanks for your help!