PIC32MX UART flow control not working in block transfers
I'm trying to use a UART to communicate with a 4G module (AT command interface) using a very high baud rate.
The UART is configured to run a 3mbps with RTS/CTS handshaking and DMA:
/* Set the handshake mode to either simplex or flow control */
/* Initialize the USART based on configuration settings */
false, /*Auto baud*/
false, /*LoopBack mode*/
false, /*Auto wakeup on start*/
false, /*IRDA mode*/
false); /*Stop In Idle mode*/
/* Set the line control mode */
/* We set the receive interrupt mode to receive an interrupt whenever FIFO
is not empty */
/* Get the USART clock source value*/
clockSource = SYS_CLK_PeripheralFrequencyGet ( CLK_BUS_PERIPHERAL_1 );
/* Set the baud rate and enable the USART */
3000000 ); /*Desired Baud rate value*/
/* Clear the interrupt status flags to be on the safer side*/
/* Enable the error interrupt source */
The transfers appear to work fine, when one byte at a time is sent, regardless of amount of data that is sent. This has a huge overhead associated with it over sending blocks of data at once (it more than halves the effective baud rate). Each character is loaded individually in the UART's tx complete callback and then sends the start/stop bits with each byte. But I don't see any transfer failures.
When I send blocks of data at once to get higher throughput, the handshaking really kicks in. However, it seems that every now and again (e.g. every >1MB of data) single bytes are not received by the 4G module. This would suggest that the PIC is sending a byte even though the 4G module is telling it not to. I also don't get an overrun or framing error at the PIC, so I'm unsure how to identify and handle this.
Is this a known issue (I can't see anything in the errata)?
Has anyone else had issues with high baud rates and flow control?
Is there anything I need to do to get notified of overrun errors?
If I can get the overrun errors working, how do I resend the failed byte within the Harmony framework?
Any help with this would be much appreciated.