This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Connect another board over UART from nRF51822 mKit board

I am using mbed library to get leg up on development. This is the first time I am writing any MCU application and it sure makes things a lot easier.

I am using nRF51822 mKit board. mbed.org/.../

I was able to compile and run BLE_API examples without any problem. I was also able to use pc UART to print debug messages.

Now I want to control/connect to another board. The other board also has UART. I am following the code from this page. mbed.org/.../SerialPC

If I am not wrong, nRF51822 allows to use any pair of GPIO to be used as UART. The thing I am not clear is, can I have two active UART. Serial pc(USBTX, USBRX); //This goes to PC virtual port. Serial uart(p27, p28);

I tried this and I could not communicate with other board. I am connecting TX -> RX and RX->TX. It doesn't seem to be working. For hypothesis testing, I want to use nRF51822 mKit board as transparent bridge to control other device.

#include "mbed.h"

Serial pc(USBTX, USBRX); //pin 9, pin 11 Serial uart(p27, p28);

DigitalOut pc_activity(LED1); DigitalOut uart_activity(LED2);

int main() { while(1) { if(pc.readable()) { uart.putc(pc.getc()); pc_activity = !pc_activity; } if(uart.readable()) { pc.putc(uart.getc()); uart_activity = !uart_activity; } } }

Any help is appreciated.

Related