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.

Few Msg Obj IF1,Few IF2 in DCAN

Other Parts Discussed in Thread: HALCOGEN

While checking the code generated by Halcogen, to check if a msg obj is free or not, few msg obj check IF1STAT,few check IF2STAT.

Why is it so?

  • Hi Akshay,
    The DCAN module provides the Interface Register 1 and 2 (IF1 and IF2) to interface with the message RAM. You might setup IF1 to transfer IF1 register set to the message RAM and use the IF2 to transfer from message RAM to IF2 register set. Both interface register sets can be used and operate at the same time. So depending use interface register set you are using you will poll the respective IFxSTAT to see if the write or read between the IF register set and the message RAM has completed.
  • Yes.. Since ur Halcogen code executes sequentially,and each config for a mess object has a while(IFx is not ready) loop,u could have used only IF1. Why alternate between IF1 and IF2
  • Can If1 and 2 be used interchangeably without any additional changes? If i replace ur Halcogen code for IF2 to IF1 without configuring any other registers,would it still be possible?
  • Yes, you could just use one set of IF registers. The reason HALCoGen alternates the use of IF1 and IF2 when initializing the can mailboxes is that you don't waste time waiting for the IF registers to write to the mailbox RAM before starting to setup the next mailbox. For example, in canInit(), it uses IF1 registers to setup message1, then it checks if IF2 registers are busy (they should not be because they have not been used yet). Now it can write to IF2 registers while the IF1 registers are being copied into the message RAM by the DCAN hardware. Then while IF2 registers are being copied into message2 RAM, the code checks if IF1 registers are busy and then starts to setup message3.

    The whole setup could be done using only IF1 (or only IF2), but then the code would actually spend some time waiting in the loop:

    while ((canREG1->IF1STAT & 0x80U) ==0x80U);

  • Makes perfect sense. Il be using all 64 mailboxes setting the EoB values for the 1st 7 in each block to 0 and the last mailbox in the block to 1 . I didnt want to manually configure it for each mailbox as its very timeconsuming to do it individually for each mailbox.. I thought of configuring the mailbox's and values in a for loop,where il apply logics appropriately.. I have no issues in spending a little time extra during can_init(). Thanks :)