diff --git a/arch/arm/src/stm32f7/stm32_can.c b/arch/arm/src/stm32f7/stm32_can.c index 6c76472af5..6f5ccda13f 100644 --- a/arch/arm/src/stm32f7/stm32_can.c +++ b/arch/arm/src/stm32f7/stm32_can.c @@ -1288,8 +1288,11 @@ static int stm32can_send(FAR struct can_dev_s *dev, } #else - regval &= ~CAN_TIR_STID_MASK; - regval |= (uint32_t)msg->cm_hdr.ch_id << CAN_TIR_STID_SHIFT; + regval |= ( ( (uint32_t) msg->cm_hdr.ch_id << CAN_TIR_STID_SHIFT) & CAN_TIR_STID_MASK ); + +#ifdef CONFIG_CAN_USE_RTR + regval |= (msg->cm_hdr.ch_rtr ? CAN_TIR_RTR : 0); +#endif #endif stm32can_putreg(priv, STM32_CAN_TIR_OFFSET(txmb), regval); diff --git a/drivers/can/Kconfig b/drivers/can/Kconfig index d5298d77e7..ae54205550 100644 --- a/drivers/can/Kconfig +++ b/drivers/can/Kconfig @@ -128,6 +128,12 @@ config CAN_NPOLLWAITERS ---help--- The maximum number of threads that may be waiting on the poll method. + +config CAN_USE_RTR + bool "Include RTR in CAN header" + default n + ---help--- + This selection includes RTR bitfield in the CAN header. comment "CAN Bus Controllers:"