using the can implementation below is giving me some strange results.
void CAN2_SignalObjectEvent (uint32_t obj_idx, uint32_t event) { if (event == ARM_CAN_EVENT_RECEIVE) { // If receive event if (obj_idx == rx2_obj_idx) { // If receive object event ptrCAN->MessageRead(rx2_obj_idx, &rx2_msg_info, rx2_data, 8U); } } if (event == ARM_CAN_EVENT_SEND_COMPLETE) { // If send completed event if (obj_idx == tx2_obj_idx) { // If transmit object event sendCompleted=true; } } }
At times I get the ARM_CAN_EVENT_RECEIVE but more often then not this is not triggered. When it does work I get an rx2_obj_idx of 0. Not sure what 0 is when I have can1 and 2? My ECU i'm interfacing with is replying to my send command with in 3-8ms. Not sure if that is too fast or not, I doubt it. I do get my ARM_CAN_EVENT_SEND_COMPLETE every time.
Also was wondering what is the max filters we can add?
or, can this be somehow used dynamically? Like;
if (obj_idx == rx2_obj_idx) { // If receive object event ptrCAN->ObjectSetFilter(rx2_obj_idx, ARM_CAN_FILTER_ID_EXACT_ADD, ECU, 0U); ptrCAN->MessageRead(rx2_obj_idx, &rx2_msg_info, rx2_data, 8U); }
I didn't fully understand loop-backs were for testing.