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.

TM4C1231D5PZ: I2C updating

Part Number: TM4C1231D5PZ
Other Parts Discussed in Thread: EK-TM4C123GXL

Hi all

I am trying to update my TM4C123 controller using I2C.
Unfortunate, something goes wrong and I don't have a clue.

I follow the 5. Serial update for packet handling.
Sending a 0x11 0x1 sets the controller in the ROM_UpdateI2C mode.

Using a Beagle, I can see the I2C transactions and notice the COMMAND_DOWNLOAD and COMMAND_SEND_DATA getting through (although only once).
After the first COMMAND_SEND_DATA, I get i2c timeouts.

Any help on this?

  • Hi,

      Although we don't have a I2C bootloader example calling ROM_UpdateI2C(), we have an example for UART bootloading calling ROM_UpdateUART(). The example can be found in C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c123gxl\boot_demo_uart_rom. Can you modify this example to adapt for I2C? The important thing is that the application must configure and enable the I2C interface and disable all processor interrupts before calling ROM_UpdateI2C. See below notes from Bootloader user's guide. Before you modify the example for the I2C, I will also suggest you run the example as is to get a feel for it for UART bootloading. Please also make sure you have the required pullup resistors on SCL and SDA buses per I2C protocol. It will also help to show the bus waveforms on a logic analyzer. 

    Before calling the ROM boot loader API, the application must configure and enable the chosen
    interface and disable all processor interrupts.

  • Hi Charles
    I use the same sequence as ROM_UpdateUART (disabling the interrupts and calling ROM_UpdateUART() or ROM_Update_i2C() in this case)
    That sequence works with a UART update (using LM flash programmer and a serial interface).

    I suspected to be just do the same for I2C with the difficult part to be writing the packet according to the standards.

    Do you have an example (C/C++ / Python / ...) of how to send the packets to the TM4C123?
    My controller is in ROM_UpdateI2C mode :)

  • Hi,

    Also Charles, can you point me in the direction where to download versio 2.2.0.295 of the TivaWare series?

    Please download the latest version from https://www.ti.com/tool/SW-TM4C.

    I use the same sequence as ROM_UpdateUART (disabling the interrupts and calling ROM_UpdateUART() or ROM_Update_i2C() in this case)
    That sequence works with a UART update (using LM flash programmer and a serial interface).

    I wonder if you have enabled and configured the I2C0 interface. In you application, before you call ROM_UpdateI2C(), can you make sure you can  receive some test messages from the master on the I2C bus.  I don't have much experience with the I2C bootloading but I think the LM flash programmer is acting as a master and the MCU is acting as a slave. Therefore, I think you need to setup the MCU as a I2C slave. There is a slave example in C:\ti\TivaWare_C_Series-2.2.0.295\examples\peripherals\i2c\slave_receive_int.c. Please also note that ROM_UpdateI2C() only works with I2C0. 

  • Hi Charles

    Thanks for the link :)

    The I2C interface is up and acts as a slave.

    I use I2C0.

    My program running on the TM4C123 receives my command (0x11) and calls the ROM_UpdateI2C().

    Sometimes, some bytes are written because after a powercycle, the program does not run. Because of a not complete program cycle, a corrupt program is written (although that is what I expect).

    The documentation for a I2C update from the Master side is kind of lacking.

    As shown in the initial image, I send a COMMAND_DOWNLOAd as follows: length(11), checksum of data, COMMAND_DOWNLOAD, 4 bytes of address (0x00000000), 4 bytes of size (+- 24k).

    Next I send COMMAND_SEND_DATA as follows: length(11), checksum of data, COMMAND_SEND_DATA, 8 databytes.

    I should exectute the COMMAND_SEND_DATA arround 3000 times, unfortunate, only the first gets through. The others all get a timeout.

  • Hi Ayrton,

    The documentation for a I2C update from the Master side is kind of lacking

    I think this app note will provide more details about the command structure. This app note describes a flash-based serial bootloader. However, the implementation for ROM_UpdateI2C() and ROM_UpdateUART() will follow the same command and data packet structures. 

    https://www.ti.com/lit/pdf/spma074

  • Hi Charles 

    Thanks for the document Slight smile 

    It is a lot more clear of how the packets should look.
    Unfortunate, no woking packet-stream yet. 

    I will try to use the TI-programmer way using a TM4C123 as a programmer and compare both packetstreams.