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.

AM2434: CPSW Ethernet ClockP Problem

Part Number: AM2434
Other Parts Discussed in Thread: SYSCONFIG

Hi,

I'm trying to get the CPSW running. I found an example and it's actually working, but for some reason, it's using the ClockP module and if I removed the ClockP_init, it gets stuck in the initialization.

I want to eliminate the ClockP module from my project as I already use another GPTIMER for the timings. Is there anyway I can get the Ethernet working without the need to the ClockP module ? I found that it cannot be done directly from the Sysconfig. So, what do I need to change in the code sequence ?

and why does the ethernet module and the modules around it (like: I2C, and UDMA) need the ClockP ?

thank you in advance.

  • Hi Hatem,

    ClockP module is used to time the state machines and polling mechanisms to keep the critical tasks running. Without ClockP module, all of these tasks have to be updated with an alternative time keeping mechanism to keep the system tasks running. So, unless there is a specific need to remove ClockP out of your application completely, we would suggest you to continue using it. 

    If you need to eliminate the ClockP module completely, please provide some more information on the background of this requirement so that we can understand it better, and suggest any alternatives if possible.

    Thanks and regards,
    Teja.

  • I already have a GPTIMER running a scheduler. The problem arises when the ClockP starts, there's a conflict that makes my system fail for an unknown reason. After some debugging I found that the problem comes when I use the ClockP_init function, and without it the Ethernet Initialization surely gets stuck.

    So, if you are asking for a timer for time keeping mechanism, it's already there, but it's not the ClockP module at all.
    All I need now, is to learn which parts of the CPSW, and LwIP are using the timing, and why do they need it (when it comes to ethernet as a special case) so I can replace it with my timer.

    Please tell me if any more requirements needed.
    Thank you in advance Hearts

  • Update:

    I now believe that the ethernet needs the clock in two parts: the initialization, and the polling as a receive task.
    I reached to a point that I leave the ClockP in the initialization phase, and I destruct the ClockP and disable its interrupt.
    That worked well for me in case I send packets from the board to the outside.

    I used the following lines to do that:

        ClockP_stop(&pollLinkClkObj);

        ClockP_destruct(&pollLinkClkObj);

        HwiP_disableInt(160); // 160 for timer 8



    But of course, it still needs a polling task to receive. So, at the moment I still can't receive packets from the outside to the board.
    So, what I need now is to know which callback I need to use as a periodic task to receive properly.

  • Hi, 

    If you are using any layer 2 examples for your testing, the Rx and Tx packet handling is done with interrupts. So, you can use it for verifying the usecase. Apart from the polling task, there is also a PHY state handler task, which manages PHY status and link status. This is also a critical task, and without it, the PHY wouldn't get link up. You should also handle this to enable packet transmission. 

    But if your usecase is just to enable GPTIMER along with ClockP, then I will check with corresponding experts if that can be done without removing ClockP module. If it is possible, then you can continue using the ethernet drivers without any issues. 

    Regards,
    Teja.

  • Actually, I wanted to eliminate the ClockP not just make it work alongside the GPTIMER. Anyway, I found a solution to my problem which is disabling the ClockP after the initialization using the APIs I mentioned in previous comment.

    That leaves us with the polling task that handles the receiving and sending events. I found that the polling tasks needed an enabler for the TX or the RX. That enable was found in the event that comes periodically. So, I enabled the RX and the TX manually inside a polling task of my own using these two APIs:

    LWIPIF_LWIP_rxPktHandler(g_pNetif[ENET_SYSCFG_DEFAULT_NETIF_IDX]);
    LWIPIF_LWIP_txPktHandler(g_pNetif[ENET_SYSCFG_DEFAULT_NETIF_IDX]);

    So, thanks for the advice, it's now working fine without the ClockP module.