4 years, 2 months ago.

Using uart LPC11U24

Hello

I need to test certain DigitalIn ports and than send a bitsequence of the state through the UART. I have problems with using the UART, the oscilloscope seems to print other values than that I want (garbage values?).

This is my code to test the UART.

#include "mbed.h"

int main() {
    wait(1);
    const PinName tx = p9;
    const PinName rx = p10;
    const int baudrate = 9600;
    DigitalIn x = p36;
    Serial out(tx, rx); 
    out.baud(baudrate);
    out.format(8, SerialBase::Even, 1);
    while(1) {
        wait(0.5);
        if (x == 1) out.putc(7);
        else out.putc(1);     
    }
}

This is what comes up my oscilloscope. http://i.imgur.com/3i37qbq.jpg

and it continues like that for couple more msecs.

Any idea what the fault may be? Tried printf and other serial classes aswell. When printing to putty via usb, it gives garbage values aswell.

Thanks

Be the first to answer this question.