Darmesh Nana
Darmesh Nana

Reputation: 41

MBED Serial dropping data

I use MBED (online IDE & libraries) for my application with host board NUCLEO-411RE and 4D Systems touch display connected by full duplex serial communication. I am able to send data successfully from host to display without errors. However when sending data from display back to host I am losing data. Reducing baud to 9600 does not solve the problem.

The host processor remains in a super loop with the first action to check if LCD sends serial data ( lcd4d.readable() ). Host then receives one character at a time ( lcd4D.getc() ), echos it to the PC via usb ( pc.printf(&recChar) ) and does some further processing.

I am also monitoring the physical host receive pin on a separate terminal session. Using this I am certain that the LCD sends data correctly, however this data is not received and echoed correctly by the host processor (echo to PC is only used for debugging purposes).

Refer to super loop code snippet:

do {
    if ( lcd4D.readable() ) {
        recChar = lcd4D.getc();
        pc.printf(&recChar);
        lcd4D_intr_Rx();
    }

Also refer to attached screen print showing terminal left PC echo (data loss) and terminal right hardware pin monitor (confirming data sent correctly).

Implementing SerialRX interrupt also does not help the situation with data loss still occurring.

Thanks for any suggestions; I am out of ideas. enter image description here

Upvotes: 1

Views: 597

Answers (1)

Darmesh Nana
Darmesh Nana

Reputation: 41

I have solved the problem. The issue was that the host processor needed to respond fast enough to the serial data received. I basically implemented a fast serial receive buffer and ensured that received characters are buffered immediately upon interrupt.

Upvotes: 1

Related Questions