Arm Mbed OS support forum

STM32F7 why this attach is not working?

Hi,everyone .
I use discovery F746NG ,have problem to use Rawserial

and this mycode part:

RawSerial CONSOLE(PA_9,PA_10,115200);
RawSerial ESP32(PA_2,PA_3,115200);

char buffer[20];//receive data use
int len = 0;//receive data use

void UARTh(void);
void System_init(void);

int main() {

CONSOLE.printf("I in attach\r\n");
CONSOLE.printf("I NVIC_SetPriority\r\n");
NVIC_SetPriority(USART2_IRQn,1);//number smaller the priority is bigger


void UARTh()
CONSOLE.printf(“I in\r\n”);

        char new_char =ESP32.getc(); 
        buffer[len++] = new_char;    
        //buffer[len] = '\0';          
        // new message received, last char have \n !
        if (new_char == '\n') {
            CONSOLE.printf("I get :%s\r\n",buffer);
            len = 0;

1.The UARTh() funtion isn’t go in on. why?
2.Change to use Nucleo F746ZG can work

Hello Bob,

> RawSerial ESP32(PA_2,PA_3,115200);
> ...
> ESP32.attach(&UARTh,Serial::RxIrq);

  • The PA_2, PA_3 pins do not seem to be available at any of the DISCO-F746NG board’s header connectors CN4, CN5, CN6, CN7. How did you connect them to the ESP32?

  • According to the info in
    mbed-dev - mbed library sources. Supersedes mbed-src. | Mbed
    the PA_3 (Rx) is connected also to USB ULPI_D0 [USB3320C-EZK_D0].
    Even if you somehow managed to connect the ESP32 to the PA_2, PA_3 pins it could happen that the serial pulses arriving at the PA_3 (Rx) pin are somehow distorted by the USB peripheral device.

Best regards, Zoltan


1.I use F746NG mcu not discovery board in online compiler use discovery F746NG
2. and this is connection method,There is no additional IC in between
3.The PA2 send data is true.
PA2 (Tx) -----> Rx
PA3 (Rx) -----> Tx

HI sorry I have problem
1.If you want to use a separate MCU (use st-link to Burn), do you have to change some configurations

If you want to use a separate MCU (use st-link to Burn), do you have to change some configurations

When you’d like to program a separate MCU (not installed on a NUCLEO or DISCO board) then you have these options.

The configuration depends on whether the custom board hardware design matches the reference NUCLEO/DISCO board design. For example, If the custom board is equipped an external crystal and the reference design isn’t then you shall create a custom target (for example like this).