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.

TM4C129ENCPDT: What is the current method for programming the processor in USB ROM bootloader mode?

Part Number: TM4C129ENCPDT
Other Parts Discussed in Thread: UNIFLASH

Hi there,

I've been looking through many TI forum articles on programming the TM4C129E processor in ROM bootloader mode (most of which are very old and no longer useful), but haven't been able to find something that works.

I'm using a TM4C129ENCPDT processor on a custom board. The BPPTCFG has been configured to enter bootloader mode when a particular GPIO is asserted at start-up (which works).

I've tried using both Mac and Windows 11 (Arm) under Parallels.

In MacOS, I can see the device when plugged in to a USB port...

Tiva Device Firmware Update:

  Product ID: 0x00ff
  Vendor ID: 0x1cbe  (Texas Instruments - Stellaris)
  Version: 0.01
  Serial Number: 00000000
  Manufacturer: Texas Instruments Incorporated
  Location ID: 0x02100000

Using "dfu-util -l", I get the following output:

dfu-util 0.11
...

Found DFU: [1cbe:00ff] ver=0001, devnum=1, cfg=1, intf=0, path="2-1", alt=0, name="UNKNOWN", serial="00000000"

However, if I programming it via "dfu-util -v -D <filename.bin>" I get the following output:

dfu-util 0.11
...

libusb version 1.0.27 (11882)
dfu-util: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
Opening DFU capable USB device...
Device ID 1cbe:00ff
Device DFU version 0110
DFU attributes: (0x07) bitCanDnload bitCanUpload bitManifestationTolerant
Detach timeout 65535 ms
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(10) = dfuERROR, status(11) = iString indicates a vendor specific error
Clearing status
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download [                         ]   0%            0 bytes failed!
DFU state(10) = dfuERROR, status(11) = iString indicates a vendor specific error

 

If I try on the Windows 11 platform, and having installed WinUSB as the driver, I see the device as:

Tiva Device Firmware Update

Hardware Ids:
USB\VID_1CBE&PID_00FF&REV_0001
USB\VID_1CBE&PID_00FF

and the device is said to be working properly.

If I try in a command box "dfuprog -e" I see:

Copyright (c) 2008-2020 Texas Instruments Incorporated.  All rights reserved.

The driver for the USB Device Firmware Upgrade device cannot be found.
Before running this program, please connect the DFU device to this system
and install the device driver when prompted by Windows.  The device driver
can be found on the evaluation kit CD or can be found in the windows_drivers
directory of your TivaWare installation.

I have tried LM Flasher Programmer but it doesn't support USB.

I have tried UniFlash, but it doesn't seem to have a native USB connection either.

 

So I have no idea how to perform a firmware update on this processor.

Ideally I would like a Windows version as that is what my client runs.

Can you please help with a solution?

Kind rergards,
James.

  • Ok. I've since discovered (by uploading the binary from FLASH and comparing it to the generated output) that the TI DFU binary needs an 8-byte header (first 4 bytes = 1 and second 4 bytes = binary file length in bytes). There are also some 4-byte sector alignment adjustments as well, and I've tried to implement the alignment in the linker file but without success.

    Is there a configuration in CCS which can just output the DFU binary without having to manually create the header and fix the alignment issues? I may have missed something important on this somewhere, but just can't seem to find it.

  • Well, it looks like I've come to my own rescue, but I'll outline it here for future reference.

    The TI conversion tool 'armhex' doesn't seem to correctly 4-byte align the data when converting from the .out file to .bin file (or at least I can't find any options that work), so I downloaded a generic one (for my Mac in this case) and used these to correctly generate the binary output. I created a simple Python script to do the conversion and prepend the 8-byte header. I don't use Python much so you will likely come up with something better, but here's what worked for me. (I tried using the formatting tool in this dialog box but that also didn't work, so apologies that it's just plain, unindented text :-p I'm sure you can re-format as required.)

    So to do the conversion from 'app.out' to 'app.bin':

    BuildDFU.py  app.out  app.bin

    Then, once the processor is in USB DFU mode:

    dfu-util -D app.bin

    -------------  BuildDFU.py  ---------------

    #!/usr/bin/python3

    import sys
    import os

    # Paths
    objcopy = "/opt/homebrew/Cellar/arm-none-eabi-binutils/2.46.0/bin/arm-none-eabi-objcopy"

    # Check params
    if (len(sys.argv) != 3):
    print('\nFormat: BuildDFU.py <out filename> <bin filename>\n')
    exit(1)

    # Get filenames
    input_file = sys.argv[1]
    output_file = sys.argv[2]
    temp_file = output_file + ".tmp"
    print("Generating " + output_file + " from " + input_file + "\r")

    # Convert OUT (ELF) to BIN
    os.system(objcopy + " -O binary --gap-fill 0x00 " + input_file + " " + temp_file)

    # Open output file
    with open(output_file, 'wb') as outfile:

    # Get input file
    with open(temp_file, 'rb') as infile:

    # Read file contents
    firmware = infile.read()

    # Build header
    header = bytearray([1, 0, 0, 0])
    firmware_len = len(firmware)
    header.append(firmware_len & 0xFF)
    header.append((firmware_len >> 8) & 0xFF)
    header.append((firmware_len >> 16) & 0xFF)
    header.append((firmware_len >> 24) & 0xFF);

    # Write header and firmware
    outfile.write(header + firmware)
    outfile.close()

    infile.close()

    # Remove temp file
    os.remove(temp_file)

    print("Done!\r")