Hi,
My first intention was to clock the adc in such way that it has a sample every 1ms. If it where possible i could have the dma controller handle the whole data aquisition without having to look at it.
and not waste cpu at all.
Due to the factor 65 (clock cycles/conversion) using clocking the adc isn't an option as you cannot get a 65fold by dividing the cpu clock of 96MHz or 100Mhz.
So I resorted to a timer interrupt which periodically sets up a single dma transfer for a number of adc channels. The result is near xtal timing (inter sample timing is nearly perfect). This way i only have a single interrupt to handle (the dma handles the adc interrupt for me).
By decimating the data adaptively I can also vary the sample time during the data aquisition as needed (our measurement consists of two periods each of which must have a certain amout of samples at regular intervals so we can integrate the signal later).
Switching to a real-time OS is a big step for this project (however tempting) and my experiences with it (and solving/preventing deadlocks) date back to my university years some 30 years back now. Furthermore, as the mBed is tighly controller by a PC app, there is not much need for concurreny of tasks.
BUT i will download scmRTOS and play with it (for old time sake ;-), so thanks for mentioning it.
regards
Wim
Hi,
I'm puzzled about how to hardware trigger the ADC (in burst mode) from a Timer1 Match.
I tried Andy's DMA which worked like charm but has drawbacks on getting nice intervals as the conversion time is 65 cycles and the clock is derived from 96Mhz you cannot get an exact int number of ms for timing.
So my next bet is either Timer1 or the Repetitive Timer.
So the question: how do i connect this code to trigger the ADC in burst mode (need to convert two channels). I know I can software trigger from inside the timer interrupt routine but I would like to remove the timer interrupt handler al together and have the adc triggered by hardware.
Got the following code (ripped from a larger program) that I wrote to verify timer1 timing. I verified that it does have a nearly exact 10ms interval I want.
This is called from a modified piece of code found on this forum: