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.

Problem with extracting data from CAN message

Other Parts Discussed in Thread: HALCOGEN

Hi folks,

I have a problem with the CAN on my TMS570 Dev Kit.

I configured the message object #1 of CAN1 as transmission object with 0x100 as identifier. As counterpart I configured message object #2 of CAN2 as reception object also with identifier 0x100. After this I wired CAN1 with CAN2 and started the transmission. Everything works fine, the message is recognized by CAN2 and the transmitted data is correct. For all this I am working with the generated functions from the HALCoGen code generator. I just extended canGetData() to extract the identifier type and the identifier itself.

And here is my problem: After loading the message object in IF2 during canGetData(), the If2Arb register shows the content 0x60000040, which is wrong. But the according message object in the message RAM shows 0x40000100, which is correct. This means I get 64 as identifier and not 256 as mentioned.

 

What am I doing wrong? Or is this a known malfunction?

  • Hi Gregor,

    Just a quick thought. You haven't confused hexadecimal and decimal notations when setting up the message id have you? 0x64 = 100 decimal.

    I think that this doesn't really fit your description, but if it was this, it would take ages to find!

    Regards, Tony.

  • Hi Tony,

    Thanks for answering that quick.

    Nice idea but I think I did set up the message id without confusion on hexadecimal /decimal notations. :)

    I configured the message with a 256 decimal, which appears as 0x100 in the message RAM.

    Also I have tested another ID. Same result. I discovered that no changes in the registers If2Msk and If2Arb occured after loading the message object. Is this normal?

     

    EDIT: I solved the problem on my own. Problem was a wrong value in IF2CMD. The last value that is written in IF2CMD was 0x17 at the end of canInit(). According to the manual you have to write 0x7F to IF2CMD to load the whole message. Very tricky.