Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years ago.
UART2 on K22F board?
Has anyone had any luck getting UART2 on PTD2 and PTD3 working on the K22F board? I am attempting to talk to a Bluetooth module but not having any luck.
Question relating to:
2 Answers
11 years ago.
Are you using the latest mbed lib? Older ones missed sending the first character, which can cause some modules to not configure correctly for example.
I just tested it with a simple loopback test, and it seem to work fine.
11 years ago.
I create this test program and dont see the same problems you are describing. Can you please test?
#include "mbed.h"
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
Serial uart2 (D1, D0);
Serial pc(USBTX, USBRX);
int main() {
led1 = 1;
led2 = 1;
led3 = 1;
while (true) {
if (pc.readable()) {
uart2.putc(pc.getc());
led1 = !led1;
}
if (uart2.readable()) {
pc.putc(uart2.getc());
}
}
}
I'm using mbed library version 92
Well, thanks for the feedback! I was able to get it working when I plugged the HC-06 into the slot designed for it, but not when I tapped the outputs from the mbed header. I don't know where there is a difference, as it is supposed to be the same signals. However, I am grateful to see it work.
posted by 01 Dec 2014