In my application, I am using DMA to queue CAN messages. If there is an overflow, I want to clear out all the CAN messages and start over with DMA writing to the beginning of the DMA buffer after this. In order to do this, I currently disable the DMA channel using the HWCHENAR register, clear all the DMA buffer memory, store the channel's ISADDR register to itself in order to reset the control packet by writing to it, and enableing the DMA channel by setting the associated HWCHENAS bit. Is there anything wrong with doing it this way?
My concern is with what happens if a frame is being sent when this happens. I know after the control packet is updated, the pending flags are cleared, but does that end the current transmission as well? It is important to me that the end of the frame cannot be finished after I do these steps to reset DMA.
Westin