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.

CC3200: cc3220 and python firmware loader script

Part Number: CC3200
Other Parts Discussed in Thread: CC3220SF, UNIFLASH

Hi everybody!

I have 10 cc3220sf at custom pcb's and i it 6 pins (tx/rx/sop1/rst/vcc/gnd) to load firmware to them.

I have install python 2.7 to my windows 7x64 and i have ftdi2232.

How to use the python script + ftdi chip to load fimware in producion? step by step.

bootldr.py
ImageProgramming.py
setup.py

how prepare *.bin firmware file in UnFlash?

upd:
i have launch imageprogramming.exe and have no lfirmware load

Microsoft Windows [Version 6.1.7601]
(c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.

C:\cc3220\executables>ImageProgramming.exe -p 5 -i wifi.bin
Image Programming v2.0.0
-----------------------------
This utility programs a binary image to a serial flash connected to CC3120/CC322
0 device
Only production devices are supported (i.e. no pre-production devices)
The binary image needs to be prepared in advance using Uniflash utility

Step #1 --> connect to target device
--- please restart the device ---
connection succeeded
get storage list
receive storage list

Step #2 --> Reading version info
Reading version info completed

It's a CC3220SF device
Step #3 (CC3220 only) --> Switch UART to NWP core
Step #4/8 --> Get SRAM/SFLASH storage info
Step #5/9 --> Erasing 3 blocks from SRAM/SFLASH starting from block #0
The process of erasing blocks takes several seconds
Erasing completed

Step #6/10 --> Program image[0:10531] to SRAM/SFLASH
Image programming completed

Step #7 --> Execute bootloader patches from SRAM
enter get storage info
Step #4/8 --> Get SRAM/SFLASH storage info
Step #5/9 --> Erasing 2 blocks from SRAM/SFLASH starting from block #33
The process of erasing blocks takes several seconds
Erasing completed

Step #6/10 --> Program image[135176:141157] to SRAM/SFLASH
Image programming completed

Step #11 --> Image programming
Received error : error number = -10275 , extended error = 3904
Programming progress = 7 %
Total programming duration = 0 seconds
Step #12 --> Reset the target device

C:\cc3220\executables>

  • Shamil,

    If you are trying to create a Production Line programming tool, and going to flash the device in production mode, you are going to need to create the SLI file that Uniflash needs to flash the device.

    To do this, you would create a project a Uniflash (make sure production is selected in project options) and configure this project just like you would if you wanted to program our device. Then, you will go to burn, and click create image.

    This new .SLI file is what you can use the Uniflash CMD line tool to flash your device.

    Regards,
    VR
  • this is fine, but i have a task to make the progammator device (with ftdi chip) and python script as programmer tool for this device.
  • Hi,

    For programming by ImageProgramming.exe utility you need to use *.ucf file generated by Uniflash. You cannot use *.bin file generated by Uniflash or by CCS. In case of device is in development mode, proper MAC address need to be set by Uniflash during creation of *.ucf file.

    From readme.txt:

    Image Programming utility is a Microsoft Windows-based software tool for flashing a complete image on CC3120/CC3220 Simplelink devices.
    The Image itself is created using Uniflash utility. 
    The *.ucf format needs to be chosen.

    Jan

  • Does this mean that MAC addresses will be the same for all devices? or I misunderstood?
  • Hi,

    No. In development mode is image file unique for every single devices. Image need to contain MAC address of particular device.

    Work-flow of embedded programming make sense only with devices in production mode. In production mode is image not tied with particular MAC address.

    Jan
  • I made *.ucf file in production mode by UniFlash and load firmware by ImageProgramming.exe - it works.

    But i need python. i tryed to start it but it doesn't. what minimal i need to start ImageProgramming.py ?

    Microsoft Windows [Version 6.1.7601]
    (c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.
    
    C:\cc3220\sources>ImageProgramming.py
    Traceback (most recent call last):
      File "C:\cc3220\sources\ImageProgramming.py", line 36, in <module>
        import bootldr
      File "C:\cc3220\sources\bootldr.py", line 102
        print str
                ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(print st
    r)?
    
    C:\cc3220\sources>

  • Hi,

    You need to use Python 2.7.x with pySerial. For "compiling" from .py to exe file is used py2exe.

    Jan
  • Microsoft Windows [Version 6.1.7601]
    (c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.
    
    C:\cc3220\sources>ImageProgramming.py
    Traceback (most recent call last):
      File "C:\cc3220\sources\ImageProgramming.py", line 36, in <module>
        import bootldr
      File "C:\cc3220\sources\bootldr.py", line 102
        print str
                ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(print st
    r)?
    
    C:\cc3220\sources>

    pyserial installed

  • Hi,

    You cannot use Python 3.

    Jan
  • *.exe is work but *.py not

     what is the different?

  • Hi,

    You should print detail information of exception ( docs.python.org/.../errors.html ).

    Jan
  • there are no exceptions. just can't connect to free comport.

  • Hi,

    No. See code of bootldr.py. Message "--- error during connecting process" is a exception in connect_with_reset().

    except Exception:
      self._trace_msg(TRACE_LEVEL_ERROR,"--- error during connecting process")
      self.comm.setBreak(False)
      self._printTraceback()
      sys.exit(EXIT_CODE_EXCEPTION_CONNECT)
    

    Jan

  • i don't know. it does't see com ports at three PC (2 x win7x64 & win7x86)
    may be sources are corrupted?
  • Hi,

    I don't think that source codes are corrupted. Printing of details of exception can give you a clue.

    Jan
  • no exception msg.

    i had installed PyCharm and start this script step by step.

    and at one moment it became stop only:

  • Hi,

    Do you have any experience with Python language or any other OOP language? Your questions are related to fundamentals to Python itself. To be able made changes at Python code you need to go through tutorials to Python (e.g. www.python.org/.../gettingstarted). I am not sure what do you expecting. In case of that you want do embedded programming from Windows machine, you can use ImageProgramming.exe without any limitation. In case you want change Python script to add some requested features, you need to know Python including ways how can be debugged.

    Image below is from source of pySerial library. Please read more about keyword "raise" here docs.python.org/.../errors.html

    Jan

  • i have a little

    i found some mistakes:

    was

    self.com_port = com_port
    self.comm = serial.Serial(port=( self.com_port-1), baudrate=self.baudrate, timeout=15, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE)

    now

    self.com_port = ('COM%s' % com_port)
    self.comm = serial.Serial(port=( self.com_port), baudrate=self.baudrate, timeout=15, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE)

    and right now i have

    Microsoft Windows [Version 6.1.7601]
    (c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.
    
    C:\cc3220\sources>ImageProgramming.py -p5 -i wifi3221_production_Programming.ucf
     -v
    Image Programming v2.0.0
    -----------------------------
    This utility programs a binary image to a serial flash connected to CC3120/CC322
    0 device
    Only production devices are supported (i.e. no pre-production devices)
    The binary image needs to be prepared in advance using Uniflash utility
    
    Step #1 --> connect to target device
    port opened
    wait and clear uart rx buffer
    set break signal
    --- error during connecting process
    --- error during connecting to device
    
    C:\cc3220\sources>

    wait timer doesn't work

    i think *.py and *.exe sources are different

  • Hi,

    Source from embedded programming package works without any issue. I tested it now. No modification is required.

    My test setup:

    • python 2.7.15
    • pySerial-2.7
    • pywin32-224.win32-py2.7

    and result:

    c:\ti\cc3220_embadded_programming\sources>"C:\Program Files\Python27\python" ImageProgramming.py -p 5 -i test_Programming.ucf -e
    Image Programming v2.0.0
    -----------------------------
    This utility programs a binary image to a serial flash connected to CC3120/CC3220 device
    Only production devices are supported (i.e. no pre-production devices)
    The binary image needs to be prepared in advance using Uniflash utility
    
    Step #1 --> connect to target device
    --- please restart the device ---
    connection succeeded
    get storage list
    receive storage list
    
    Step #2 --> Reading version info
    Reading version info completed
    
    It's a CC3220SF device
    Step #3 (CC3220 only) --> Switch UART to NWP core
    Step #4/8 --> Get SRAM/SFLASH storage info
    Step #5/9 --> Erasing 3 blocks from SRAM/SFLASH starting from block #0
    The process of erasing blocks takes several seconds
    Erasing completed
    
    Step #6/10 --> Program image[0:10531] to SRAM/SFLASH
    Image programming completed
    
    Step #7 --> Execute bootloader patches from SRAM
    enter get storage info
    Step #4/8 --> Get SRAM/SFLASH storage info
    Step #5/9 --> Erasing 2 blocks from SRAM/SFLASH starting from block #33
    The process of erasing blocks takes several seconds
    Erasing completed
    
    Step #6/10 --> Program image[135176:141157] to SRAM/SFLASH
    Image programming completed
    
    Step #11 --> Image programming
    Programming progress = 2 %
    Programming progress = 5 %
    Programming progress = 8 %
    Programming progress = 11 %
    Programming progress = 14 %
    Programming progress = 17 %
    Programming progress = 20 %
    Programming progress = 23 %
    Programming progress = 26 %
    Programming progress = 29 %
    Programming progress = 32 %
    Programming progress = 35 %
    Programming progress = 38 %
    Programming progress = 41 %
    Programming progress = 44 %
    Programming progress = 47 %
    Programming progress = 50 %
    Programming progress = 53 %
    Programming progress = 56 %
    Programming progress = 59 %
    Programming progress = 61 %
    Programming progress = 64 %
    Programming progress = 67 %
    Programming progress = 70 %
    Programming progress = 73 %
    Programming progress = 76 %
    Programming progress = 79 %
    Programming progress = 82 %
    Programming progress = 85 %
    Programming progress = 88 %
    Programming progress = 91 %
    Programming progress = 94 %
    Programming progress = 97 %
    Programming done. Starting image extraction. Please wait...
    Finished OK !!!!
    Total programming duration = 33 seconds
    Step #12 --> Reset the target device
    
    c:\ti\cc3220_embadded_programming\sources>pause
    Press any key to continue . . .

    Jan

  • python 2.7.15
    pySerial-2.7
    pywin32-224.win32-py2.7



    can you give me all your *.py files "as is" for check the difference by WinMerge?

  • Hi,

    It looks that you have installed latest version of pySerial (version 3.4). I tested with old version 2.7 from 2013. I expect that this is not important, but I don't investigated that.

    Content of \sources directory I have (without my testing image test_Programming.ucf):

    sources.zip

    Jan

  • >>>  I expect that this is not important, but I don't investigated that.

    i have installed pyserial 2,7 and my script works.

  • Hi,

    Sorry I don't understand what you want to say.

    Used versions for scripts are described at CC3x20embeddedimageprogrammingexamp_manifest.html inside embedded programming package (2.7.3, 0.6.9).

    Jan

  • and this is my f@ckup.
    sorry.
  • Hi,

    I am not author this this code and even a not a TI employee. Answering questions on this forum is only my good will, and I did not earn any single cent from it. But if you are not satisfied with my answers, I haven't a problem do not answers to your questions in the future.

    Jan

  • i am really sorry.