stm32h7/linum-stm32h753bi: fix fdcan configuration

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
This commit is contained in:
Jorge Guzman 2024-04-07 10:28:30 -03:00 committed by Xiang Xiao
parent 3093b28860
commit d4acd6949f
4 changed files with 44 additions and 6 deletions

View file

@ -873,3 +873,23 @@ tone
This example demonstrates how to use PWM4 and Timer17 to play music using the Tone library and the board's buzzer. This example demonstrates how to use PWM4 and Timer17 to play music using the Tone library and the board's buzzer.
socketcan
---------
This example demonstrates how to use the CAN-FD peripherals can0 and can1 with the SocketCAN protocol.::
# Configure the can0 and can1 to send messages
nsh> ifup can0
ifup can0...OK
nsh> ifup can1
ifup can1 ...OK
nsh> cansend can0 123#DEADBEEF
nsh> cansend can1 5A1#11.2233.44556677.88
# Reset the board and configure the can0 peripheral to receive messages
nsh> ifup can0
ifup can0...OK
nsh> candump can0
can0 051 [8] 00 11 22 33 44 55 66 77
can0 051 [16] 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF

View file

@ -35,6 +35,10 @@ CONFIG_DEBUG_NET_ERROR=y
CONFIG_DEBUG_NET_INFO=y CONFIG_DEBUG_NET_INFO=y
CONFIG_DEBUG_NET_WARN=y CONFIG_DEBUG_NET_WARN=y
CONFIG_DEBUG_SYMBOLS=y CONFIG_DEBUG_SYMBOLS=y
CONFIG_FDCAN1_ARBI_BITRATE=125000
CONFIG_FDCAN1_DATA_BITRATE=1000000
CONFIG_FDCAN2_ARBI_BITRATE=125000
CONFIG_FDCAN2_DATA_BITRATE=1000000
CONFIG_FS_PROCFS=y CONFIG_FS_PROCFS=y
CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y CONFIG_INTELHEX_BINARY=y

View file

@ -366,8 +366,8 @@
/* RS485 DIR pin: PA15 */ /* RS485 DIR pin: PA15 */
# define GPIO_UART4_RS485_DIR (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_100MHz|\ # define GPIO_UART4_RS485_DIR (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_100MHz |\
GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN15) GPIO_OUTPUT_CLEAR | GPIO_PORTA | GPIO_PIN15)
#endif #endif
@ -422,13 +422,17 @@
/* FDCAN1 */ /* FDCAN1 */
#define GPIO_CAN1_RX (GPIO_CAN1_RX_3|GPIO_SPEED_50MHz) /* PD0 */ #define GPIO_CAN1_RX (GPIO_CAN1_RX_4|GPIO_SPEED_50MHz) /* PH14 */
#define GPIO_CAN1_TX (GPIO_CAN1_TX_3|GPIO_SPEED_50MHz) /* PD1 */ #define GPIO_CAN1_TX (GPIO_CAN1_TX_4|GPIO_SPEED_50MHz) /* PH13 */
#define GPIO_CAN1_STD (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_100MHz |\
GPIO_OUTPUT_CLEAR | GPIO_PORTI | GPIO_PIN2) /* PI2 */
/* FDCAN2 */ /* FDCAN2 */
#define GPIO_CAN2_RX (GPIO_CAN2_RX_2|GPIO_SPEED_50MHz) /* PB5 - D11 */ #define GPIO_CAN2_RX (GPIO_CAN2_RX_1|GPIO_SPEED_50MHz) /* PB12 */
#define GPIO_CAN2_TX (GPIO_CAN2_TX_2|GPIO_SPEED_50MHz) /* PB6 - D1 */ #define GPIO_CAN2_TX (GPIO_CAN2_TX_1|GPIO_SPEED_50MHz) /* PB13 */
#define GPIO_CAN2_STD (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_100MHz |\
GPIO_OUTPUT_CLEAR | GPIO_PORTE | GPIO_PIN3) /* PE3 */
/* QSPI Mapping */ /* QSPI Mapping */

View file

@ -294,10 +294,20 @@ int stm32_bringup(void)
#ifdef CONFIG_NETDEV_LATEINIT #ifdef CONFIG_NETDEV_LATEINIT
# ifdef CONFIG_STM32H7_FDCAN1 # ifdef CONFIG_STM32H7_FDCAN1
/* Enable and configure CAN1 */
stm32_configgpio(GPIO_CAN1_STD);
stm32_gpiowrite(GPIO_CAN1_STD, false);
stm32_fdcansockinitialize(0); stm32_fdcansockinitialize(0);
# endif # endif
# ifdef CONFIG_STM32H7_FDCAN2 # ifdef CONFIG_STM32H7_FDCAN2
/* Enable and configure CAN2 */
stm32_configgpio(GPIO_CAN2_STD);
stm32_gpiowrite(GPIO_CAN2_STD, false);
stm32_fdcansockinitialize(1); stm32_fdcansockinitialize(1);
# endif # endif