/* Initialize the CAN controller */ (*rom)->pCAND->init_can(&ClkInitTable[0], 1); /* Configure the CAN callback functions */ (*rom)->pCAND->config_calb(&callbacks); /* Initiate object dictionary */ CANopen_Init_SDO(); /* Initialize CANopen handler */ myCANopen.node_id = CANnodeId; myCANopen.od_const_num = NumberOfmyConstODEntries; myCANopen.od_num = NumberOfmyODEntries; (*rom)->pCAND->config_canopen((CAN_CANOPENCFG *)&myCANopen); /* Enable the CAN Interrupt */ NVIC_EnableIRQ(CAN_IRQn); /* Configure message object 3 to receive all 11-bit messages 0x700-0x77F Network Management Error Control */ CANopen_Msg_Obj.msgobj = CAN_MSG_BUFFER_HEARTBEAT_RX; CANopen_Msg_Obj.mode_id = 0x700; CANopen_Msg_Obj.mask = 0x780; (*rom)->pCAND->config_rxmsgobj(&CANopen_Msg_Obj); /* Configure message object 5 to receive all 11-bit messages 0x000 (Network Management) */ CANopen_Msg_Obj.msgobj = CAN_MSG_BUFFER_NMT_RX; CANopen_Msg_Obj.mode_id = 0x000; CANopen_Msg_Obj.mask = 0x7FF; (*rom)->pCAND->config_rxmsgobj(&CANopen_Msg_Obj); /* Configure message object 7 to receive all 11-bit messages 0x580-5FF (SDO) */ CANopen_Msg_Obj.msgobj = CAN_MSG_BUFFER_SDO_CLIENT_RX; CANopen_Msg_Obj.mode_id = 0x580; CANopen_Msg_Obj.mask = 0x780; (*rom)->pCAND->config_rxmsgobj(&CANopen_Msg_Obj); /* Configure message object 9 to receive all 11-bit messages 0x200+NodeID (PDO) */ CANopen_Msg_Obj.msgobj = CAN_MSG_BUFFER_PDO_RX; CANopen_Msg_Obj.mode_id = SDOS_1400Sub1_Data; CANopen_Msg_Obj.mask = 0x7FF; (*rom)->pCAND->config_rxmsgobj(&CANopen_Msg_Obj); /* Configure message object 11 to receive all 11-bit rtr messages 0x?80+NodeID (PDO request) */ CANopen_Msg_Obj.msgobj = CAN_MSG_BUFFER_PDO_RXTX_REQ; CANopen_Msg_Obj.mode_id = SDOS_1800Sub1_Data | CAN_MSGOBJ_RTR; CANopen_Msg_Obj.mask = (~(SDOS_1800Sub1_Data ^ SDOS_1801Sub1_Data) & 0x7FF); (*rom)->pCAND->config_rxmsgobj(&CANopen_Msg_Obj); |