Do I need a pullup on a serial port

01 Dec 2011

I've got my code mostly working, but I'm getting a constant stream of character 0 delivered to my serial port when there is nothing connected.

Here's my code:

#include "mbed.h"

Serial cc(p13,p14);
int count = 0;
int main() {
    cc.baud(57600);
       
    while(1) {
        if (cc.readable())
        {
            count++;
            if ((count & 0xF) == 0) printf("\n");
            printf("%02d ", cc.getc());
        }
    }
}

It's an LPC2368 I'm seeing this on, and the problem only appears when I plug in a length of cable into the rx pin 14 with no other connections.

01 Dec 2011

Hi Anthony,

This bug may happen in other MCUs as well, the common fix to this is to set the TX pin to PushPull mode during UART pin initialization and set it output to 1 as well. Hope this may help.

Regards, Stas

02 Dec 2011

Can I do that using the Serial or MODSERIAL classes?

02 Dec 2011

Try to find pdf manual of 1768 and do it manually before that class initialization maybe will work, if not try to ask permission to edit the source code of that classes from mbed or ask them to fix the issue for you.