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.

CAN to Ethernet

Other Parts Discussed in Thread: TIDA-00203

The Compact CAN-to-Ethernet Converter using 32-bit ARM Cortex-M4F MCU Reference Design (TIDA-00203) comes with two CAN interfaces (CAN1 and CAN0). The CAN1 interface includes a CAN transceiver and is used in the demo and CAN0 needs to have a CAN transceiver added to the design and have the sample code updated to support incoming packets for conversion on that CAN interface. We will  change the application to send out UDP packets and our Ethernet payload will need to include which CAN interface that the CAN packet came in on (CAN0 or CAN1). We need to know if it is possible if there is a way to modify the sample code to distinguish which of the 2 CAN interfaces the packet comes in on before sending it out on the Ethernet interface. Would this be done in the CAN1IntHandler? How would one do this? Any ideas on the best way to do this would be appreciated.

  • Hello Todd

    Separating the 2 CAN bus data on the ethernet packet can be done in multiple ways

    1. Use different Port numbers for UDP
    2. Use a packet header which has a byte for the CAN instance followed by the CAN bus data
  • Hi Amit,

    Thank you. The question was more about when I send that UDP packet how do I know which CAN interface the CAN packet came in on. I read some of your other posts. You stated:
    “The Message ID Number received on the bus will be AND-ed with g_sCAN0TxMessage.ui32MsgIDMask and if it matches g_sCAN0TxMessage.ui32MsgID then the message will be moved to the corresponding mailbox.”

    So, if we receive a CAN message on “CAN0” interface with CAN ID 0x5 it will get put in a mailbox. If we receive a CAN message on “CAN1” interface with CAN ID 0x5 it will be put in the same mailbox, right? When the message is retrieved from the mailbox to send out on UDP how will we know when retrieving which CAN interface the CAN packet came in on?

    BTW, How do you read a CAN message from a mailbox after the incoming packet comes in?

    Kind Regards,
    Todd
  • Hello Todd

    For more information on getting the data from CAN interface, you can refer to the TivaWare example code for CAN. The files are kept at the following location when you install TivaWare

    C:\ti\TivaWare_C_Series-2.1.3.156\examples\peripherals\can

    Each CAN module has its separate mailbox. So CAN ID 0x5 on CAN0 and CAN ID 0x5 on CAN1 will be read separate by the CPU.

    When sending the data over UDP the packet can by 1 byte for CAN module instance + 1 byte for CAN ID + CAN data bytes.
  • Hi Amit,

    Thank you. That sounds like it might work. We have a reference board on order and will try it out.

    Kind Regards,

    Todd

  • Hello Todd,

    Which reference board? Is it the TIDA-00203?
  • Yes Amit. Why do you ask? We are having our locale CM manufacture 10 so we can try it out.
  • Hello Todd

    No particular reason.
  • Hello, 

    We are trying to run the CAN to Ethernet demo defined in Compact CAN-to-Ethernet Converter using 32-bit ARM Cortex-M4F MCU Reference Design TIDA-00203. The demo connects to the DK-TM4C123G board via CAN Hi/Lo. You can telnet into the CAN to Ethernet Board and Teraterm/Serial into the DK-TM4C123G. You can type characters in one session and they transmit across CAN and display in the other session. The demo is not working

    We connected two DK-TM4C123G boards together via CAN HI/LO and we can transmit characters between the two boards using the CAN demo that comes with the DK-TM4C123G board. But when we connect the TI CAN to Ethernet Board to the DK-TM4C123G and program the CAN to Ethernet Board with ser2enet.bin the demo does not work. We tried 2 boards from our contact manufacturer. The board is Rev E1.

    We can telnet into HTTP into the CAN to Ethernet board so the firmware appears to have programmed correctly.

    We used the ser2enet.bin file that comes with the CAN to Ethernet Software. When we connect via HTTP it says the firmware is 10636.

    Is the ser2enet.bin file that comes with the CAN to Ethernet Software the one we should be programming? Why do we not see any characters come out of the Ethernet NIC on the CAN to Ethernet board (none on the Telnet window on Wireshark) when we type characters into the DK-TM4C123G? We know the DK-TM4C123G is transmitting them into CAN HI/LO on the CAN to Ethernet board? I am looking for tips to help debug. We need to deliver these to our customer soon.

    Kind Regards,

    Todd

  • Hello Todd

    Todd Harrington said:

    We are trying to run the CAN to Ethernet demo defined in Compact CAN-to-Ethernet Converter using 32-bit ARM Cortex-M4F MCU Reference Design TIDA-00203. The demo connects to the DK-TM4C123G board via CAN Hi/Lo. You can telnet into the CAN to Ethernet Board and Teraterm/Serial into the DK-TM4C123G. You can type characters in one session and they transmit across CAN and display in the other session. The demo is not working

    We connected two DK-TM4C123G boards together via CAN HI/LO and we can transmit characters between the two boards using the CAN demo that comes with the DK-TM4C123G board. But when we connect the TI CAN to Ethernet Board to the DK-TM4C123G and program the CAN to Ethernet Board with ser2enet.bin the demo does not work. We tried 2 boards from our contact manufacturer. The board is Rev E1.

    Help me understand the setup here. The first para states it works and the second para states it does not work.

  • Hi Amit,

    The demo between DK-TM4C123G and DK-TM4C123G works so I know my DK-TM4C123G setup is good.

    The demo between the DK-TM4C123G and the CAN to Ethernet Board does not. I need to test the CAN to Ethernet boards from the contract manufacturer using this demo.

    Can you help me understand why the CAN messages coming into the CAN to Ethernet Board from the DK-TM4C123G are not being transmitted out the Ethernet Port of the CAN to Ethernet Board? I don't see anything on my telnet session or my Wireshark dump. Yet I can web and telnet into the CAN to Ethernet board.

    Thanks,

    Todd

  • Hello Todd

    Has the 120 Ohms resistor been installed on the CAN bus?

    Assuming that the correct software has been flashed on the right software, When you send data from the DK-TM4C123G then what does the CAN bus show on the TIDA-0023?
  • Hello Amit,

    Some background. We are the system integrator. Our customer will ultimately be doing the development with this board. We need to deliver a working board though with this demo.

    Yes, we have the 120 Ohm resistor installed on the DK-TM4C123G side only (the 120 Ohm resistor is installed on the CAN to Ethernet board design).

    When you ask me what the CAN bus is doing we have done any debugging yet. It is the weekend here now. Please explain what I should provide for debug info.

    The DK-TM4C123G to DK-TM4C123G demo is working so that would tell me the DK-TM4C123G is transmitting on the CAN ok, right? The LCD on it says “CAN Example” and characters flow over CAN between boards.

    The CAN to Ethernet Board was programmed with the ser2enet.bin file included in the Software Section of the CAN to Ethernet software here using LM Flash Programmer and a USB cable from my PC:
    www.ti.com/.../tida-00203

    I can connect to TIDA-00203 with browser.

    Given that, Would you say that everything is programmed ok?

    As far as debugging I was hoping the demo would work and we would ship. I am prepared to do some minimal debugging if you tell me what do to.

    Do I need to connect with CCS and set breakpoints in the code?

    If so, I ordered a BH-USB-100v2-ARM to debug the TIDA-00203 if needed but it came with a 10-pin connector with .05 spacing between pins and the J7 JTAG connector on the TIDA-00203 has 2mm spacing.

    If I need to debug TIDA-00203 with CCS please let me know what I need for hardware to debug the TIDA-00203 and what I should do. I feel this should work though. Have you ran this demo?

    Regards,
  • Hello Todd

    Based on the description so far, yes I would say that the boards are working fine. 2mm header spacing JTAG headers does not make any sense to me either. Let me check with the original designer on the choice of the such a header and details on the software.
  • Hello Amit,

    Did you receive an update on how I can program the 2x5 2mm header on the TIDA-00203 or do we need to solder up our own cable to the .05 spaced 2x5 cable on the Blackhawk USB 100.

    We are using a twisted pair cable with 120 Ohm between CANH and CANL "only" on the DK-TM4C123G.

    We put a scope on the CAN Bus. Here is what we see

    1) When connecting DK-TM4C123G to DK-TM4C123G (with twisted pair cable and 120 Ohm termination on both sides) the CAN bus is IDLE. We type a character on one side and we see some data pass on scope (probably 20 or so bits) then the bus goes IDLE and the character shows up on the other side as expected.

    2) We then disconnect one DK-TM4C123G and connect up the TIDA-00203 with no termination on that TIDA-00203 side and the CAN bus is still IDLE. As soon as we type ONE character the character passes on the scope then we see continuous data! It appears that the DK-TM4C123G is waiting for a reply from the TIDA-00203 and it not getting it? Is that true? If we hit reset on the DK-TM4C123G the CAN bus goes IDLE again.

    3) If we telnet into the TIDA-00203 at 169.254.254.255 and try typing characters in telnet session we do not see any activity on the CAN bus. The CAN bus stays IDLE.

    4) We tried connecting two TIDA-00203 boards head to head via teisted pair CAN cable and no termination resistors and when we telnet into one TIDA-00203 and type we do not see activity on the CAN bus. The TIDA-00203 is not converting the CAN data to Ethernet.

    Does this give you a clue to what the problem might be? It appears the software for DK-TM4C123G (CAN project in TIVA DK-TM4C123G installation directory) works fine when installed on both DK-TM4C123G boards but maybe is incompatible with the C2E software on the TIDA-00203 site? One note. we do not use Auto IP. We have no DHCP server. We are telneting into 169.254.254.255 (the same IP address that gets us into the web server). Not sure if that matters.

    We would appreciate your help with the indended cable and helping us get this documented demo running.

    Kind Regards,
    Todd
  • Hello Todd

    Not yet on the JTAG debug probe.

    As for the issue described in point-2 of the continuous data transfer, which TivaWare are you using for the software?

    I am still awaiting answer on the Ethernet to CAN conversion.
  • Hello Amit,


    On the CAN to Ethernet Board I am not sure the TIVA ware matters because we are downloading the CAN to Ethernet File (TIDA-00203 CAN-to-Ethernet Source Code 09 Feb 2015) under http://www.ti.com/tool/tida-00203 and we are just using the ser2enet.bin file. We are not trying to build the new .bin file yet which might rely on the TIVA ware.

    On the dk-tm4c123g board that is setup wit the CAN to Ethernet Board we are using TIVA 2.1.3.156. We are programming the can.bin file from that C:\ti\TivaWare_C_Series-2.1.3.156\examples\boards\dk-tm4c123g\can\ccs\Debug directory.

    Regards,

    Todd

  • Hello Todd

    There is an issue in the can driver for TivaWare 2.1.3.156. We had made a fix from 2.1.2.111 and it did not work as expected. The change needs to be done in the can.c, driverlib and application recompiled. Alternatively if you have 2.1.2.111 release of TivaWare then that would also do the trick. However if you do not have 2.1.2.111 then the change that needs to be made is as given in the following post

    e2e.ti.com/.../1997682
  • Hello Amit,

    We have the C2E demo working. I am not 100% sure what the fix was but I think I had three problems that were preventing the CAN to Ethernet demo from working:

    1) The only .bin file we had with the default CAN2Enet Zip from TIDA-00203 was ser2enet.bin so we kept programming that .bin file into TIVA-00203 but the ban of 3 LEDS next to each other were not lighting up.. Once we rebuilt the project and generated a new .bin file by adding a Post Build rule to generate a  new.bin file we got a "can2enet.bin" file. That bin file worked much better and LEDs on the TIVA-00203 started lighting up!

    2) Characters still did not flow from DK-TM4C123G  to TIDA-00203. We programmed an older version of the can.bin into the DK-TM4C123G that was generated from an older version of Tivaware and the characters started flowing from the DK-TM4C123G to the TIVA-00203! When we programmed the can.bin generated from TivaWare_C_Series-2.1.3.156 (with our without the can.c patch) the demo did not work so we are stayin with this older version of can.bin for the DK-TM4C123G board.

    3) On the can2enet.bin for TIDA-00203 and the older version of can.bin for the DK-TM4C123G we got traffic to flow but lots of "CAN Message Lost" errors like you showed me in your October support post. We needed your can.c patch file for TIVAware to generate a new can2enet.bin. and these errors went away and the demo worked.

    That is what I believe fixed the demo for us.

    Thank you for your support.

    Kind Regards,

    Todd

  • Hello Todd

    Glad the demo worked. You may want to submit feedback for the TI Design's issues as well.