2 years, 7 months ago.

How to Establish communication between two Freescale Freedom development platforms using UART.

How to Establish serial communication between two Freescale Freedom development platforms using UART.

1 Answer

2 years, 7 months ago.

Please see the serial documentation - https://os.mbed.com/docs/v5.6/reference/serial.html

You'll want to wire the boards like this:

MBED1 RX => MBED2 TX

MBED1 TX => MBED2 RX

MBED1 GND => MBED2 GND

Then, you'll want to have code running on both that uses Serial objects to handle send/receive.

  1. include "mbed.h"
  2. include "TSISensor.h"
  3. include "MODSERIAL.h"
  4. define BAUD 115200
  5. define TX_PIN p9
  6. define RX_PIN p10

DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4);

MODSERIAL pc(USBTX, USBRX);

MODSERIAL uart(TX_PIN, RX_PIN);

int main(void) { pc.PwmOut led(LED_GREEN); uart.PwmOut led(LED_GREEN); TSISensor tsi;

while (true) { if( pc.readable()) {led = 1.0 - tsi.readPercentage(); wait(0.1); uart.putc(pc.getc());} if( uart.readable()) {led = 1.0 - tsi.readPercentage(); wait(0.1); uart.putc(pc.getc());} } }

posted by donnie howard 20 Nov 2017