9 years, 10 months ago.

Another Serial Port needed

Hi everyone, I need four serial ports in the mbed. Is there a way to set the pins p25 - p26 (PWMOUT) to work as another serial port?

Or maybe this code will work directly?

#include "mbed.h"

Serial serialsoft(p26,p25);

int main() {
    while(1) {
    }
}

Greetings

1 Answer

9 years, 10 months ago.

I assume you mean the LPC1768? No you cannot use PWM pins are serial pins, they are completely different. And you'll find out if you try that code it will result in the error pattern.

There is a softserial lib: http://mbed.org/users/Sissors/code/BufferedSoftSerial/. You can use that on almost any pins (to receive the RX pin needs to be an interruptin capable pin), and it is best to use it on the slowest Serial you are using. Its speed is limitted.

Accepted Answer

Hi Erik, with that library i can use the pins 25-26 as another serial port and uses the other serial ports the way i always used in the mbed normally?

posted by Ney Palma 27 Jun 2014

Hi Erik, with that library i can use the pins 25-26 as another serial port and uses the other serial ports the way i always used in the mbed normally?

posted by Ney Palma 27 Jun 2014

Yes that should work, and it uses interrupts, so while sending your other code still runs. IIRC the maximum speed is something like 50-100kbit/s, but use the slowest one, preferably something like 9600 baud on the software serial.

posted by Erik - 27 Jun 2014