How to Production Progam and upload system files

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
PM-TPI
Posts: 75
Joined: Fri Jun 28, 2019 3:09 pm

How to Production Progam and upload system files

Post by PM-TPI » Mon Apr 18, 2022 8:57 pm

I am try to use Powershell and rshell to Flash and upload files to ESP32 with no success.

Code: Select all

'''
2021_production_program.ps1
'''
esptool.py --chip esp32 --port COM13 erase_flash
esptool.py --chip esp32 --port COM13 --baud 921600 write_flash -z --flash_mode dio --flash_freq 40m 0x1000 firmware.bin
rshell -p com13 --buffer-size 512 "cp boot.py /pyboard; cp main.py /pyboard; cp dash.html.gz /pyboard; cp 2021.svg.gz /pyboard"
rshell seems to stop copying at... cp dash.html.gz /pyboard; and starts the boot and main program.
Can rshell copy gzip files ???

Code: Select all

Compressed 1888432 bytes to 1178231...
Wrote 1888432 bytes (1178231 compressed) at 0x00001000 in 16.4 seconds (effective 918.6 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Using buffer-size of 512
Connecting to com13 (buffer-size 512)...
Trying to connect to REPL . connected
Retrieving sysname ... esp32
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/
Setting time ... Apr 18, 2022 16:37:33
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
Copying 'C:\Users\rlsap\OneDrive - GraphicComponents\1-SmartLOG Code\2021-Flash/boot.py' to '/pyboard/boot.py' ...
Copying 'C:\Users\rlsap\OneDrive - GraphicComponents\1-SmartLOG Code\2021-Flash/main.py' to '/pyboard/main.py' ...
b'\r\nin boot.py\r\n\r\npower latched...\r\ntft backlight set...\r\nassertion "atomic_load(&lock->dev[i]) == (intptr_t)NULL" failed: file "/mnt/c/SmartLOG/FW/Build/esp-idf/components/driver/spi_bus_lock.c", line 560, function: spi_bus_deinit_lock\r\n\r\nabort() was called at PC 0x401eebe0 on core 0\r\n\r\nBacktrace:0x40094b81:0x3ffd1460 0x40095169:0x3ffd1480 0x40098df9:0x3ffd14a0 0x401eebe0:0x3ffd1510 0x40192222:0x3ffd1540 0x40191a78:0x3ffd1560 0x400d82e2:0x3ffd1580 0x400d849d:0x3ffd15b0 0x400d86f6:0x3ffd1660 0x400e130d:0x3ffd16c0 0x400e3629:0x3ffd16e0 0x400e5e6e:0x3ffd1700 0x400dd09c:0x3ffd17a0 0x400e3629:0x3ffd17d0 0x400e3652:0x3ffd17f0 0x400ef4a3:0x
I am looking for the bare minimum code need to FLASH and UPLOAD files.
No need for Repl.
Any and all methods welcome !!!!

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: How to Production Progam and upload system files

Post by dhylands » Tue Apr 19, 2022 12:51 am

I'd recommend that you use --buffer-size=32 when using the ESP32 (and this is now the default with the latest versions of rshell)

If that doesn't work, then try using the --ascii option as well.

PM-TPI
Posts: 75
Joined: Fri Jun 28, 2019 3:09 pm

Re: How to Production Progam and upload system files

Post by PM-TPI » Tue Apr 19, 2022 1:30 pm

added the --ascii switch and removed baud to run at default 32...

Code: Select all

PS C:\Users\rlsap\OneDrive - GraphicComponents\1-SmartLOG Code\2021-Flash> 
rshell -p com13 -a "cp boot.py /pyboard; cp main.py /pyboard; cp dash.html.gz /pyboard; cp 2021.svg.gz /pyboard"
Using buffer-size of 32
Connecting to com13 (buffer-size 32)...
Trying to connect to REPL  connected
Retrieving sysname ... esp32
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/
Setting time ... Apr 19, 2022 09:22:19
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
Copying 'C:\Users\rlsap\OneDrive - GraphicComponents\1-SmartLOG Code\2021-Flash/boot.py' to '/pyboard/boot.py' ...

starts copying and freezes ???
What now ?
I need to program ~ 20 units to day and > 100 next week, and doing this manually is tough.
Trying to hold a Dupont Pogo in one hand while doing keyboard commands is crazy.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: How to Production Progam and upload system files

Post by dhylands » Tue Apr 19, 2022 6:00 pm

I'm not sure. This usually means that the UART has dropped a character.

You could try mpremote

Are you running the latest version of rshell? (which is 0.0.31).

PM-TPI
Posts: 75
Joined: Fri Jun 28, 2019 3:09 pm

Re: How to Production Progam and upload system files

Post by PM-TPI » Tue Apr 19, 2022 7:57 pm

yep...
installed yesterday

Code: Select all

C:\Users\rlsap\OneDrive - GraphicComponents\1-SmartLOG Code\2021-Flash>
PS C:\Users\rlsap\OneDrive - GraphicComponents\1-SmartLOG Code\2021-Flash> rshell --version
0.0.31
using pymaker... no issues
Trying mpremote now...

PM-TPI
Posts: 75
Joined: Fri Jun 28, 2019 3:09 pm

Re: How to Production Progam and upload system files

Post by PM-TPI » Wed Apr 20, 2022 1:58 pm

So mpremote worked perfect !! Thank YOU Dave !!

Code: Select all

mpremote connect COM13 fs cp boot.py main.py dash.html.gz 2021.svg.gz :
But I'm still having an issue with my Powershell script (.ps1)...

Code: Select all

esptool.py --chip esp32 --port COM13 erase_flash
esptool.py --chip esp32 --port COM13 --baud 921600 write_flash -z --flash_mode dio --flash_freq 40m 0x1000 firmware.bin
mpremote connect COM13 fs cp boot.py main.py dash.html.gz 2021.svg.gz :
The two esptool commands work fine, but mpremote doesn't start.
Any thoughts ??

It appears esptool is not releasing when complete.

Post Reply