Espressif ESP32-S3-WROOM-1 + Micropython --- invalid header: 0xffffffff - esp32

I purchased this from Digikey (docs).
I flashed the latest firmware release with the following commands:
$ esptool.py \
--port /dev/tty.usbmodem14201 \
--baud 460800 \
--before default_reset \
--after hard_reset \
--chip esp32s3 \
erase_flash
$ esptool.py \
--chip esp32s3 \
--port /dev/tty.usbmodem14201 \
--baud 460800 \
write_flash \
-z 0x1000 \
GENERIC_S3-20220117-v1.18.bin
Output:
esptool.py v3.2
Serial port /dev/tty.usbmodem14201
Connecting...
Chip is ESP32-S3
Features: WiFi, BLE
Crystal is 40MHz
MAC: 84:f7:03:c0:33:f8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00154fff...
Compressed 1390128 bytes to 917154...
Wrote 1390128 bytes (917154 compressed) at 0x00001000 in 15.2 seconds (effective 731.0 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
When I connect to the UART with the following command:
$ python -m serial.tools.miniterm /dev/tty.usbmodem14201 115200
--- Miniterm on /dev/tty.usbmodem14201 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
...
I've also tried building from source. I'm thinking it has something to do with the ESP32-S3 devkit that I purchased. Can someone help me figure out why I can't get micropython installed on this devkit? Thanks!

To flash the firmware you're running the command:
esptool.py \
--chip esp32s3 \
--port /dev/tty.usbmodem14201 \
--baud 460800 \
write_flash \
-z 0x1000 \
GENERIC_S3-20220117-v1.18.bin
The instructions at the firmware link you shared say to use location 0 not 0x1000:
esptool.py --chip esp32s3 --port /dev/ttyACM0 write_flash -z 0 board-20210902-v1.17.bin
This isn't an argument to -z, which means compress the image; it's the address to start writing the image at.
Try using the offset provided in the directions:
esptool.py \
--chip esp32s3 \
--port /dev/tty.usbmodem14201 \
--baud 460800 \
write_flash \
-z \
0 GENERIC_S3-20220117-v1.18.bin
Micropython definitely isn't going to load and work properly if it's not flashed to the correct location.

Related

How to run QEMU with Fedora + Custom kernel

I am trying to run Fedora with QEMU, but with a custom kernel that i built by using the first steps from the readme.txt file from here. The kernel describes T-HEAD's C910 processor, and I want it in order to run benchmarks (Fedora was the first OS that I found that supports RISC-V).
Following the steps from Fedora's guide, QEMU finally successfully booted, but with the guide's suggested kernel. The command run is shown here.
qemu-system-riscv64 \
-bios none \
-nographic \
-machine virt \
-smp 8 \
-m 2G \
-kernel Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-device,rng=rng0 \
-device virtio-blk-device,drive=hd0 \
-drive file=Fedora-Developer-Rawhide-*.raw,format=raw,id=hd0 \
-device virtio-net-device,netdev=usernet \
-netdev user,id=usernet,hostfwd=tcp::10000-:22
Also, the command from the readme.txt file from the first link works as well, but it just boots into the kernel alone, no OS (hence the need for the OS).
LD_LIBRARY_PATH=./host/lib ./host/csky-qemu/bin/qemu-system-riscv64 -M virt -kernel fw_jump.elf -device loader,file=Image,addr=0x80200000 -append "rootwait root=/dev/vda ro" -drive file=rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -nographic -smp 1
I tried modifing the -kernel argument from the command at Fedora's guide to the path to the custom kernel. By executing the command, it hangs at the start, as shown in the image below:
It's probably a matter of arguments that are supplied to QEMU since it's clear that the one from readme.txt and the one from Fedora's guide differ by a lot

ESP32S3 - Micropython - network.WLAN.active(True) Hangs

I purchased this from Digikey (docs).
I flashed the latest firmware release with the following commands:
$ esptool.py \
--port /dev/tty.usbmodem14201 \
--baud 460800 \
--before default_reset \
--after hard_reset \
--chip esp32s3 \
erase_flash
$ esptool.py \
--chip esp32s3 \
--port /dev/tty.usbmodem14201 \
--baud 460800 \
write_flash \
-z 0 \
GENERIC_S3-20220117-v1.18.bin
With the resultant interpreter prompt, I instantiate a network.WLAN object and call the .active(True) method to enable the interface, but it hangs forever. I replicated the issue on identical hardware. Not sure if this is a software bug or a hardware bug. I haven only tested this with the device being powered via USB port connected to my dev laptop, so I haven't looked into whether this could be a power issue.
.venv/bin/python -m serial.tools.miniterm /dev/tty.usbmodem1234561 115200
--- Miniterm on /dev/tty.usbmodem1234561 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
>>>
>>> import network
>>> wlan = network.WLAN(network.STA_IF)
>>> wlan.active()
False
>>> wlan.active(True) <--------- this method call hangs forever
Any ideas I could try to get wifi working?
Thanks in advance.

Signing message problem with GPG loopback pin-entry option

I am trying to encrypt and sign a file with gpg and loopback pinentry option, with the below command:
gpg --pinentry-mode=loopback --passphrase ="mypws" \
--ignore-time-conflict --ignore-valid-from \
--cipher-algo AES256 --symmetric --ignore-time-conflict \
--passphrase-file ~/.gnupg/PG/p-enckey --trust-model always -q --batch --yes --local-user "UserID" \
--sign --force-mdc \
--output /var/psigner/2 \
/var/psigner/1
however i got the below error message:
gpg: signing failed: Too much data for IPC layer
gpg: /var/psigner/1: sign+symmetric failed: Too much data for IPC layer
but with the below command, which a dialoge pops up to ask for the key passpharse, everything works fine.
gpg \
--ignore-time-conflict --ignore-valid-from \
--cipher-algo AES256 --symmetric --ignore-time-conflict \
--passphrase-file ~/.gnupg/PG/patch-enckey --trust-model always -q --batch --yes --local-user "UserID" \
--sign --force-mdc \
--output /var/psigner/2 \
/var/psigner/1
can anyone give me a advice to solve the problem?

Vagrant keeps losing file doing provision

I'm running into an odd behavior on the latest version of vagrant in a Windows7/msys/Virtualbox environment setup, where after executing a vagrant up command I get an error with rsync; 'file has vanished: "/c/Users/spencerd/workspace/watcher/.LISTEN' doing the provisioning stage.
Since google, irc, and issue trackers have little to no documentation on this issue I wonder if anyone else ran into this and what would the fix be?
And for the record I have successfully build a box using the same vagrant file and provisioning script. For those that want to look, the project code is up at https://gist.github.com/denzuko/a6b7cce2eae636b0512d, with the debug log at gist.github.com/
After digging further into the directory structure and running into issues with git pushing code up I was able to find a non-existant file that needed to be removed after a reboot.
Thus, doing a reboot and a rm -rf -- "./.LISTEN\ \ \ \ \ 0\ \ \ \ \ \ 100\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ " did the trick.

QEMU on Linux works, but on Windows (probably 7/8) fails when -redir parameter is used

I'm shipping my project via qemu static build and a Linux VM. My project uses port 4848 for server configuration and port 8080 for HTTP (tools) and ephermal ports (49152+) for spawned sub-projects that use p2p websockets.
Note that the qemu binary is the qemu-system-... binary from Linux and the qemu.exe on windows, all statically compiled.
On Linux, I'm starting everything with this command. It works like a charm as expected:
./qemu -curses \
-kernel ../vmlinuz \
-initrd ../root.gz \
-L ./ \
-redir tcp:4848::4848 \
-redir tcp:8080::8080 \
-redir tcp:49152::49152 \
-redir tcp:49153::49153 \
-redir tcp:49154::49154 \
-redir tcp:49155::49155 \
-redir tcp:49156::49156 \
-redir tcp:49157::49157 \
-redir tcp:49158::49158 \
-redir tcp:49159::49159 \
-redir tcp:49160::49160 \
-redir tcp:49161::49161 \
-redir tcp:49162::49162 \
-append "quiet autologin loglevel=3"
On my Windows XP VM (in VirtualBox), this command here works fine without issues once you have approved the Firewall popup, but it seems to not work on Windows 8:
start qemu.exe -kernel ..\vmlinuz -initrd ..\root.gz -L ./ -redir tcp:4848::4848 -redir tcp:8080::8080 -redir tcp:49152::49152 -redir tcp:49153::49153 -redir tcp:49154::49154 -redir tcp:49155::49155 -redir tcp:49156::49156 -redir tcp:49157::49157 -redir tcp:49158::49158 -redir tcp:49159::49159 -redir tcp:49160::49160 -redir tcp:49161::49161 -redir tcp:49162::49162 -append "quiet autologin loglevel=3"
I found out that there might be an issue with the NE2000 network card driver on Windows, which I read here: http://www.h7.dion.ne.jp/~qemu-win/HowToNetwork-en.html
When trying to bootup qemu.exe directly without the -redir stuff and the flags "-net nic,model=rtl8139 -net user", it boots up properly.
But when I start to add the -redir flags on Windows8, it crashes and not even shows a single message in the cmd / Terminal.
Question
How to properly redir ports of a VM guest to a Windows 8 host with qemu.exe in CMD?

Resources