In my current implementation of a project, I am using a UART to send and receive messages. However, the reception part is pretty inefficient as it can only receive one byte at the time. I have to send one byte at the time from the host. This works just fine when one is using a terminal like Putty, but it doesn't work when used with Python.serial.
unsigned int receivedBytes = 0;
while (receivedBytes < length)
{
while (ESCI_A.SR.B.RDRF == 0) {}
ESCI_A.SR.R = 0x20000000; // Clear the RDRF flag
*(static_cast<char*>(bytes) + receivedBytes) = static_cast<char>(ESCI_A.DR.B.D); // Read the byte from the register
receivedBytes += 1;
}
return receivedBytes;
My understanding is that with a DMA transfer, it would be possible to receive an entire array of bytes. However, I have no experience about setting up a DMA transfer for the ESCI_A.
Can anyone point out to an example with the MPC5676R and DMA transfer with ESCI_A (I couldn't find any) or help me to set it up?
Thanks!
Hi, I could point out following example code showing similar task:
Example MPC5676R DSPI MasterSlave DMA CW210
eSCI example you may find for instance here, section 15:
https://www.nxp.com/docs/en/application-note/AN2865.pdf
Hope it helps