Visitor II
July 3, 2017
Question
Bug in ST HAL CAN: pTxMsg, pRxMsg and pRx1Msg never initialized
- July 3, 2017
- 1 reply
- 992 views
Posted on July 04, 2017 at 01:19
CanTxMsgTypeDef* pTxMsg, pRxMsg and pRx1Msg in CAN_HandleTypeDef are never initialized.
I am convinced that they shouldn't be pointers and should just be defined as part of the structure directly, as in:
typedef struct
{ CAN_TypeDef *Instance; /*!< Register base address */ CAN_InitTypeDef Init; /*!< CAN required parameters */ CanTxMsgTypeDef TxMsg; /*!< Rransmit structure */ CanRxMsgTypeDef RxMsg; /*!< Reception structure for RX FIFO0 msg */ CanRxMsgTypeDef Rx1Msg; /*!< Reception structure for RX FIFO1 msg */ __IO HAL_CAN_StateTypeDef State; /*!< CAN communication state */ HAL_LockTypeDef Lock; /*!< CAN locking object */ __IO uint32_t ErrorCode; /*!< CAN Error code */}CAN_HandleTypeDef;See attached diff file for the complete fix. I am using STM32Cube_FW_F4_V1.16.0 but I am pretty sure this applies to many older versions.
#bug #can #hal