i don't know if this question already answered, but.
when i try to doing serial communication(STM32F407VGTx) in default
Serial instance i need to set
Code: Select all
Serial.setRx(PA10);
Serial.setTx(PA9);
even i already change default pin on
variant_generic.h (i use generic board), and i have use
--board-options on
arduino-cli
Code: Select all
#ifndef PIN_SERIAL_RX
#define PIN_SERIAL_RX PA10
#endif
#ifndef PIN_SERIAL_TX
#define PIN_SERIAL_TX PA9
#endif
Code: Select all
arduino-cli compile -b STMicroelectronics:stm32:GenF4 --board-options pnum=GENERIC_F407VGTX -v -u
before add setRx/Tx serial communication not working, and after add setRx/Tx serial working as expected
it is normal way to use Serial instance?
thanks for any help
by ABOSTM » Mon Aug 01, 2022 4:32 pm
Hi @ahsanu,
It is not normal, I mean you should be able to use Serial without setRx()/setTx()
But,
In variant_generic.h , you changed:
#ifndef PIN_SERIAL_RX
#define PIN_SERIAL_RX PA10
#endif
#ifndef PIN_SERIAL_TX
#define PIN_SERIAL_TX PA9
#endif
This implicitly change Uart instance from UART4 to USART1 (see PeripheralPins.c)
So you should also change (in variant_generic.h)
// UART Definitions
#ifndef SERIAL_UART_INSTANCE
#define SERIAL_UART_INSTANCE 1
#endif
Go to full post