- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Solved! Go to Solution.
- Labels:
-
PSOC5 LP MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can terminate a TD. Also if you Enable the DMA with preserveTds = 1.
Here's an excerpt from the DMA datasheet:
cystatus CyDmaChEnable(uint8 chHandle, uint8 preserveTds)
Description:
Enables the DMA channel. A software or hardware request still must happen before the channel is executed.
Note While the channel is enabled and is currently being serviced by the DMA controller, any other configuration information for the channel should NOT be altered to ensure graceful operation.
Parameters:
uint8 chHandle: A handle previously returned by CyDmaChAlloc() or DMA_DmaInitalize().
uint8 preserveTds: Preserves the original TD state when the TD has completed. This parameter applies to all TDs in the channel.
Value | Action |
0 | When a TD is completed, the DMAC leaves the TD configuration values in their current state, and does not restore them to their original state. |
1 | When a TD is completed, the DMAC restores the original configuration values of the TD. |
Is this the answer you were looking for?
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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