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.

question about dcan communication with lwip

Other Parts Discussed in Thread: HALCOGEN

Hi!

I use TMS570LC43x and commpiler CCSv6,HALCoGen.

I try to dcan communcation including raw socket of lwip.(HALCoGen EMAC Driver with lwIP Demonstration, dcan communicaion sample source)

Each works well.

But Combining the two programs do not work dcan using HALCoGen.

I think that dcan interrupt dose not operate.

attach all program.

1258.http and RawSocket and Dcan.zip

What is problem?

  • Hi Jongsong,
    Can you please give some more details as to why you think the DCAN interrupt is not operating?

    Can you check a few things?

    In the DCAN module, do you see any interrupt flags set in the INTPNDx (interrupt pending register)? If the DCAN is operating correctly it should set an interrupt flag here.
    In the VIM module, do you see any interrupt flags set in the INTREQx? If the VIM receives an interrupt from the DCAN module, it should set an interrupt request flag here.
    In the CPU CPSR register do you see both the I and F bits clear (clear means the interrupt is enabled)? The CPU must be enabled to receive interrupt.
    In the ESM module, do you see any flags set in the ErrStat registers? If you have any errors then the CPU will take a FIQ exception to service them. Since FIQ is of higher priority than IRQ, a constant error may preempt an IRQ from being served.

    If you place a breakpoint in the DCAN ISR do you see the CPU coming to the ISR?

    When you said the DCAN interrupt is not operating, does the EMAC continue to work properly?
  • Thank you for reply.

    The final objective of the development is that  PC transmit data using TCP/IP socket and then the received data resend to each node using dcan communication.

    The reverse is also the same.

    First, It was added to the original source of lwip's hcg , as follows.

    - can driver

     - each can msg configuration(same can1,can2,can3,can4)

     - vim channel 16,35,45,113 interupt ( can high)

       7725.HALCoGen-TMS570LC43x.zip

    Second, add dcan source in lwip_main.c of  HALCoGen EMAC Driver with lwIP Demonstration.(staic ip 192.168.0.150)

    5277.lwip_main.zip

      Result :

     1. http server works well.

     2. tcp/ip secver socket works well.

     3. dcan test fail.

    I am a novice one months after starting the firmware development.

    I do not know what the problem is . Please help .

    Thank you for reading long sentences .

  • Hi Jongsong,

      Are you saying that the code will only execute the statements within if (node == canREG1)? 

      If the code has at least come here then you are generating an interrupt properly because this is the ISR the CPU is executing. I think the reason why the code is stuck in the loop is  because the interrupt pending flag is not cleared. The tx_done is a variable you declare. By setting tx_done=1 does not tell the DCAN module that the CPU has serviced its interrupt. When CAN1 message box 1 generates an interrupt after it finishes the transmit it will set the IntPnd flag in its message box. The software needs to clear it so that the next highest pending interrupt (in your case it will be the message box 2 which is supposed to receive the data from message box 1) will be known to the CPU. Also the way you write your code is to share the canMessageNotification() among all four CAN modules. In this case, until CAN1 is serviced, other CANx can not be serviced. 

      You need to clear the IntPnd flag using the IF1/2 registers. Once you do that the CAN1 message 2 and subsequent message boxes will be serviced. After CAN1 is serviced the other CAN modules can be serviced.

      I will suggest that you go through the DCAN chapter in the TRM. I understand there are quite some pages of reading. Or you can go to the HalCoGen examples for reference.