// Configure message object 31 to receive all 29-bit messages from only note 0xC8 msg_obj.msgobj = 31; msg_obj.mode_id = CAN_MSGOBJ_EXT | 0xC8; msg_obj.mask = 0xC8+ 1; (*rom)->pCAND->config_rxmsgobj(&msg_obj); |
for(i = 0; i < 30; i++) { msg_obj.msgobj = i; msg_obj.mode_id = 0x400; msg_obj.mask = 0x00; (*rom)->pCAND->config_rxmsgobj(&msg_obj); } |
for(i = 0; i < 30; i++) { msg_obj.msgobj = i; msg_obj.mode_id = 0x400; msg_obj.mask = 0x00; (*rom)->pCAND->config_rxmsgobj(&msg_obj); } |
os_evt_wait_or (EVT_CAN_int, 0xFFFF);//It is RTX rotine. It wait until CANrx interrupt is not happen mob_amount = msg_obj.msgobj; for(mob_num = 0; mob_num <= mob_amount; mob_num++)//read and process all used messages objects { NVIC_DisableIRQ(CAN_IRQn); msg_obj.msgobj = mob_num; (*rom)->pCAND->can_receive(&msg_obj);//read mob_num message object id = msg_obj.mode_id; len = msg_obj.dlc; for(i = 0; i<8; i++) data = msg_obj.data; NVIC_EnableIRQ(CAN_IRQn); //process data from this message object ... ... //------------------------------------ } |
void CAN_rx(uint8_t msg_obj_num){ msg_obj.msgobj = msg_obj_num; isr_evt_set (EVT_CAN_ISR, CAN_ISR); return; } |
for(i = 0; i < 30; i++) { msg_obj.msgobj = 30; msg_obj.mode_id = 0x400; msg_obj.mask = 0x00; (*rom)->pCAND->config_rxmsgobj(&msg_obj); } |