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.

Clearing NEWDATx in TMS570 DCAN

I know there have been posts on this subject before, but I still can't get it to work.

Firstly can you tell me if my understanding of the hardware mechanism is correct: There are two sets of NEWDAT registers, one set in the DCAN module and one in the interface registers. When a message arrives a bit corresponding to the message box is set within the DCAN register and this is automatically copied to the interface register, but to clear it requires software intervention. Is that right?

Some of the previous posts suggests that I have to use the interface registers to clear this, that it cannot be done directly.

I have the NEWDATX and NEWDATx registers in view in the debugger. After sending a message the value of NEWDAT12 is 0x00000001, so the message is stored in message box 1.

After reading the data I have the following fragment:

                    CAN2_RX_Unload_Rx_Msg( Msgbox_num_u8 );
                    
                    /** - Setup IF2 for reading data
                    *     - Wait until IF2 is ready for use
                    *     - Set IF2 control byte
                    */
                    while (canREG2->IF2STAT & CAN_IFSTAT_BUSY){}
                    canREG2->IF2CMD = ( CAN_IFCMD_READ | CAN_IFCMD_CLRINTPEND );
                    canREG2->IF2NO   = Msgbox_num_u8;
                    
                    while (canREG2->IF2STAT & CAN_IFSTAT_BUSY){}

where:

CAN_IFSTAT_BUSY = 0x80

CAN_IFCMD_READ = 0

CAN_IFCMD_CLRINTPEND = 0x08

Msgbox_num_u8 = 1

Any suggestions on what I'm doing wrong?

Regards

Andy