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.

TMS320F28388D: Cannot get "enet_lwip" example to run

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE,

Hello TI Support Team,

I imported both "cm_common_config_c28x" and "enet_lwip" from C2000Ware_3_03_00_00 into CCS.
Then, I set the following macros in the "cm_common_config_c28x" project through predefined symbols:
- ETHERNET
- USE_20MHZ_XTAL (my ControlCARD is rev MCU063A-)
Since my LAN is on 192.168.11.x I set in "enet_lwip"
    unsigned long IPAddr = 0xC0A80B20;
I also changed the following line in 2838x_flash_lnk_cm_lwip.cmd
.const           : > SRAM
to
.const           : > CMBANK0_SECTOR0
Next, I compiled both projects for FLASH and programmed the two cores.
 
Unfortunately, the CM does not respond to ping 192.168.11.32
My Ethernet cable is plugged into the single connector on the back of the card.

Are any hardware configurations required on the ControlCARD?

Any other suggestions on how to debug this?

Thanks,
Beat

  • Hi Beat,

    The DMA of ethernet cannot access FLASH sector. Without the change .const SRAM to CMBANK0_SECTOR is it working? In order to make it work standalone you can do something like this. Load const from Flash, copy it to sram in your main function before ethernet init.

    Linker cmd change:

    .const : {} LOAD = CMBANK0_SECTOR0 | CMBANK0_SECTOR1 ,
    RUN = SRAM,
    LOAD_START(constLoadStart),
    LOAD_SIZE(constLoadSize),
    LOAD_END(constLoadEnd),
    RUN_START(constRunStart),
    RUN_SIZE(constRunSize),
    RUN_END(constRunEnd)

    Main function addition:

    memcpy(&constRunStart, &constLoadStart, (size_t)&constLoadSize);

    Thanks,

    Yashwant

  • Hello Yashwant,

    Thank you for the quick response and explanations.

    I tried your modification, but was still unable to ping the CM. Let me investigate further and provide you with more information.

    In the meantime, can you please point me to a document that describes which portions of lwip are supported by your port. For example, I see the following comment in the code: "Current implementation works with Static IP address only."

    Regards,

    Beat

  • Hello Yashwant,

    I experimented some more this evening but without success.

    Are you able to able to run the demo from Flash as a standalone application, or are you always loading/debugging via CCS?

    Thanks,

    Beat

  • Hi Beat,

    We currently have tested it only through JTAG (debugging). For the future release we will be testing for the standalone mode.

    Have you used the FLASH configuration in the cm_common_config_c28x as well? As it will be needed to update the boot mode of CM from FLASH.

    Thanks,

    Yashwant

  • Yashwant,

    Yes, "_FLASH" is defined. "cm_common_config_c28" also misses an endless loop at the end of the main function, which I added.

    I suspect the problem is on the CM side. Probably with the device initialization (flash, peripheral clocks, watchdog?) when it boots without CCS configurations.

    By when do you think will you be able to make an updated release?

    Also, do you have any feedback on this:

    In the meantime, can you please point me to a document that describes which portions of lwip are supported by your port. For example, I see the following comment in the code: "Current implementation works with Static IP address only."

    Thanks,

    Beat

  • Hi Beat,

    Can you confirm you are using latest C2000Ware ?

    Regards,

    Vivek Singh

  • Hi Vivek,

    Affirmative: C2000Ware_3_03_00_00

    Thanks,

    Beat

  • Hi Beat,

    These are the latest files that have been tested for standalone mode. Can you try with the new updates.

    Regarding the lwip features support the comments are self explanatory. 

    5556.f2838xif.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    //###########################################################################
    //
    // FILE: f2838xif.c
    //
    // TITLE: F2838x interface port file.
    //
    //###########################################################################
    // $TI Release: $
    // $Release Date: $
    // $Copyright: $
    //###########################################################################
    /**
    * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without modification,
    * are permitted provided that the following conditions are met:
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    3731.enet_lwip.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    //###########################################################################
    //
    // FILE: enet_lwip.c
    //
    // TITLE: lwIP based Ethernet Example.
    //
    //###########################################################################
    // $TI Release: $
    // $Release Date: $
    // $Copyright: $
    //###########################################################################
    #include <string.h>
    #include "inc/hw_ints.h"
    #include "inc/hw_memmap.h"
    #include "inc/hw_nvic.h"
    #include "inc/hw_types.h"
    #include "inc/hw_sysctl.h"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    2352.startup_ccs.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    //###########################################################################
    //
    // FILE: startup_ccs.c
    //
    // TITLE: startup file for f2838x device.
    //
    //###########################################################################
    // $TI Release: $
    // $Release Date: $
    // $Copyright: $
    //###########################################################################
    //*****************************************************************************
    //
    // Forward declaration of the default fault handlers.
    //
    //*****************************************************************************
    void ResetISR(void);
    static void NmiSR(void);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    2838x_flash_lnk_cm_lwip_cmd.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    MEMORY
    {
    /* Flash sectors */
    CMBANK0_RESETISR : origin = 0x00200000, length = 0x00000008 /* Boot to Flash Entry Point */
    CMBANK0_SECTOR0 : origin = 0x00200008, length = 0x00003FF7
    CMBANK0_SECTOR1 : origin = 0x00204000, length = 0x00004000
    CMBANK0_SECTOR2 : origin = 0x00208000, length = 0x00004000
    CMBANK0_SECTOR3 : origin = 0x0020C000, length = 0x00004000
    CMBANK0_SECTOR4 : origin = 0x00210000, length = 0x00010000
    CMBANK0_SECTOR5 : origin = 0x00220000, length = 0x00010000
    CMBANK0_SECTOR6 : origin = 0x00230000, length = 0x00010000
    CMBANK0_SECTOR7 : origin = 0x00240000, length = 0x00010000
    CMBANK0_SECTOR8 : origin = 0x00250000, length = 0x00010000
    CMBANK0_SECTOR9 : origin = 0x00260000, length = 0x00010000
    CMBANK0_SECTOR10 : origin = 0x00270000, length = 0x00004000
    CMBANK0_SECTOR11 : origin = 0x00274000, length = 0x00004000
    CMBANK0_SECTOR12 : origin = 0x00278000, length = 0x00004000
    CMBANK0_SECTOR13 : origin = 0x0027C000, length = 0x00004000
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Thanks,

    Yashwant

  • Yashwant,

    Do I need an updated driverlib_cm for this?

    Can't seem to find the "Ethernet_disableDmaInterrupt" and "Ethernet_enableMTLInterrupt" functions.

    Also, where do you want me to look for those "self explanatory" comments?

    Regards,

    Beat

  • Beat,

    You can define the following functions in the enet_lwip.c file. These are planned for next release.

    void Ethernet_disableDmaInterrupt(
    uint32_t base,
    uint32_t channelNum,
    uint32_t flags)
    {
    HWREG(base + (channelNum * ETHERNET_CHANNEL_OFFSET) +
    ETHERNET_O_DMA_CH0_INTERRUPT_ENABLE) &= ~flags;
    }
    void Ethernet_enableMTLInterrupt(
    uint32_t base,
    uint32_t queueNum,
    uint32_t flags)
    {
    HWREG(base + (queueNum * ETHERNET_QUEUE_OFFSET) +
    ETHERNET_O_MTL_Q0_INTERRUPT_CONTROL_STATUS) |= flags;
    }

    Thanks,

    Yashwant

  • Yashwant,

    Where do you want me to look for those "self explanatory" comments?

    Thanks,

    Beat

  • Beat,

    For the protocols enabled you can refer to Readme.txt at location C2000Ware_3_03_00_00\libraries\communications\Ethernet\third_party\lwip\examples\enet_lwip\cm.

    To try out other feature look into the defines in lwipopts.h file.

    Thanks,

    Yashwant

  • Yashwant,

    I am also trying to get lwip example to run standalone (from flash) on the TMS320F28388D evaluation board with C2000Ware_3_03_00_00.

    I followed your latest notes:

    1. replaced the files (5556.f2838xif.c, 3731.enet_lwip.c, 2352.startup_ccs.c, 2838x_flash_lnk_cm_lwip_cmd.txt).

    2. added the functions (Ethernet_disableDmaInterrupt, Ethernet_enableMTLInterrupt).

    With those modifications i got the program to run from flash (also after power cycle and without CCS) but i still have some problem .

    When running from CCS (through JTAG), the program runs completely fine but when running from flash after power cycle the connection is not stable.

    Especially, if i press the button "getDataFromServer" on the web server, the answer is delayed (2-5 seconds) and it causes the pings to fail for that time. When i am running from CCS the answer from the server is immediate (the number that the server sends updates immediately) and pings never miss.

    If i just ping the board, when running from CCS it never miss a ping but when running from flash once in while a ping is missed (once in ~20seconds)

    Any idea why?

    Thanks,

    Timor

  • Timor,

    When you are running from CCS are you using RAM configuration or FLASH configuration?

    When resetting the device for power cycle try doing it after disconnecting the ethernet cable then reset it and connect it back. 

    To narrow down the issue. 

    Regards,

    Yashwant 

  • I am using FLASH configuration.

    I tried resetting with the cable disconnected. No difference.

    p.s. my laptop is connected directly to the board. no ethernet switch in between.

    Anything else to check?

  • I presume you have taken following updates from the latest source files:

    1) Linker cmd file changes .const subsection load from FLASH and run from RAM.

    2) startup_ccs generic ethernet interrupt function added to vector table.

    3) enet_lwip.c Added cm_init which copies the the FLASH section to RAM to run. Definition of Generic Ethernet interrupt function.

    Regards,

    Yashwant

  • Yes I am using all these updates. Without these updates the program does not run in standalone at all.

  • A small update:

    I don't think its the cause of the problems but i think that lwIPTimer is not triggered correctly in the example that you sent.

    in SysTickIntHandler it is called with lwIPTimer(systickPeriodValue) while systickPeriodValue=15000000.

    lwIPTimer should be called with value of msec passed from the last call.

    i made the following changes:

    1. systickPeriodValue=1250000

    2. In SysTickIntHandler: lwIPTimer(100);

    This updates the lwip timer every 100msec

    It didn't seem to help but maybe its a lead...

    In addition, i also changed ETHERNET_NO_OF_RX_PACKETS from 2U to 5U. This helped a bit bit didn't solve the problem.

    It looks like something is running very slow when running standalone vs running with debugger connected (from CCS). This causes requests to be handled very slow so response is delayed and pings are missed. I can say that its not the main clock because i added LED blinking (both for CPU1 and CM) and the blink rate does not change between standalone and CCS.

  • We are looking into the problem and will update you once we have leads.

    Regards,

    Yashwant

  • Hi. Any progress?

  • Hi Timor,

    I tried recreating the issue but was unsuccessful at it. At my side the ping and getDataFromWebServer are working perfectly in the standalone(FLASH) mode. 

    In the image attached you can see the button clicked 345 times along with ICMP request.

    Are there any other Interrupt Service Routines in your application?

    You can also try adding VLAN to your application to restrict the packets tranferred to device. You can search the e2e for doubts on VLAN.

    Regards,

    Yashwant