Using Scan_ADC with DMA issues

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RuPi_283656
Level 4
Level 4
10 sign-ins First solution authored 25 replies posted

I'm trying to use DMA to move ADC output to sram.  I set the source address as ADC_SAR__HW->CHAN_RESULT [0].  The DMA is triggered from ADC sdone.  I am using x & y loops in DMA to transfer 4k word results.  However the dma output is not placed in memory.  Instead a single value is placed in all memory locations.  This value is random, changing every time the firmware is started, but does not change when running, regardless of input to the ADC.

The ADC is set to run continuously, but the DMA channel is disabled when the desired 4k words are transferred.  Then the contents of memory are sent via UART, and then the DMA channel is re-activated for the next block.

One thing is that I initially wanted to trigger DMA from eos, but that does not work.  I suspect eos is only activated when scanning multiple channels.  Is that correct?  And should the value in the output register be present when sdone triggers?

Thanks, Russ

0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Russ,

sdone  signal goes high for two ADC clock cycles to indicate that the ADC has sampled the current
input channel. Internally, this signal is used to advance the signal multiplexer onto the next
channel. So this time to take the result.

Where as  rising edge on the end of scan (eos) output means that the current scan is complete. At this
moment, conversion result registers contain valid sample data for all enabled channels. Internally,
it is used to provide an interrupt. Even in case of single channel this is valid. So eos should be the signal to be used, as it guarantees the data on result registers for channels(even if only one channel is enabled).

Best Regards,
Vasanth

View solution in original post

0 Likes
4 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Russ,

sdone  signal goes high for two ADC clock cycles to indicate that the ADC has sampled the current
input channel. Internally, this signal is used to advance the signal multiplexer onto the next
channel. So this time to take the result.

Where as  rising edge on the end of scan (eos) output means that the current scan is complete. At this
moment, conversion result registers contain valid sample data for all enabled channels. Internally,
it is used to provide an interrupt. Even in case of single channel this is valid. So eos should be the signal to be used, as it guarantees the data on result registers for channels(even if only one channel is enabled).

Best Regards,
Vasanth

0 Likes

Thanks Vasanth.  That's great, but the problem is that when I connect eos to the DMA trigger input, it never triggers.  I guess I could put a scope on it, but since DMA triggers from sdone then it is pretty clear that the trigger pulse is not there.  I tried using both auto and rising edge but neither one will work.

Is there something else I should be doing?

Thanks, Russ

0 Likes

Vasanth, please disregard the last message.  I switched to using eos and it worked this time.  I am not sure what the problem before was, but I had tried eos numerous times with no success.  One of the problems is that the RS-232 connection is quite unstable.  Often it stops working when I reload the firmware and I have to 'fiddle' with it to get it started again.  Such as disconnecting and reconnecting the Terra Term and other tricks.  Also the reset button on the kit would have to be hit multiple times to get the firmware to run.  Now though, the reset button works properly, every time.

Thanks again, now I can proceed to the next part of my project.

Regards, Russ

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Russ,

Happy to know it worked !

Best Regards,
Vasanth

0 Likes