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.

LAUNCHXL2-570LC43: DCAN can not work when integrated with lwip UDP program

Part Number: LAUNCHXL2-570LC43
Other Parts Discussed in Thread: HALCOGEN

hello, 

    Recently, i start to use TMS570LC43x LAUANCHPAD, and it‘s my first time to use TI's products.So,maybe I am not skilled at using it.

    Now I have encountered such a problem.At first, I modified the lwip demo to send and receive UDP frame ,and it works well. Then i follow the instructions of the  HALCOGEN  DCAN communication example, and realized it ,it also works well.But when i  combined them ,DCAN don't work. After debugging the program step by step ,i found that ,after  canInit() executed,the register’s value of DCAN in the combined progarm is diferrent  with that in the separate DCAN test program .Specifically,when Initial DACN 1 , excuting canREG1->IF1CMD  = (uint8) 0xF8U; IF1CMD Stay the same ,seems can't be write.

    This problem has troubled me for a long time,Has anyone encountered a similar problem? I don't know if it is wrong with me. Please give me some advice. I don't know what to do now.

  • Hello,

    There is one BUSY bit in DCAN IF1 CMD register. While this Busy bit is one, IF1/IF2 Register sets are write protected. Did you check this busy bit before you write IF!CM register?

    This busy bit is set to 1 after the message number has been written to bits [7:0].
  • Thank you for you reply.

    I think the program have checked the busy bit by the following Statement,before writing IF1CMD:

    while ((canREG1->IF1STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    I also confirmed it,bofore writing to IF1CMD ,the BUSY bit is zero.

    Moreover, the canInit() function is generated by HALCOGEN ,and i have compared the HL_can.c  file in two program ,they are the same,so i think  there may be problems elsewhere.

    Do you know where else there might be problems?

  • I have found cause of the problem.
    The statements in the HL_sys_common.h line 97~102 ,define its little endian or not .In lwip program it's defined little endian ,but in the independent DCAN communication program it's not .so the order of DCAN registers is wrong ,and writing to these position will not succeed.

    But there is still a problem, the HL_sys_common.h is generated by HALCOGEN ,why they are different?