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.

TMS570LC4357: ethernet tftp bootloader and SPI

Part Number: TMS570LC4357


Hi all,

I'm developing a bootloader on TMS570LC4357 using Ethernet protocol and TFTP.

The system is more complex than that; it has two microcontrollers (both tms570lc4357) communicating through SPI. when receiving the ethernet bootloader command both the uP goes into boot mode and the software is written at first into one uP and then in the other.

the first uP uses SPI1, the second uses SPI3. In this condition everything works just fine.

What happens: when I use as first uP for writing the one with SPI3 and as second the one with SPI1, some exceptions occur. In particular during tftp put request, after some packets the uP does not give an acknowlegment anymore but goes into a exception (undefentry).

Does anyone have any suggestion about how the SPI changing can influence the ethernet communication? It is not a priority interrupt problem since both the SPI have a higher priority than ethernet.

Thanks for your attention.

Valentina

  • UPDATE: the exception is generated from the get request that I make after the put request. What is blocking the process indeed is the uP not sending the ack to data packets during the put request. For the first packets the ack is sent, after a while (the number of packets isn't always the same) the ack is missing.
  • Hello Valentina,

    I am not sure if my understanding is correct:
    1. 2 MCUs (LC43x) in your system, They communicate each other through the MibSPI
    2. MCU1 downloads code through the TFTP bootloader
    3. MCU1 transfer the code to MCU2 using MibSPI

    If MCU1 uses SPI1 to write data to a SPI slave, and MCU2 writes to a slave using SPI3, tftp bootloader works ok
    but
    If MCU1 uses SPI3 to write data to a SPI slave, and MCU2 writes to a slave using SPI1, tftp bootloader stops working
  • Hello Qj Wang,
    Thanks for your reply. Yes your understanding is correct. In particular in working conditions uP1 is the master and uses SPI 1 while uP2 is the slave and uses SPI3. When i try to Exchange the role of the two uPs the error occurs. In my sw the updating procedure us done in two steps: Fist using tftp to write uP1 and second using SPI to write uP2.What I can't explain is why the error occurs when using only the tftp.
    Thanks
    Valentina
  • Hello Mr Wang,

    I have some updates: I did some tests and it seems that the problem is the microcontroller is missing some data message reception during TFTP PUT request. Found this out, I tried to overcome the problem making some changes in my HMI; when, after a while, the HMI doesn't receive the ack from the microcontroller it sends the same data packet again. In this way I can finish the PUT request successfully.

    The thing is my software after writing all the 1st microcontroller memory has to verify the procedure reading back all the memory again and resending all the data with a TFTP GET request. In this configuration I'm having the same issue: the microcontroller is missing some acknowledge message and stops sending the data. Unluckly I haven't manage to fix this in my software yet besides I need to find out why all of this happens only configuring a defined SPI (SPI3) and not using another one(SPI1).

    Do you think it could be something related to interrupt priority? Or something related to how the SPI are physically done? (I'm referring to the fact that one of the SPI can have more than 1 SIMO/SOMI pin while the other can't). I would also like to understand if the problem could come from the other microcontroller or not.

    Any clue about tests I can do is appreciated.

    thanks.

    Valentina

  • Hello Mr Wang,
    thanks for replying. Yes, In my system there are 2 MCUs (LC43x). They communicate ehach other using SPI. MCU1 is the master while MCU2 is the slave. MCU1 is programmed using tftp, MCU2 is programmed using SPI.
    If I use MCU1 as master with SPI1 and MCU2 as slave with SPI1 everything works.
    If I use MCU1 as master with SPI3 and MCU2 as slave with SPI3 the tftp programming procedure stops becuase the MCU1 doesn't receive all the ethernet messages.
  • Hello Mr Wang,
    I did another test to verify the interrupt priority issue: I uses the function vimChannelMap to move the rx ethernet interrupt from index 79 to index 37; viceversa I used the same function to move mibspi3HighInterruptLevel from 37 to 79. The result is: nothing changed; the microcontroller still looses some ethernet messages.
    At the moment i don't know what else could be the reason for such behaviour.
    Thanks.
    Regards
    Valentina
  • Hello Valentina,

    I hope you have solved the problem. I don't see any reason that SPI3 causes the data packet missing to the EMAC. I run LWIP demo and SPI3 transmitting data to another SPI at the same time, and I did not see the lost package. I use Ostinato to TX/RX packet.
  • Hello QJ,

    thank you for you help. I actually did not solve my problem; I run some more test with SPI1 and 3 and what I noticed is there are missing data in both cases; using SPI1 it just happens more often. 

    Besides my software does: 

    1. initialize SPI and EMAC

    2. start to communicate on SPI to check the connection with the other microcontroller

    3. pauses this communication and starts the ethernet communication with pc

    4. once the ethernet comminucation is over, restart the spi communication

    the missing data error happens during step 3. 

    Thank you.

    Best Regards

    Valentina

  • Hello Valentina,

    Since I could not reproduce the issue, so I want to close this thread first.