4 years, 8 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

4 years, 6 months 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

Accepted Answer

thanks, Jaakko. I did not immediately figure out my board. It contains a converter in rs485, which requires additional permission to transfer.

posted by mikhail puchnin 29 Oct 2019