8 years, 11 months ago.

How to reduce the delay between two consecutive UART transmissions for LPC1768

Hi Everyone,

I am trying to use UART communication between to LPC1768 controllers using two mbed lpc1768 boards. I am using the ARMmbed online compiler. The baud rate is set 6 Mbps with 96 MHz system clock.

The code is as follows

#include "mbed.h"

DigitalOut led1(p5);
DigitalOut led2(p6);
Serial device(p9, p10);  // tx, rx
 
int main() {
    device.baud(6000000);
    device.putc('H');
    led1 = 0;
    led2 = 0;
    while(1) {    
            device.putc('H');
            led2 = !led2;
    }
} 

The attached snapshot shows the delay between two transmission which is around 7.5us. I am trying to reduce the delay between two consecutive transmissions. Any suggestion is greatly appreciated.

Best regards

/media/uploads/siladitya/img_20170102_235954.jpg

1 Answer

8 years, 11 months ago.

Hi. Could the delay be related to the LED (GPIO) toggle ? Remove the LED toggle line to see if this delay is reduced.

The delay may be the overhead to the device.putc routine call.

Also, have you tested the following BufferedSerial method ?

https://developer.mbed.org/users/sam_grove/code/BufferedSerial/

Test to see what the inter byte delays are with this approach. Curious on your test results if you switch to using the above buffered solution and using a single printf for a data packet.