Python TypeError bug in efm8loadusb for P2D2 - help!
Peter Jakacki
Posts: 10,193
One of the best ways IMO for learning any language is to dive in head first. Unlike shallow waters you can't injure yourself but you sure learn a lot splashing about.
Wanting to bypass SIlabs Simplicity Studio when I just want to access the EMF8 chip's bootloader directly on my P2D2 board I found some Python code that seems to work in that it can identify the chip and even dump it's internal memory, and with a little modification it now handles the 48k of the EFMUB3 that I use. However there is one bug that I haven't worked around yet although I have learnt a few things in the process, so I am reaching out for some help just to get things going, since I need to get other things going too.
When I run this code, this is what happens.
I have gone back into the backend packages too and tried several things on the loader to get it to work. Any ideas?
Wanting to bypass SIlabs Simplicity Studio when I just want to access the EMF8 chip's bootloader directly on my P2D2 board I found some Python code that seems to work in that it can identify the chip and even dump it's internal memory, and with a little modification it now handles the 48k of the EFMUB3 that I use. However there is one bug that I haven't worked around yet although I have learnt a few things in the process, so I am reaching out for some help just to get things going, since I need to get other things going too.
When I run this code, this is what happens.
efm8boot-master$ python efm8loadusb.py identify The device identifies as EFM8UB31F40G_QFN24 [36: 1]. efm8boot-master$ python efm8loadusb.py upload vcp.hex Traceback (most recent call last): File "efm8loadusb.py", line 422, in <module> sys.exit(main()) File "efm8loadusb.py", line 419, in main return opts.cmd(device, opts) File "efm8loadusb.py", line 146, in cmd_flash write_chunked(dev, segment, a, chunksize=128) File "efm8loadusb.py", line 165, in write_chunked do_write(dev, addr, chunk) File "efm8loadusb.py", line 209, in do_write hid_set_report(dev, [36, dlen + 3, 0x33, addrH, addrL] + data) File "efm8loadusb.py", line 47, in hid_set_report report) File "/home/peter/.local/lib/python2.7/site-packages/usb/core.py", line 1023, in ctrl_transfer buff = _interop.as_array(data_or_wLength) File "/home/peter/.local/lib/python2.7/site-packages/usb/_interop.py", line 97, in as_array a.fromstring(data) # deprecated since 3.2 TypeError: fromstring() argument 1 must be string or read-only buffer, not list efm8boot-master$
I have gone back into the backend packages too and tried several things on the loader to get it to work. Any ideas?
Comments
and that runs giving this - seems to Auto-sense the HID port, and I need to jumper P2.0-GND then RST to engage the bootloader, (and remember to remove jumper.. )
and the baud rate did change, so it looks like that all worked.
run the code with --trace to see what they try to actually send
edit: failing that add a print(data) statement before line 208 (right before the hid_set_report(..) line)
Some cryptic error messages later and I find it needs 64b versions of the DLL's
and copy those to source directory...then run hex2boot.py efm8load.py
Linux notes on the same source code is here :
https://www.silabs.com/community/mcu/8-bit/knowledge-base.entry.html/2017/10/23/how_to_use_efm8_uart-qTQD
with a link
https://www.silabs.com/content/usergenerated/asi/cloud/attachments/siliconlabs/en/community/mcu/8-bit/knowledge-base/jcr:content/content/primary/blog/how_to_use_efm8_uart-qTQD/AN945SW-uart-bootloader-linux.zip