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.
6 years, 2 months ago.
USART2 on STM32F429VIT receive problem
Hello. I am using the following code. There are no problems with transmitting characters, but there are no characters at the reception (irq is not called). I send symbols with the help of putty.
#include "mbed.h"
DigitalOut led1(PB_8);
RawSerial pc(PD_5, PD_6);
void callback_ex() {
if(pc.readable()) {
pc.putc(pc.getc());
led1 = !led1;
}
}
int main() {
char start_string[]="\r\nwelcome to debug...\n\r";
pc.attach(&callback_ex,Serial::RxIrq);
pc.puts(start_string);
while (1) {
}
}
1 Answer
6 years ago.
Hi Mikhail,
I compiled your code and tried it out on NUCLEO_F429ZI and the interrupt handler gets triggered for that board. I'm using Mbed OS version mbed-os-5.14.1.
I added extra print to the interrupt handler to make the debugging easier:
#include "mbed.h"
DigitalOut led1(PB_8);
RawSerial pc(PD_5, PD_6);
void callback_ex() {
if(pc.readable()) {
pc.putc(pc.getc());
pc.puts(" - received\r\n");
led1 = !led1;
}
}
int main() {
char start_string[]="\r\nwelcome to debug...\n\r";
pc.attach(&callback_ex,Serial::RxIrq);
pc.puts(start_string);
while (1) {
}
}
My output is:
welcome to debug... j - received k - received s - received d - received j - received k - received g - received f - received d - received g - received j - received f - received k - received - received - received
Could it be some wiring issue?
Best regards,
Jaakko, team Mbed