Hi Paul,
if the UART is receiving a byte stream it will request a DMA channel everytime the RXRDY flag is set.
For example, if you transfer 32 byte to the UART, the RXRDY flag will be set 32 times.
If properly configured (CS=1), each time the RXRDY flag gets set, the DMA will get the byte from the UART RX buffer and move it to the destination specified in DAR register.
This transfer will be repeated for 32 times as long as you have written this number in the BCR register of DMA.
For each transfer, the BCR value will be decreased of one unity: after 32 transfers it will reach value 0.
As soon as this happens, you will have 32 bytes in the destination specified in DAR register.
My problem is that I have to repeat these 32 bytes transfer. Hence I must reload value 32 in BCR and set DONE bit to 1 to have the transfer restart.
Setting DONE bit to 1 deletes value 32 in BCR, hence I have to write BCR register after bit DONE.
The problem is that if some bytes arrive to the UART between these two instructions, DMA may originate a configuration error because a DMA request is active with BCR still loaded with value zero.
Valentina