4 years ago.

Serial stops

Please help me... I want a solution right now...

The LPC1768 communicate with processing through Serial whose baud rate is 115200. However, as time passes, the serial communication stops.

As a situation, the LPC1768 sends sensor data with serial.putc() of the default serial library. On the other hand, processing receives the data with serial.read(). The processing code is the following:

if(serial.available()>1) {
  serial.read();
}

To explore the solution of this problem, I tired these things. - I checked serial.available() is 46 and used serial.clear() in processing, but mbed stopped and didn't send data. Because I thought the cause of this was an overflow of receiving buffer of processing. - I added serial.writable() and check the serial buffers for sending has space. If there are no space, I used the following codes and initialized the serial:

        LPC_UART2->FCR |= 0x06;
        serial.baud(115200);,

because I thought the cause of this was an overflow of sending buffer of mbed. However, they didn't work.

Please note that these codes work correctly and basically. However, serial communication stops suddenly. What can I do anything else?

Best regards

If you attach a IrqHandler to the serial on the receiving end, does the same problem occur?

posted by Jan Jongboom 06 Sep 2017

Please edit your question to include the exact code you are using rather than a description of what you think the code is doing. In order to keep the correct formatting use

<<code>>
your code
<</code>>
posted by Andy A 06 Sep 2017

Hi, Jan. I'm sorry that I can't understand what you mean because I don't use any receiving functions on mbed side. Do you mean that I sould implement IrqHandler on Processing side? Please let me know more detail.

Hi, Andy. I'm sorry for my wrong format. I edited it.

Best regrads,Ishikawa.

posted by yu ishikawa 06 Sep 2017

Please post all of the code. The serial ports work, I've run them for days on that board without having to do anything special. The likely cause is a bug somewhere else in your code, some sort of buffer overflow or memory leak. But no one can tell you how to fix it if you only post 2 lines.

posted by Andy A 07 Sep 2017
Be the first to answer this question.