This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDXDOCK28075: Unableto get interrupt-driven CAN to work

Part Number: TMDXDOCK28075

I have written a small program to receive CAN messages and ship them out on USB.using a TMS320F28075 development board, using the CAN library..  The problem I am having is that when the processor receives a 

CAN message it generates a status interrupt indicating that a message was received but does not associate the incoming message with a message object.  Now for the details:

- The system is running on a 20Mhz crystal, multiplied to 120Mhz for the actual clock (time 12 divided by 2).

- CAN is running at 500 kbps.  On an oscilloscope I can see the incoming message and the acknowledgement that that the message was seen.

- At the same time I get an interrupt.  CANIntStatus(CANA_BASE, CAN_INT_STS_CAUSE) returns 0x8000 instead of 4 (the expected message object index)

- All of the message objects except for index 4 are disabled.

- On the interrupt  CANStatusGet(CANA_BASE, CAN_STS_CONTROL) returns the RxOK bit set.

- The message object was initialized via CANMessageSet(CANA_BASE, RECEIVE_MESSAGE_OBJECT, &sRXCANMessage, MSG_OBJ_TYPE_RX).  The only two flags set are receive interrupt and extended addressing.

When CANMessageGet is called it clears the message length and leaves the other fields untouched, because NEWDAT is not set for the message object.

Any suggestions for what to look at next would be much appreciated

  • Paul,

    You can check the CAN_IPEN_21 register to see which message objects have an interrupt pending. Your status interrupt is keeping you from seeing the message object number in the interrupt cause register.
  • Adam,

     

    Thank you for the suggestion. 

    The CAN_IPEN_21 register is zero on entry to the interrupt, as is NEWDAT.

    It's as if the CAN controller is recognizing that a well-formed message has been received but that the message does not match any of the active message objects.  When I read the MSGVAL register it returns the value of 8, which corresponds to message object 4 being the only active object.  Message object 4 has a zero ID mask and the only flags turned on by the program are

    MSG_OBJ_RX_INT_ENABLE | MSG_OBJ_EXTENDED_ID | MSG_OBJ_FIFO

    I have tried it both with and without the FIFO flag.

     

     

  • Paul,

    If you want to use the ID mask, you need to set the MSG_OBJ_USE_ID_FILTER flag as well.
  • Adam,

    I want to accept all messages (i.e., no filtering on message ID). I thought that if the flag was zero that is what would happen. Apparently not. When I turned on the flag with a zero mask things started to work.

    Thank you.
  • Paul,

    I'm glad your code is working now. I agree that the flag name is a bit unclear. I'll send a report to our software team.