I'm writing a driver to use a USART peripheral for serial communications. I would like the driver to always be listening for incoming messages and put them in a buffer in memory as soon as they are received. Ideally the application should consume the messages from the buffer shortly after they are received. DMA is used to transfer incoming messages from the receive holding register (RHR) to buffer in memory. An interrupt is generated only when the DMA has filled the buffer. The ISR resets the DMA destination address back to the start of the buffer and begins the transfer again.
The issue I'm having is that the DMA is not transferring individual bytes from the RHR register to memory. Instead, it is transferring after each 4th byte is received (ie. a whole word). This is a problem. When a single byte message is received I want it to become available to the application straight away, rather than waiting for another 3 bytes to be received.
Any suggestions on how to get around this?
Here are some of the XDMAC channel settings I am using that might be relevant;
XDMAC_CUBC = 64 (my buffer size)
XDMAC_CC_DWIDTH = 0 (byte)
XDMAC_CC_CSIZE = 0 (1 data transferred)
XDMAC_CC_MBSIZE = 0 (burst size set to 1)