AnsweredAssumed Answered

Trying to interface to CAN code

Question asked by ebommer on Sep 8, 2014
Latest reply on Sep 9, 2014 by Montassar BEN ROMDHANE

I am trying to assign a value to the IDE bit.  But when I try to write this I am getting a “HardFault_Handler”.  I am sure it has to do with my syntax, but I have been writing requirements for too many years now and not enough code, so any help is appreciated.

My current attempt is:

hcan.pTxMsg->IDE = 0x04;

Cube generated the following structures:

CAN_HandleTypeDef       hcan

typedef struct{

      uint32_t    StdId

      uint32_t    ExtId

      uint32_t    IDE

      uint32_t    RTR

      uint32_t    DLC

uint32_t    Data[8

}CanTxMsgTypeDef;

typedef struct{

      CAN_TypeDef                *Instance

      CAN_InitTypeDef            Init

      CanTxMsgTypeDef            *pTxMsg

      CanRxMsgTypeDef            *pRxMsg

      HAL_LockTypeDef            Lock

      __IO HAL_CAN_StateTypeDef  State

      __IO HAL_CAN_ErrorTypeDef  ErrorCode

}CAN_HandleTypeDef;

 

Outcomes