Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE
I changed can_ex2_loopback_interrupts sample from C2000Ware 3.04 to consider differences in my hardware setup (CAN-B instead of CAN-A, other GPIOs and 1 Mbit/s instead of 500 Kbit/s). Also I disabled external loopback mode and the code that sends packets (because I want to test receive part). Now I see two strange behaviour:
1) ISR is called twice after receiving a CAN-packet with CAN-id 0x1 which is specified as an ID for receive mailbox. The first time it is called as a response to status change and the second time it's called as a response to mailbox event.
It seems to me that from the point of performance both events should be handled in one call. So the logic of ISR should be like so:
// // Read the CAN interrupt status to find the cause of the interrupt // status = CAN_getInterruptCause(CAN_BASE); // // If the cause is a controller status interrupt, then get the status // if(status == CAN_INT_INT0ID_STATUS) { // code from sample // ... // read interrupt status again to get another causes status = CAN_getInterruptCause(CAN_BASE); // <----- new code } // // Check if the cause is the transmit message object 1 // if(status == TX_MSG_OBJ_ID) // <--- here without "else" { // ...
// not sure whether should I repeat call to CAN_getInterruptCause() here as above and remove "else" clause from below } // // Check if the cause is the receive message object 2 // else if(status == RX_MSG_OBJ_ID) // <------ maybe one should remove "else" keyword here as above { // ... } // ...
2) ISR is called even if CAN-packet with any other ID is received. What's the purpose of such behaviour? Why controller reacts to packets that it's not interrested in (i.e. is not configured for receiving them)?
I don't want to react to any CAN-packet in CAN-network but want to react to errors. Is it possible ?
Regards,
Alex