2023-08-24 05:21 AM
HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, const CAN_TxHeaderTypeDef *pHeader, const uint8_t aData[], uint32_t *pTxMailbox)
hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->ExtId << CAN_TI0R_EXID_Pos) | pHeader->IDE | pHeader->RTR);
hcan->Instance->sTxMailBox[transmitmailbox].TIR = ((pHeader->ExtId << CAN_TI0R_EXID_Pos)|(pHeader->IDE<<<2)|pHeader->RTR);
Solved! Go to Solution.
2023-08-24 05:40 AM
Lets look at the IDE parameter in HAL:
uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted.
This parameter can be a value of @ref CAN_identifier_type */
Okay, so let's look at the CAN_identifier_type values:
/** @defgroup CAN_identifier_type CAN Identifier Type
* @{
*/
#define CAN_ID_STD (0x00000000U) /*!< Standard Id */
#define CAN_ID_EXT (0x00000004U) /*!< Extended Id */
So those are 0 or 4, which already accounts for the bit shift of 2.
No HAL bug here.
2023-08-24 05:40 AM
Lets look at the IDE parameter in HAL:
uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted.
This parameter can be a value of @ref CAN_identifier_type */
Okay, so let's look at the CAN_identifier_type values:
/** @defgroup CAN_identifier_type CAN Identifier Type
* @{
*/
#define CAN_ID_STD (0x00000000U) /*!< Standard Id */
#define CAN_ID_EXT (0x00000004U) /*!< Extended Id */
So those are 0 or 4, which already accounts for the bit shift of 2.
No HAL bug here.
2023-08-24 05:53 AM
Ok, thanks, I've been wrong all this time thinking that parameter was set to "1" and this wasn't working for me.
Sometimes the way is simpler than it seems :rolling_on_the_floor_laughing: