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.

Hercules TMS570LC43X Ethernet Issue

Other Parts Discussed in Thread: HALCOGEN

Hi,

I'm trying to program ethernet capabilities to my existing TI code. Right now my code just uses the NHET driver, however I would like to be able to toggle the program on and off via ethernet, and be able to adjust values within my code via ethernet as well. I'm new to using the TI device, and don't have a clue what drivers to enable in halcogen or what code to use in CCS. I tried following the LWIP demo, but failed miserably, I cannot seem to get that demo going either. So if someone can walk me through the steps required to get ethernet communication going that would be really appreciated.

Thanks in advance

  • I think LwIP demo is pretty straightforward. You just need to pay attention about the following:
    1) DIP switch (Ethernet must be set ON and USB set to OFF

    2) Must use a router with DHCP, ethernet direct connection with static IP is not working.

    Good luck.

  • I have the launchpad not the HDK, there is no dip switch
  • There are extra instuctions for the Launchpad .. you need to adjust the example (HDK based) to the launchpad pinout
    See: processors.wiki.ti.com/.../LAUNCHXL2_RM57L:_lwIP_Demo
  • Hi Anthony,

    I've tried this example a few times. I followed it completely, and I always seem to get build errors for some reason. And from what you suggested before I tried the RTOS+TCP example instead since you suggested it was better. That one compiles but I cannot get it to communicate or launch my task which is the NHET program
  • Ok I tried it too yesterday and was getting build errors. But weird ones.

    Mainly I had a newer version of CCS installed than what was used to export the project.

    CCS now refuses to import the project without the older compiler installed.

    Then for me the online install of the old compiler always fails ... when it does get an old compiler onto the file system
    from the failed install, this 'builds' but there's a lot of problems in the linking stage:
    - auto library build seems to hang
    - linking once the library is built seems to hang for me on big endian.

    Are these the type of build errors you see too? If so we need to move this to the CCS forum for help
    (I need to get help w. CCS on this anyway for some work I'm trying to do...
    If you're getting some *different* kind of build problem though please describe)

    -anthony
  • I'm using CCS 6.2 not sure if you are running the same version.

    The error I'm getting is
    "PINMUX_BALL_R4_" is undefined HL_pinmux.c "

    I followed the instructions to the tee again. But this step from the wiki page does not seem to be available for my board.

    "Change the selection on balls T4, U7 to the default functions (from MII_RX_AVCLK4 to MII_RXCLK, and from MII_TX_AVCLK4 to MII_TX_CLK). The phy will provide these clocks to the MAC on the launchpad."

    T4 and U7 are never selected at all so i just select MII_TX_CLK and MII_RX_CLK.

    also I'm using the TMS570LC43x board not the RM57L
  • Oh ok those are HalCoGen issues :(

    You need to add something to that line.

    "PINMUX_BALL_R4_GIOB_3" is what I've added and it will at least build that way.

    Also saw the other day a pinmux conflict reported when I followed the line
    "Change the selection on balls T4, U7 to the default functions (from MII_RX_AVCLK4 to MII_RXCLK, and from MII_TX_AVCLK4 to MII_TX_CLK). The phy will provide these clocks to the MAC on the launchpad."

    But that might have been a 'dirty' DIL file issue because there was actually only one box checked.
    However this conflict doesn't prevent code generation from HalCoGen and when I visually checked the pinmux output file it picked the correct signal ..

    -Anthony
  • Where do I add that line to?
  • I think if you click on the error message in CCS ('Problems Window' where the red "X" is..) that it'll open the file and take you right to the line.

    Otherwise open HL_pinmux.c and search for "PINMUX_BALL_R4_" then add "GIOB_3" to the end of that and rebuild..
  • That got rid of that error, now once the <linking> happens I get about 100 errors:


    symbol "EMACInit" redefined: first defined in "../Build-TMS570LC43x/Debug/HALCoGen-TMS570LC43x/source/HL_emac.obj"; redefined in "./HALCoGen-TMS570LC43x/source/HL_emac.obj" symbol "EMACInit" redefined: first defined in "../Build-TMS570LC43x/Debug/HALCoGen-TMS570LC43x/source/HL_emac.obj"; redefined in "./HALCoGen-TMS570LC43x/source/HL_emac.obj" Build-LAUNCHXL2-570LC43 C/C++ Problem
    symbol "EMACInstConfig" redefined: first defined in "../Build-TMS570LC43x/Debug/HALCoGen-TMS570LC43x/source/HL_emac.obj"; redefined in "./HALCoGen-TMS570LC43x/source/HL_emac.obj" symbol "EMACInstConfig" redefined: first defined in "../Build-TMS570LC43x/Debug/HALCoGen-TMS570LC43x/source/HL_emac.obj"; redefined in "./HALCoGen-TMS570LC43x/source/HL_emac.obj" Build-LAUNCHXL2-570LC43 C/C++ Problem

    All like that
  • Well that problem is different.

    It's because of the way the lwIP build is setup.

    Check one of the projects that you directly import and go through all the folders and subdirectories to see that some files and folders are excluded from the build.

    If you create a new project you have to go and manually set it up the same way - excluding the same files & folders from the build.

    I know it's a pain and should be cleaned up but right now this is just the way the demo is setup.
  • I see, I've got the program loaded now, however I cant seem to get to the page or see the files that allow me to toggle the user led or change the speed. Where do I get the folder labeled FS? I cant find it on the wiki pages.
  • Which example/wiki are you looking at? It sounds like the interactive demo rather than the static HTTP server demo. Is that right?
  • Yes that is correct, I'm talking about the interactive demo. I would like modify the send text portion of it and make it applicable to my project.

    processors.wiki.ti.com/.../LAUNCHXL2_570LC43:_lwIP_Active_Webserver_Demo

    Thats the wiki link.

    Thanks
  • 2313.LWIP+HET.zipI tried to integrate my Het program into the LWIP demo but I'm not getting any output from the pins. Even in trigger mode I get nothing.  I dont know if maybe something in the LWIP demo is interfering with the het program, I tried stepping through the code and I do go over the het program and write into the memory the pulse values but it's not putting anything out in the pins.

  • Hi Jawwad,

    I don't really know how to help you from here; this is just a demo and we're not really setup to support lwIP.

    I guess one question would be, can you trigger the actions that are built into that interactive demo just running it as-is.
    I don't know if it runs a self test or toggles some LED or something but you could try to break on the action being triggered
    before making any modifications - so that it's easier to understand what mechanism is used.

    Second, does your N2HET program produce any output if there is no trigger? If not I'd suggest adding something like a square wave output on a spare pin that you can use to monitor that your N2HET program is indeed loaded into the N2HET and that it's running.

    Best Regards,
    -Anthony
  • Hi Anthony,

    So in the sys_main.c file in the LWIP demo, theres only two calls in void main().  The first is gioInit(), and then it goes to EMAC_LwIP_Main(emacAddress). Now I opened the declaration for EMAC_LWIP_Main and followed what was going on. But it seems like all that does is executes the static web page that is displayed. This demo does not toggle any LEDs or anything like that as far as I know, and I have stepped through the code to see but I didnt find any calls to turn any LED's on or off. I also tried putting my N2HET code before the EMAC_LWIP_Main call to atleast have the program do my code first then load the webserver, and when I step through the code I can see my program being read and loaded to memory but nothing gets output through pin 2 for the het1 driver, but the webserver still loads fine.

    Thanks

  • Hi Anthony,

    So I found the active webserver demo files here:
    e2e.ti.com/.../1599974

    But when I compile I get build errors like the following:

    #1965 cannot open source file "config.h" lwip_check.h /Build-LAUNCHXL2-570LC43/third_party/lwip-1.4.1/test/unit line 6 C/C++ Problem
    gmake: *** [third_party/lwip-1.4.1/test/unit/core/test_mem.obj] Error 1 Build-LAUNCHXL2-570LC43 C/C++ Problem
    gmake: *** [third_party/lwip-1.4.1/test/unit/etharp/test_etharp.obj] Error 1 Build-LAUNCHXL2-570LC43 C/C++ Problem
    gmake: *** [third_party/lwip-1.4.1/test/unit/lwip_unittests.obj] Error 1 Build-LAUNCHXL2-570LC43 C/C++ Problem
    gmake: *** [third_party/lwip-1.4.1/test/unit/tcp/tcp_helper.obj] Error 1 Build-LAUNCHXL2-570LC43 C/C++ Problem
    gmake: *** [third_party/lwip-1.4.1/test/unit/tcp/test_tcp_oos.obj] Error 1 Build-LAUNCHXL2-570LC43 C/C++ Problem
    gmake: *** [third_party/lwip-1.4.1/test/unit/tcp/test_tcp.obj] Error 1 Build-LAUNCHXL2-570LC43 C/C++ Problem
    gmake: *** [third_party/lwip-1.4.1/test/unit/udp/test_udp.obj] Error 1 Build-LAUNCHXL2-570LC43 C/C++ Problem
    gmake: Target 'all' not remade because of errors. Build-LAUNCHXL2-570LC43 C/C++ Problem
  • Did you have to make a lot of effort in order to get this far?

    I am seeing that after importing the project into a clean workspace, many of the folders in the project are imported references that have their links broken, so these need to be fixed to match the installation folder of the demo.
    And also having to fix up many of the compiler include paths that are broken.

    After doing these things I'm down to 11 errors starting w. the 'cannot open source' for config.h.

    Just want to make sure we're on the same page. You didn't just import and build and only get those small # of errors you pasted above, correct??
  • So I got a little farther simply by excluding:

    thirdparty/lwip-1.4.1/test
    thirdparty/lwip-1.4.1/apps/makefsdata

    from the build. this cleans up all the compile errors.

    I think that the test folder has standalone test cases for lwIP, and the makefsdata folder is a pc application
    to convert the files in that folder like jpg and html into a 'c' file that you can embed into the application.
    so these are not meant to be compiled into the code that runs on the hercules, they are just in the 'tree' that
    gets imported...

    So doing those two things - the compile finishes but link fails with duplicate symbols.

    That is a classic problem w. the lwIP example, because the file
    'utils/lwiplib.c'

    has a bunch of include statements that include source code:


    /*
    ** lwIP high-level API/Stack/IPV4/SNMP/Network Interface/PPP codes
    */
    #include "api/api_lib.c"
    #include "api/api_msg.c"
    #include "api/err.c"
    #include "api/netbuf.c"
    #include "api/netdb.c"
    #include "api/netifapi.c"
    #include "api/tcpip.c"
    #include "api/sockets.c"

    #include "core/dhcp.c"
    #include "core/dns.c"
    #include "core/init.c"
    #include "core/mem.c"
    #include "core/memp.c"
    #include "core/netif.c"
    #include "core/pbuf.c"
    #include "core/raw.c"
    #include "core/stats.c"
    #include "core/sys.c"
    #include "core/tcp.c"
    #include "core/tcp_in.c"
    #include "core/tcp_out.c"
    #include "core/timers.c"
    #include "core/def.c"
    #include "core/udp.c"

    #include "core/ipv4/autoip.c"
    #include "core/ipv4/icmp.c"
    #include "core/ipv4/igmp.c"
    #include "core/ipv4/inet.c"
    #include "core/ipv4/inet_chksum.c"
    #include "core/ipv4/ip.c"
    #include "core/ipv4/ip_addr.c"
    #include "core/ipv4/ip_frag.c"

    #include "core/snmp/asn1_dec.c"
    #include "core/snmp/asn1_enc.c"
    #include "core/snmp/mib2.c"
    #include "core/snmp/mib_structs.c"
    #include "core/snmp/msg_in.c"
    #include "core/snmp/msg_out.c"

    #include "netif/etharp.c"
    #include "netif/loopif.c"

    #include "netif/ppp/auth.c"
    #include "netif/ppp/chap.c"
    #include "netif/ppp/chpms.c"
    #include "netif/ppp/fsm.c"
    #include "netif/ppp/ipcp.c"
    #include "netif/ppp/lcp.c"
    #include "netif/ppp/magic.c"
    #include "netif/ppp/md5.c"
    #include "netif/ppp/pap.c"
    #include "netif/ppp/ppp.c"
    #include "netif/ppp/ppp_oe.c"
    #include "netif/ppp/randm.c"
    #include "netif/ppp/vj.c"

    /*
    ** HDK-specific lwIP interface/porting layer code.
    */
    #include "ports/hdk/perf.c"
    #include "ports/hdk/sys_arch.c"
    #include "ports/hdk/netif/hdkif.c"

    So, the above .c files get compiled into two different object files, first 'lwiplib.obj' and second <filename.obj> and when you try to link then you get redefined symbols.

    If you look at the non-interactive demo then you'll see that all of the sources are excluded from the build in the CCS project. So for example 'hdkif.c' is not compiled standalone into 'hdkif.obj'.
    It *is* included in the build but through the #include directive of lwiplib.c and the function is output into lwiplib.obj.

    So I think from here the solution is excluding all of the above stuff which is a lot of directories to go into and click on.

    Sorry it didn't import correctly -- and sorry there's not a clean way to script the exclude (that I know of) .

    -Anthony
  • Ok so I got it to build. Need to dig up a board to test it on. I have some doubts about the file system.

    To get the build to complete:

    a) fix the broken folder references (example, fs, Halcogen, utils) after the project imports.
    I deleted them from the project, then did a fresh file-import-file system to pull the
    directories back into the project using the 'browse' tool to find them in the installation folder

    b) fix the compiler include options. go through them all and make sure they are pointing to the folders of (a). the 'browse' here also helped. It looks like many have an extra /../../ between the ${PROJECT_LOC} and the folder that needs to go away.

    c) find the file 'lwiplib.c' in the utils folder and open it.
    then for all of the *.c files that are included in that file, use the CCS project explorer to exclude them from the build.

    d) finally, in third_party\lwip-1.4.1\apps\httpserver_raw exclude 'fs.c', 'fsdata.c' from the build.
    this is the part I'm a little shaky on but I think that the top level file 'io_fs.c' pulls in the fsdata.c and also adds the hooks for the server side IO.

    With all that I get a build that has 25 warnings but at least there is a .out to try.
  • Hi Anthony,

    So I have already done part A, and part B.

    Part C I'm not sure what .c files I'm supposed to exclude. I have files that are titles core/stats.c and so on.

    Part D in my thrid_party folder when I go to httpserver_raw, there are no fs.c or fsdata.c files. However in the LWIP-1.4.1 folder under httpserver_raw those files are present so I excluded those ones.

    But now I get errors saying :

    #1965 cannot open source file "httpserver_raw/httpd.h" io_fs.c /Build-LAUNCHXL2-570LC43 line 28 C/C++ Problem
    #1965 cannot open source file "httpserver_raw/httpd.h" lwip_main.c /Build-LAUNCHXL2-570LC43/example/hdk/src line 33 C/C++ Problem
    #1965 cannot open source file "lwiplib.h" lwiplib.c /Build-LAUNCHXL2-570LC43/lwip-1.4.1/ports/hdk line 46 C/C++ Problem
    gmake: *** [example/hdk/src/lwip_main.obj] Error 1 Build-LAUNCHXL2-570LC43 C/C++ Problem
    gmake: *** [io_fs.obj] Error 1 Build-LAUNCHXL2-570LC43 C/C++ Problem
    gmake: *** [lwip-1.4.1/ports/hdk/lwiplib.obj] Error 1 Build-LAUNCHXL2-570LC43 C/C++ Problem
    gmake: Target 'all' not remade because of errors. Build-LAUNCHXL2-570LC43 C/C++ Problem


    Thanks
  • Jawwad,

    These errors:

    #1965 cannot open source file "httpserver_raw/httpd.h" io_fs.c /Build-LAUNCHXL2-570LC43 line 28 C/C++ Problem
    #1965 cannot open source file "httpserver_raw/httpd.h" lwip_main.c /Build-LAUNCHXL2-570LC43/example/hdk/src line 33 C/C++ Problem
    #1965 cannot open source file "lwiplib.h" lwiplib.c /Build-LAUNCHXL2-570LC43/lwip-1.4.1/ports/hdk line 46 C/C++ Problem


    Usually mean that there is an error or folder missing from the Include paths in the project compiler build properties.

    Make sure that there is a path in the -I options list that will allow the compiler to find each of the files listed.

    And note that the 'httpserver_raw/httpd.h'  #include directive has part of the path in it,   So the compiler include path needs to point to the folder

    where the 'httpserver_raw' folder lives, not where the httpd.h file lives'.

  • Just to update, we tested the build and confirmed it's working.

    See image below:

      

  • Hi Anthony,

    How did you get that to work? I fixed up the source file errors, but now I get a #148 declaration is incompatible with "err_t fs_open(struct fs_file *, const char *)" (declared at line 111 of "C:/ti/Hercules/ActiveWebServerDemo/1.0.0/TMS570LC43x/Build-LAUNCHXL2-570LC43x/lwip-1.4.1/apps/httpserver_raw/fs.h") io_fs.c /Build-LAUNCHXL2-570LC43 line 58 C/C++ Problem

    I'm not sure what this means.

    Thanks
  • Jawwad,

    Well, in fs.h the function prototype for fs_open (it's declaration) is:

    struct fs_file *fs_open(const char *name);

    and in io_fs.c the function itself is defined as:

    struct fs_file *fs_open(const char *pcName)

    {

    ....

    }

    So they match for me.  Did you edit either of these so that they do not match each other?

    -Anthony

  • Hi Anthony,

    I have not changed anything around, but my files do not seem to match.

    In fs.h I have the following line:
    err_t fs_open(struct fs_file *file, const char *name);

    thats the only reference to fs_open.

    in io_fs.c I have the following line:
    struct fs_file *fs_open(const char *pcName){...}

    fs.h is located in the LWIP-1.4.1 folder under apps>httpserver_raw>fs.h are you looking at the same fs.h file as well?

    I dont have any other fs.h files.

    Thanks
    Jawwad
  • Jawwad,

    I think you are mixing the non-interactive demo with the interactive demo application files.

    If I look on my machine at:
    C:\ti\Hercules\HALCoGen EMAC Driver with lwIP Demonstration\v00.03.00\lwip-1.4.1\apps\httpserver_raw\fs.h

    Then I see:
    err_t fs_open(struct fs_file *file, const char *name);

    But if I look at:
    C:\ti\Hercules\ActiveWebServerDemo\1.0.0\third_party\lwip-1.4.1\apps\httpserver_raw\fs.h

    The same line is:
    struct fs_file *fs_open(const char *name);

    In both cases, the corresponding "C" file has a definition that matches it's prototype.
    But if you use the header from one project w. the C file from the other you will have this problem.

    You may need to look at your include options and make sure that the include which pulls in 'third_party/lwip-14.4./apps' is pointing to the active server demo app.

    -Anthony
  • Hi Anthony,

    So I finally got it to build and load after I deleted the project and re imported, this time I just relinked one folder and it built no problems, dont really know what I changed. But now when I connect the MCU with the ethernet cable, the jack doesnt even light up, no yellow light blinking or green light either.

    Thanks
  • Hmm... Sounds like you still have some issue with the code; especially if you have been able to get the static demo to work w. the same hardware.
  • Yes, I dont really know why it is not working, the entire code is building and with 25 warnings (which you said you also got). However once its loaded onto the MCU the ethernet jack doesnt do anything. Almost like the code isn't even set up for ethernet.
  • Jawwad,

    What information prints out on the UART ? The steps in connecting to the phy, establishing the link, and getting an IP address all get dumped to the UART so knowing where it fails will help figure out what code to look at.
  • Hi Anthony,

    How do I see what prints on the UART?

    Thanks
  • You need to open a terminal program on the COM port that is attached to the XDS110 of your launchpad.

    Select COM port identified as "XDS Class Application/User UART" from your computer's device manager.
    Configure Baud Rate: 9600, Data Bits: 8, Stop Bits: 2 and Parity: None.
  • Hi Anthony,

    I opened up a terminal program on the correct com port with the settings you listed above. But I get nothing printed out on the putty terminal window. I tried to open the terminal program and then load the program onto the mcu and I tried to connect after the program was loaded. both times I got nothing printed out on the terminal. Can you please setup a webex meeting with me so you can remotely see what I'm doing on my computer?

    Thanks
  • Hi Jawwad,

    We don't normally do webex sessions.

    Make sure you are connecting to the correct COM port.  You can look at the properties of the XDS110 to see which is tied to the "Application/User" port.   You need to use that COM port, not the Auxiliary Data port. 

    See below - use the port marked in red.   For my case this is COM3.

    I'll paste an example of the screen cap from the UART in a minute so you can see what information it prints.

  • Ok so here is a screenshot of the working (RM57 so little endian) setup I have,  but with the ethernet cable completely disconnected.

    You can see that the first couple steps ... communicating with the phy .. succeed.  But then the phy cannot

    establish a link to the remote device (PC or switch) and so we fail on trying to establish that link.

    Would be good to know if your setup also gets this far or if it fails prior to this.  

  • Hi Anthony,

    I am using the correct COM port. For me it is COM13

    And this is what I do in Putty:

    And I get nothing in the output.

    I know you usually dont do webex and screen sharing, however I'm certain I'm following all the steps that were highlighted by you, and also getting fairly the same result (in terms of build) but I'm not getting anything out which is odd.

    Thanks

  • Hi Jawwad,

    So it may be as simple as your program not even running; please halt the CPU and let me know if the PC is sitting on an abort vector or some error handler. Maybe you didn't program the ECC correctly or something simple like that... Otherwise I would expect at least the first line or two to print out on the UART.

    -Anthony
  •  Hi Anthony,

    This is where the program stops when I hit pause.

    Thanks

  • So probably you are in the prefetch abort right after reset and nothing is actually run. That would correspond to the symptom.

    The ESM registers will tell you a little more about the error source here but it's very likely ECC.

    Did you try the instructions for using linker generated ECC with the launchpad as described here:
    processors.wiki.ti.com/.../LAUNCHXL2-570LC43-RM57L:_LinkerECCRecommendation

    This seems to be the most robust way to get ECC into the device especially the cached R5 variant you are working with; because that device is the least forgiving when it comes to ECC errors - the ECC check is always on even immediately after reset.

    -Anthony
  • Hi Anthony,

    So I updated the linker file, and now the demo works! I had all the settings done correctly in the debug flash settings menu, however the actual sys_link file was not the right one. 

    Thank you for your help!

  • Awesome! Glad you are off to the races and sorry it was such a difficult time getting started.

    Best Regards,
    Anthony