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.

TMS320F28379D: About The IF3 register set of CAN module

Part Number: TMS320F28379D

Hi,

1、How to use The IF3 register set?

2、When I set some value from the message object by  The IF1 register set, then I set the CAN_IF3OBS Register and CAN_IF3UPD Register.

     But I can't see any value from IF3 register set in CCS "Registers".

Thanks!

  • 1、How to use The IF3 register set?

    IF3 is similar in functionality to IF1/IF2, with the exception that it can be used only for reception and that, once configured, update of IF3 register set is automatic upon reception of data. Please refer to the TRM for more details.

    2、When I set some value from the message object by  The IF1 register set,

    I don't understand why you need to involve IF1.

    then I set the CAN_IF3OBS Register and CAN_IF3UPD Register.

    You mean you configure IF3OBS and IF3UPD registers. 

    But I can't see any value from IF3 register set in CCS "Registers".

    It is hard for me to say why. Ensure that the frame you expect to see was actually transmitted on the bus. Check if you are able to read the frame with IF1 or IF2. Update to the latest version of CCS. Older versions have some issues displaying certain registers correctly.

  • Hi,

    2、When I set some value from the message object by  The IF1 register set,

    I don't understand why you need to involve IF1.

    That is, I shall config message object from IF1 register set first. And then I can observe message object from IF3 register set. That's why I shall config  CAN_IF3OBS Register and CAN_IF3UPD Register.  I want to confirm whether this method is correct.

    Thanks!

  • Hi,

       My test program is:

     ////////////////IFx Register test/////////////////////
        Uint32 IF1_Rdata=0, IF2_Rdata=0, IF3_Rdata=0;
        Uint32 IF4_Rdata=0, IF5_Rdata=0, IF6_Rdata=0;

        HWREGH(CANA_BASE + CAN_O_IF1CMD + 2)  = 0x930000 >> 16;
        HWREGH(CANA_BASE + CAN_O_IF1DATA)     = 0x13579BDE;
        HWREGH(CANA_BASE + CAN_O_IF1DATA + 2) = 0x13579BDE >> 16;
        HWREGH(CANA_BASE + CAN_O_IF1DATB)     = 0x5A6B7C8D;
        HWREGH(CANA_BASE + CAN_O_IF1DATB + 2) = 0x5A6B7C8D >> 16;
        HWREGH(CANA_BASE + CAN_O_IF1MCTL)     = 0xE88;
        HWREGH(CANA_BASE + CAN_O_IF1CMD)      = 0x1;

        while(HWREGH(CANA_BASE + CAN_O_IF1CMD) & CAN_IF1CMD_BUSY)
        {
        }
        HWREGH(CANA_BASE + CAN_O_IF3OBS)     = 0x1F;
        HWREGH(CANA_BASE + CAN_O_IF3UPD)     = 0xFFFFFFFF;
        HWREGH(CANA_BASE + CAN_O_IF3UPD + 2) = 0xFFFFFFFF >> 16;
        while(HWREGH(CANA_BASE + CAN_O_IF3OBS) & CAN_IF3OBS_IF3SC)
        {
        }
        while(HWREGH(CANA_BASE + CAN_O_IF3OBS) & CAN_IF3OBS_IF3SDA)
        {
        }
        while(HWREGH(CANA_BASE + CAN_O_IF3OBS) & CAN_IF3OBS_IF3SDB)
        {
        }
        IF1_Rdata = HWREGB(CANA_BASE + CAN_O_IF3DATA); //use HWREGB
        IF2_Rdata = HWREGB(CANA_BASE + CAN_O_IF3MCTL);
        IF3_Rdata = HWREGB(CANA_BASE + CAN_O_IF3DATB);
        IF4_Rdata = HWREGH(CANA_BASE + CAN_O_IF3DATA);//use HWREGH
        IF5_Rdata = HWREGH(CANA_BASE + CAN_O_IF3MCTL);
        IF6_Rdata = HWREGH(CANA_BASE + CAN_O_IF3DATB);     

    //////////////////////////////////test finish/////////////////////////////////////

        And the result is following Figure.

      Was there anything wrong?

  • I shall config message object from IF1 register set first. And then I can observe message object from IF3 register set. That's why I shall config  CAN_IF3OBS Register and CAN_IF3UPD Register.  I want to confirm whether this method is correct.

    Yes, you need to use IF1/IF2 to configure the message object first. 

    • Why is it that you don’t write to the Arb field (MSGID) of Message object 1? How would any message be received in that message object? 
    • You are only configuring message object 1, but IF3UPD = 0xFFFFFFFF. Nothing wrong but I am wondering if you are expecting data in other mailboxes as well. 
    • For accessing lower or upper 16-bits of a register, use HWREGH. For example, 

    HWREGH(ui32Base + CAN_O_IF1ARB) = 0;     //LOWER 16-bit

    HWREGH(ui32Base + CAN_O_IF1ARB + 2) = 0; //UPPER 16-bit

    You have to add 2 to access upper 16-bits when dealing with byte peripherals such as CAN.

    • For all 32-bit access, use HWREG_BP.
  • Hi,

       The above program segment is only for testing. That's why "Why is it that you don’t write to the Arb field (MSGID) of Message object 1?" and "You are only configuring message object 1, but IF3UPD = 0xFFFFFFFF."   I only want to test how to get message from IF3.

      I have confirmed to you that the program segment is correct. But I don't know why I can't get the message from IF3.

        Thanks!

  • Program segment is not correct. You have not configured the message object with the Arb field. Without a MSGID, how will you receive a frame? You first need to confirm the data you are expecting was received in the first place before expecting it to be read through IF3 registers.

    Below from my first reply:

     Ensure that the frame you expect to see was actually transmitted on the bus. Check if you are able to read the frame with IF1 or IF2.

  • Hi,

       I need to confirm with you again.  Do I have to make sure that CAN actually receives the message, when I need to use IF3 register set? Instead of just only writing a message to the message object through IF1/IF2  register set ?

       Thanks!

  • Do I have to make sure that CAN actually receives the message, when I need to use IF3 register set? 

    Yes.