PSoC 5LP DMA pointer reset

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

cross mob
fpereira
Level 1
Level 1
First reply posted First question asked Welcome!

Hello all,

I am working on this project where I have 7 multiplexed channels going to a SAR ADC. The output of the ADC is going to a DMA channel and it stores the 7 conversions in RAM.

I'm having an issue where the measurement location has an offset and I'd like to reset the DMA pointer every time I service the interrupt to make sure I don't have swapped channels. Is there a way to reset the DMA pointer?

0 Likes
1 Solution
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

fpereira,

DMA is intended for automatic (unattended) operation. If you intend resetting DMA on each interrupt, it may be easier just not to use DMA at all, performing all operation by processor itself. It may be, actually, faster.

/odissey1

View solution in original post

0 Likes
3 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Value Action
0
1

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Hi Len,

 

I've tried your suggestion and I still can't get it to work reliably. Here is a little more detail on how I have it designed.

I have a clock that toggles a 3 bit counter using the rising edge. This counter sets the address to a an analog mux. The falling edge of this clock starts the ADC conversion.

I also have a compare block that looks for the counter equals to 7. If so, that will trigger an interrupt.

In this interrupt, I am reading all 7 readings. The issue is that the DMA is sometimes out of sync with the clock. That's why I want to re-start the DMAs at every interrupt event. Here is a snippet of my code.

void SyncDMAs(void)
{
    //Restart DMA channels so ADC channels are aligned
    CyDmaChDisable(DMA_SAR_1_chan);
    CyDmaChDisable(DMA_SAR_2_chan);
    CyDmaChEnable(DMA_SAR_1_chan,1u);
    CyDmaChEnable(DMA_SAR_2_chan,1u);
}

  When running this, the DMA complete signals get completely confused. Are there any suggestions on what I'm doing wrong?

Thanks for your help!

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

fpereira,

DMA is intended for automatic (unattended) operation. If you intend resetting DMA on each interrupt, it may be easier just not to use DMA at all, performing all operation by processor itself. It may be, actually, faster.

/odissey1

0 Likes