I've just finished developing a simple program where 32 bytes are transferred from UART to a buffer through a DMA channel on my M52235EVB board.
When transfer is completed, the DMA channel sends an interrupt which is served by an ISR.
In the ISR I'd like to reconfigure the DMA to transfer 32 bytes more.
Hence I reload the BCR register with the number 32,
then clear the interrupt writing 1 to the bit DONE in DSR to allow DMA to restart the transfer.
The problem is that writing 1 to the bit DONE seems to reset the BCR register, preventing DMA to restart the transfer.
The solution seems to be to write the bit DONE BEFORE loading the BCR register with the number 32.
I don't like very much this solution: if a byte has arrived to the UART when I've already set the DONE bit but before BCR register is reloaded, I'll get a configuration error on DMA....
What is a better solution?
Can anyone help?