Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards/nucleo-f302r8: add rs485 support #16035

Merged
merged 1 commit into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions boards/arm/stm32/nucleo-f302r8/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ config NUCLEOF302R8_HIGHPRI
bool "High priority interrupt test"
default n

config NUCLEOF302R8_RS485_WAVESHARE
bool "Map USART1 pins to match RS485 CAN Waveshare shield"
default n

if SENSORS_QENCODER

config NUCLEO_F302R8_QETIMER
Expand Down
27 changes: 24 additions & 3 deletions boards/arm/stm32/nucleo-f302r8/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,31 @@
#define GPIO_USART2_RX GPIO_USART2_RX_2 /* PA3 */
#define GPIO_USART2_TX GPIO_USART2_TX_2 /* PA2 */

/* USART1 */
/* USART1
*
* At default use:
* USART1_RX - PB7
* USART1_TX - PB6
*
* If CONFIG_NUCLEOF302R8_RS485_WAVESHARE=y use configuration to match RS485
* shield from Waveshare:
*
* USART1_RX - PA10
* USART1_TX - PA9
* RS485_DIR - PA8 (arduino D7)
*
*/

#define GPIO_USART1_RX GPIO_USART1_RX_2 /* PB7 */
#define GPIO_USART1_TX GPIO_USART1_TX_2 /* PB6 */
#ifdef CONFIG_NUCLEOF302R8_RS485_WAVESHARE
# define GPIO_USART1_RX GPIO_USART1_RX_1 /* PA10 */
# define GPIO_USART1_TX GPIO_USART1_TX_1 /* PA9 */
# define GPIO_USART1_RS485_DIR (GPIO_OUTPUT | GPIO_PUSHPULL | \
GPIO_SPEED_50MHz | GPIO_OUTPUT_CLEAR | \
GPIO_PORTA | GPIO_PIN8)
#else
# define GPIO_USART1_RX GPIO_USART1_RX_2 /* PB7 */
# define GPIO_USART1_TX GPIO_USART1_TX_2 /* PB6 */
#endif

/* CAN */

Expand Down
Loading