Hello,
I'm using a TMS570LS3137 and SafeRTOS to receive and transmit datagrams via SCI and RS485 with aid of DMA. I use DMA block transfer complete interrupts when receiving or transmitting datagrams to switch the state machine of my SCI driver in order to synchronize a bidirectional communication via half-duplex RS485.
Therefore, I need to reset the DMA from time to time. So, I'd like to let the DMA start receiving one datagram from the beginning if certain conditions are given. This means already received bytes are to get discarded and the DMA is reset within the DMA BTC interrupt service routine. I've tried to reset the DMA using the DMA RES bit in GCTRL. But this doesn't work at all and nothing is received or transmitted any more, see the attached source code. Is there a safe and working way to reset DMA transfer in the DMA interrupt service routine?
Thank you in advance
Andre
void dmaGroupANotification(dmaInterrupt_t inttype, uint32 channel) { /* datagram transmission completed */ if((channel == (uint32)DMA_CH0) && (inttype == (dmaInterrupt_t)BTC)) { /* reset DMA if necessary */ if(...) { /* DMA software reset: discard already received bytes */ dmaREG->GCTRL &= 0xfffffffe; dmaREG->GCTRL |= 0x00000001; } ... /* reveive new datagram */ dmaSetChEnable((uint32)DMA_CH1, (uint32)DMA_HW); } ... }