Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pico Fido flashing crashed when using ESP32 Flasher #77

Open
piotr277 opened this issue Dec 5, 2024 · 74 comments
Open

Pico Fido flashing crashed when using ESP32 Flasher #77

piotr277 opened this issue Dec 5, 2024 · 74 comments

Comments

@piotr277
Copy link

piotr277 commented Dec 5, 2024

I'm reporting serious issue which just happened to me.
My device is Waveshare ESP32-S3-Zero. The host machine is Linux, web browser - Chrome.
I started flashing process using online ESP32 Flasher (https://www.picokeys.com/esp32-flasher). The flashing process was going well but stuck at info "wrapping up" for several minutes. I've checked the browser console. Here are the logs:

Serial port WebSerial VendorID 0x303a ProductID 0x1001
install-dialog-BWZCBYvU.js?module:477 Connecting...
install-dialog-BWZCBYvU.js?module:477 .
install-dialog-BWZCBYvU.js?module:477 

install-dialog-BWZCBYvU.js?module:477 Detecting chip type... 
install-dialog-BWZCBYvU.js?module:477 ESP32-S3
install-dialog-BWZCBYvU.js?module:477 Chip is ESP32-S3
install-dialog-BWZCBYvU.js?module:477 Features: Wi-Fi,BLE
install-dialog-BWZCBYvU.js?module:477 Crystal is 40MHz
install-dialog-BWZCBYvU.js?module:477 MAC: 24:ec:4a:26:88:78
install-dialog-BWZCBYvU.js?module:477 Uploading stub...
install-dialog-BWZCBYvU.js?module:477 Running stub...
install-dialog-BWZCBYvU.js?module:477 Stub running...
install-dialog-BWZCBYvU.js?module:477 Manufacturer: 20
install-dialog-BWZCBYvU.js?module:477 Device: 4016
install-dialog-BWZCBYvU.js?module:477 Detected flash size: 4MB
install-dialog-BWZCBYvU.js?module:477 Erasing flash (this may take a while)...
install-dialog-BWZCBYvU.js?module:477 Chip erase completed successfully in 14.59s
install-dialog-BWZCBYvU.js?module:477 Not changing the image
install-dialog-BWZCBYvU.js?module:477 Compressed 591632 bytes to 306232...
install-dialog-BWZCBYvU.js?module:477 Writing at 0x0... (5%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x119cd... (10%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x202cc... (15%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x27b64... (21%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x2cbfe... (26%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x34aef... (31%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x3af4a... (36%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x4109c... (42%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x46ff0... (47%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x4d876... (52%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x54672... (57%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x5a9fc... (63%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x60964... (68%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x67224... (73%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x6d041... (78%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x76f37... (84%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x7e871... (89%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x85736... (94%)
install-dialog-BWZCBYvU.js?module:477 Writing at 0x8bde9... (100%)
install-dialog-BWZCBYvU.js?module:477 Wrote 591632 bytes (306232 compressed) at 0x0 in 5.247 seconds.
install-dialog-BWZCBYvU.js?module:477 Leaving...
install-dialog-BWZCBYvU.js?module:807 HARD RESET
install-dialog-BWZCBYvU.js?module:807 DISCONNECT
esp32-flasher/:1 Uncaught (in promise) NetworkError: Failed to execute 'open' on 'SerialPort': Failed to open serial port.

Now the device seems to be dead - no led lights, nothing when connecting to USB. Here are dmesg logs when I connect it to USB:

[   51.982370] usb 1-2: new full-speed USB device number 7 using xhci_hcd
[   57.251445] usb 1-2: device descriptor read/all, error -110

What can I do to make it alive again..? help, please.

@polhenarejos
Copy link
Owner

You can put it in DFU mode and try flashing through espressif tools.

@piotr277
Copy link
Author

piotr277 commented Dec 8, 2024

After I kept pressed BOOT + RESET buttons, then released RESET, the board became again visible to OS as serial / uart. Then I flashed it with success with online ESP32 Flasher. No more error during that process.
However, now when I plug it to my Linux machine I still get the same dmesg messages as previously:

[  960.116722] usb 1-2: new full-speed USB device number 8 using xhci_hcd
[  965.450015] usb 1-2: device descriptor read/all, error -110

Is this a normal behaviour?
Next I tried to use online Pico Commisioner (https://www.picokeys.com/pico-commissioner/) but without success.. :( the device is not accessible.

@polhenarejos
Copy link
Owner

After flashing, is it listed by lsusb?

@piotr277
Copy link
Author

piotr277 commented Dec 9, 2024

No it isn't.
After pressed BOOT + RESET and releasing RESET it appears as serial / uart.

@polhenarejos
Copy link
Owner

This is normal. Then you have to flash it. After flashing the image, do you see it at lsusb?

@piotr277
Copy link
Author

piotr277 commented Dec 9, 2024

No, after successful flashing I don't see it at lsusb.

@polhenarejos
Copy link
Owner

By default should appear with VID/PID FFFE:FDFC. If it doesn't appear, it might have some problem with USB stack. Which board do you use?

@piotr277
Copy link
Author

piotr277 commented Dec 9, 2024

By default should appear with VID/PID FFFE:FDFC. If it doesn't appear, it might have some problem with USB stack. Which board do you use?

I have Waveshare ESP32-S3-Zero.

@polhenarejos
Copy link
Owner

I have the same. I'd recommend to use Espressif tools to avoid any problem from the browser.

@piotr277
Copy link
Author

piotr277 commented Dec 9, 2024

Ok, so you recommend to clone repo and build from the source, right?

@polhenarejos
Copy link
Owner

It would be nice, but you can try first downloading the firmware from here https://github.com/polhenarejos/polhenarejos.github.io/blob/main/esp/fw/pico_fido_esp32-s3_6.0.bin
and upload it to your board. If it does not work (very strange), then you can try building it. I use VSCode but you can install the tools standalone:

sudo apt install -y git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
git clone --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
./install.sh esp32s3
. ./export.sh
cd ..
idf.py set-target esp32s3
idf.py all

@piotr277
Copy link
Author

piotr277 commented Dec 9, 2024

Thanks. I'll try in the afternoon and let you know.

@piotr277
Copy link
Author

piotr277 commented Dec 9, 2024

Ok, so I downloaded the bin firmware from the link you provided.
Here is the flash command I used:

esptool.py -p /dev/ttyACM0 write_flash -e 0x00000 pico_fido_esp32-s3_6.0.bin

The command result was success:

esptool.py v4.8.1
Serial port /dev/ttyACM0
Connecting...
Detecting chip type... ESP32-S3
Chip is ESP32-S3 (QFN56) (revision v0.1)
Features: WiFi, BLE, Embedded Flash 4MB (XMC), Embedded PSRAM 2MB (AP_3v3)
Crystal is 40MHz
MAC: 24:ec:4a:26:88:78
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Erasing flash (this may take a while)...
Chip erase completed successfully in 14.4s
Compressed 591632 bytes to 306232...
Wrote 591632 bytes (306232 compressed) at 0x00000000 in 5.1 seconds (effective 930.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

But the final behaviour is the same - I got the same messages in dmesg:

[ 3324.767822] usb 1-2: new full-speed USB device number 18 using xhci_hcd
[ 3329.971481] usb 1-2: device descriptor read/all, error -110

and the device is not visible in lsusb :(.

@piotr277
Copy link
Author

piotr277 commented Dec 9, 2024

I also tried to build pico-fido from source

git clone https://github.com/polhenarejos/pico-fido.git
cd pico-fido
git submodule update --init --recursive
idf.py set-target esp32s3
idf.py build

but build process fails:

/home/piotr/src/esp32s/pico-fido/pico-keys-sdk/src/usb/ccid/ccid.c:138:6: error: conflicting types for 'tud_vendor_rx_cb'; have 'void(uint8_t)' {aka 'void(unsigned char)'}
  138 | void tud_vendor_rx_cb(uint8_t itf) {
      |      ^~~~~~~~~~~~~~~~
In file included from /home/piotr/src/esp32s/pico-fido/managed_components/espressif__tinyusb/src/tusb.h:100,
                 from /home/piotr/src/esp32s/pico-fido/pico-keys-sdk/src/usb/ccid/ccid.c:24:
/home/piotr/src/esp32s/pico-fido/managed_components/espressif__tinyusb/src/class/vendor/vendor_device.h:122:19: note: previous declaration of 'tud_vendor_rx_cb' with type 'void(uint8_t,  const uint8_t *, uint16_t)' {aka 'void(unsigned char,  const unsigned char *, short unsigned int)'}
  122 | TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t itf, uint8_t const* buffer, uint16_t bufsize);
      |                   ^~~~~~~~~~~~~~~~

@polhenarejos
Copy link
Owner

You have to use the development branch.

@piotr277
Copy link
Author

piotr277 commented Dec 9, 2024

Ok, build succeded. Thanks for the tip.
But result is still the same..
Here are the logs:

idf.py flash monitor
Executing action: flash
Serial port /dev/ttyACM0
Connecting...
Detecting chip type... ESP32-S3
Running ninja in directory /home/piotr/src/esp32s/pico-fido/build
Executing "ninja flash"...
[1/5] cd /home/piotr/src/esp32s/pico-fido/build/esp-idf/esptool_py && /home/piotr/.espressif...ild/partition_table/partition-table.bin /home/piotr/src/esp32s/pico-fido/build/pico_fido.bin
pico_fido.bin binary size 0x79530 bytes. Smallest app partition is 0x100000 bytes. 0x86ad0 bytes (53%) free.
[1/1] cd /home/piotr/src/esp32s/pico-fido/build/bootloader/esp-idf/esptool_py && /home/piotr...ffset 0x8000 bootloader 0x0 /home/piotr/src/esp32s/pico-fido/build/bootloader/bootloader.bin
Bootloader binary size 0x5490 bytes. 0x2b70 bytes (34%) free.
[4/5] cd /opt/esp-idf/components/esptool_py && /usr/bin/cmake -D IDF_PATH=/opt/esp-idf -D "S...piotr/src/esp32s/pico-fido/build -P /opt/esp-idf/components/esptool_py/run_serial_tool.cmake
esptool.py --chip esp32s3 -p /dev/ttyACM0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 bootloader/bootloader.bin 0x10000 pico_fido.bin 0x8000 partition_table/partition-table.bin
esptool.py v4.8.1
Serial port /dev/ttyACM0
Connecting...
Chip is ESP32-S3 (QFN56) (revision v0.1)
Features: WiFi, BLE, Embedded Flash 4MB (XMC), Embedded PSRAM 2MB (AP_3v3)
Crystal is 40MHz
MAC: 24:ec:4a:26:88:78
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00010000 to 0x00089fff...
Flash will be erased from 0x00008000 to 0x00008fff...
SHA digest in image updated
Compressed 21648 bytes to 13318...
Writing at 0x00000000... (100 %)
Wrote 21648 bytes (13318 compressed) at 0x00000000 in 0.3 seconds (effective 507.8 kbit/s)...
Hash of data verified.
Compressed 496944 bytes to 268151...
Writing at 0x00086cef... (100 %)
Wrote 496944 bytes (268151 compressed) at 0x00010000 in 4.3 seconds (effective 919.3 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 117...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (117 compressed) at 0x00008000 in 0.0 seconds (effective 605.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Executing action: monitor
Running idf_monitor in directory /home/piotr/src/esp32s/pico-fido
Executing "/home/piotr/.espressif/python_env/idf5.3_py3.12_env/bin/python /opt/esp-idf/tools/idf_monitor.py -p /dev/ttyACM0 -b 115200 --toolchain-prefix xtensa-esp32s3-elf- --decode-coredumps info --target esp32s3 --revision 0 /home/piotr/src/esp32s/pico-fido/build/pico_fido.elf -m '/home/piotr/.espressif/python_env/idf5.3_py3.12_env/bin/python' '/opt/esp-idf/tools/idf.py'"...
--- esp-idf-monitor 1.5.0 on /dev/ttyACM0 115200
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x0 (DOWNLOAD(USB/UART0))
Saved PC:0x40041a76
--- 0x40041a76: ets_delay_us in ROM

waiting for download

@polhenarejos
Copy link
Owner

Did you reset after upload? It says “waiting for download” which means it is still in DFU.

@piotr277
Copy link
Author

Yes, I did. After reset it is not discoverable in lsusb unless I put it in DFU mode.

@polhenarejos
Copy link
Owner

A bad board could be an option. The next I'd do is trying one official example from here:

https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/device/

tusb_hid is a good choice.

@piotr277
Copy link
Author

The board is ok. I've built and run examples hello_world, blink.
Following your advice I've build and flashed with tusb_hid. And it's working, here is dmesg output:

[ 8488.171866] usb 1-1: new full-speed USB device number 38 using xhci_hcd
[ 8488.794111] usb 1-1: New USB device found, idVendor=303a, idProduct=4004, bcdDevice= 1.00
[ 8488.794127] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 8488.794132] usb 1-1: Product: TinyUSB Device
[ 8488.794137] usb 1-1: Manufacturer: TinyUSB
[ 8488.794141] usb 1-1: SerialNumber: 123456
[ 8488.801159] input: TinyUSB TinyUSB Device Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:303A:4004.0008/input/input19
[ 8488.921969] input: TinyUSB TinyUSB Device Mouse as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:303A:4004.0008/input/input20
[ 8488.922107] hid-generic 0003:303A:4004.0008: input,hidraw0: USB HID v1.11 Keyboard [TinyUSB TinyUSB Device] on usb-0000:00:14.0-1/input0

The example works as intended - it moves the cursor on host machine.

@piotr277
Copy link
Author

Ok, one more observation..
I've managed to build from the source pico-hsm and flashed the board. And it is discoverable after flashing!
Here is dmesg:

[23715.798368] usb 1-2: new full-speed USB device number 81 using xhci_hcd
[23721.005924] usb 1-2: device descriptor read/all, error -110
[23721.334904] usb 1-2: new full-speed USB device number 82 using xhci_hcd
[23721.476169] usb 1-2: config 1 interface 0 altsetting 0 endpoint 0x82 has an invalid bInterval 0, changing to 10
[23721.476918] usb 1-2: New USB device found, idVendor=feff, idProduct=fcfd, bcdDevice= 7.00
[23721.476928] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[23721.476932] usb 1-2: Product: Pico Key
[23721.476935] usb 1-2: Manufacturer: Pol Henarejos
[23721.476938] usb 1-2: SerialNumber: 7888264AEC240000

and lsusb:

Bus 001 Device 082: ID feff:fcfd Pol Henarejos Pico Key

So what's wrong with pico-fido..?

@polhenarejos
Copy link
Owner

polhenarejos commented Dec 10, 2024

There’s something in the HID descriptors you OS doesn’t like.
Even with Pico HSM your OS is complaining about bInterval parameter but in this case, for whatever reason, it decides continue registering the device. For Pico-fido it decides to abort it but withou any additional information.

Which OS do you use?
Btw make sure your board blinks after reset.

Also it seems you are using a USB3 port. Try using a USB2 port.

@piotr277
Copy link
Author

Which OS do you use? Btw make sure your board blinks after reset.

Manjaro Linux kernel 6.6.63-1
I don't see any blink of LED on my board..

Also it seems you are using a USB3 port. Try using a USB2 port.

It's a pity but I don't have any USB2 port.. :(

@HeavyDutySoul
Copy link

Same there, im using ESP32-S3 Supermini at development branch on Windows10. No device after flash. Led is blinking. :)

@polhenarejos
Copy link
Owner

I spotted the problem and fixed. ESP32-S3 has two limitations:

  1. For internal reasons, it does not support more than 8 strings. Pico-fido uses 9 strings, so I decided to drop WebCCID interface string. This is just a cosmetic penalty.
  2. It does not support more than 4 IN endpoints. Pico-fido needs 5 endpoints: 1 for FIDO, 1 for OTP, 2 for CCID (1 IN and 1 INT) and 1 for WebCCID. Apparently it has not easy solution, as some of these interfaces has to be removed. I'll remove INT endpoint, meaning that CCID has only IN/OUT endpoints but not INT. It might bring some incompatibilities with Windows but I do not see other feasible solutions.

I'll push a fix today.

@piotr277
Copy link
Author

@polhenarejos keeping fingers crossed it will help :)

polhenarejos added a commit that referenced this issue Dec 11, 2024
@polhenarejos
Copy link
Owner

I pushed a fix in development. You can build yourself and try if needed.

@piotr277
Copy link
Author

@polhenarejos I've pulled the code from development branch and now the board is visible in dmesg, hurray! 😄

[14451.424028] usb 1-2: new full-speed USB device number 14 using xhci_hcd
[14456.570713] usb 1-2: device descriptor read/all, error -110
[14456.900512] usb 1-2: new full-speed USB device number 15 using xhci_hcd
[14457.042602] usb 1-2: New USB device found, idVendor=1050, idProduct=0407, bcdDevice= 7.00
[14457.042609] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[14457.042611] usb 1-2: Product: Pico Key
[14457.042613] usb 1-2: Manufacturer: Pol Henarejos
[14457.042614] usb 1-2: SerialNumber: 7888264AEC240000
[14457.047902] hid-generic 0003:1050:0407.0007: hiddev96,hidraw2: USB HID v1.11 Device [Pol Henarejos Pico Key] on usb-0000:00:14.0-2/input0
[14457.051011] input: Pol Henarejos Pico Key as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/0003:1050:0407.0008/input/input17
[14457.187251] hid-generic 0003:1050:0407.0008: input,hidraw3: USB HID v1.11 Keyboard [Pol Henarejos Pico Key] on usb-0000:00:14.0-2/input1

and in lsusb (I've commisioned it earlier via Pico Commissioner when I had pico-hsm installed):

Bus 001 Device 015: ID 1050:0407 Yubico.com Yubikey 4/5 OTP+U2F+CCID

Huge thanks @polhenarejos ! 👏 Now it's time for testing..

@piotr277
Copy link
Author

Ok.. so it's better but not perfect.. ;)
If I try to use Yubikey Personalization Tool or WebAuthn site (like webauthn.io) it enters an infinite loop of disconnect -> connect:

[15547.466402] usb 1-2: USB disconnect, device number 57
[15548.030586] usb 1-2: new full-speed USB device number 58 using xhci_hcd
[15548.172368] usb 1-2: New USB device found, idVendor=1050, idProduct=0407, bcdDevice= 7.00
[15548.172374] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[15548.172376] usb 1-2: Product: Pico Key
[15548.172377] usb 1-2: Manufacturer: Pol Henarejos
[15548.172379] usb 1-2: SerialNumber: 7888264AEC240000
[15548.176525] hid-generic 0003:1050:0407.0062: hiddev96,hidraw2: USB HID v1.11 Device [Pol Henarejos Pico Key] on usb-0000:00:14.0-2/input0
[15548.178158] input: Pol Henarejos Pico Key as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/0003:1050:0407.0063/input/input68
[15548.313914] hid-generic 0003:1050:0407.0063: input,hidraw3: USB HID v1.11 Keyboard [Pol Henarejos Pico Key] on usb-0000:00:14.0-2/input1
[15550.031539] usb 1-2: USB disconnect, device number 58
[15550.550362] usb 1-2: new full-speed USB device number 59 using xhci_hcd
[15551.171381] usb 1-2: New USB device found, idVendor=303a, idProduct=1001, bcdDevice= 1.01
[15551.171387] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[15551.171389] usb 1-2: Product: USB JTAG/serial debug unit
[15551.171391] usb 1-2: Manufacturer: Espressif
[15551.171392] usb 1-2: SerialNumber: 24:EC:4A:26:88:78
[15551.173029] cdc_acm 1-2:1.0: ttyACM0: USB ACM device
[15551.209328] usb 1-2: USB disconnect, device number 59
[15551.623709] usb 1-2: new full-speed USB device number 60 using xhci_hcd
[15551.765486] usb 1-2: New USB device found, idVendor=1050, idProduct=0407, bcdDevice= 7.00
[15551.765492] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[15551.765494] usb 1-2: Product: Pico Key
[15551.765495] usb 1-2: Manufacturer: Pol Henarejos
[15551.765497] usb 1-2: SerialNumber: 7888264AEC240000
[15551.769273] hid-generic 0003:1050:0407.0064: hiddev96,hidraw2: USB HID v1.11 Device [Pol Henarejos Pico Key] on usb-0000:00:14.0-2/input0
[15551.770612] input: Pol Henarejos Pico Key as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/0003:1050:0407.0065/input/input69
[15551.907260] hid-generic 0003:1050:0407.0065: input,hidraw3: USB HID v1.11 Keyboard [Pol Henarejos Pico Key] on usb-0000:00:14.0-2/input1
[15554.456223] usb 1-2: USB disconnect, device number 60
[15555.046856] usb 1-2: new full-speed USB device number 61 using xhci_hcd
[15555.188826] usb 1-2: New USB device found, idVendor=1050, idProduct=0407, bcdDevice= 7.00
[15555.188831] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[15555.188834] usb 1-2: Product: Pico Key
[15555.188835] usb 1-2: Manufacturer: Pol Henarejos
[15555.188836] usb 1-2: SerialNumber: 7888264AEC240000
[15555.192928] hid-generic 0003:1050:0407.0066: hiddev96,hidraw2: USB HID v1.11 Device [Pol Henarejos Pico Key] on usb-0000:00:14.0-2/input0
[15555.194205] input: Pol Henarejos Pico Key as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/0003:1050:0407.0067/input/input70
[15555.327049] hid-generic 0003:1050:0407.0067: input,hidraw3: USB HID v1.11 Keyboard [Pol Henarejos Pico Key] on usb-0000:00:14.0-2/input1
[15557.799033] usb 1-2: USB disconnect, device number 61

@HeavyDutySoul
Copy link

HeavyDutySoul commented Dec 18, 2024

Rebuilt from the development branch and tried to install the pin in ykman under Linux. In this time I get a coredump.
`===============================================================
==================== ESP32 CORE DUMP START ====================

Crashed task handle: 0x3fcecff8, name: 'TinyUSB', GDB name: 'process 1070518264'
Crashed task is not in the interrupt context
Panic reason: ERROR A stack overflow in task TinyUSB has been detected.

================== CURRENT THREAD REGISTERS ===================
exccause 0x0 (IllegalInstructionCause)
excvaddr 0x0
epc1 0x40378e0b
epc2 0x0
epc3 0x0
epc4 0x0
epc5 0x0
epc6 0x0
eps2 0x0
eps3 0x0
eps4 0x0
eps5 0x0
eps6 0x0
pc 0x40375b24 0x40375b24 <panic_abort+16>
lbeg 0x400570e8 1074098408
lend 0x400570f3 1074098419
lcount 0x0 0
sar 0x1c 28
ps 0x60023 393251
threadptr
br
scompare1
acclo
acchi
m0
m1
m2
m3
expstate
f64r_lo
f64r_hi
f64s
fcr
fsr
a0 0x8037a9e0 -2143835680
a1 0x3fcebf70 1070514032
a2 0x3fcebfbc 1070514108
a3 0x3fcebffb 1070514171
a4 0x3fcec1a0 1070514592
a5 0x3fcec180 1070514560
a6 0x3fce9710 1070503696
a7 0x44 68
a8 0x3fc970e0 1070166240
a9 0x1 1
a10 0x44 68
a11 0x804 2052
a12 0x3fcec180 1070514560
a13 0x3fcec160 1070514528
a14 0x3fced9e0 1070520800
a15 0x44 68

==================== CURRENT THREAD STACK =====================
#0 panic_abort (details=0x3fcebfbc "ERROR A stack overflow in task TinyUSB has been detected.") at /opt/esp-idf/components/esp_system/panic.c:466
#1 0x4037a9e0 in esp_system_abort (details=0x3fcebfbc "ERROR A stack overflow in task TinyUSB has been detected.") at /opt/esp-idf/components/esp_system/port/esp_system_chip.c:92
#2 0x4037b88d in vApplicationStackOverflowHook (xTask=0x3fcecff8, pcTaskName=0x3fced02c "TinyUSB") at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:563
#3 0x4037ccd2 in vTaskSwitchContext () at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:3701
#4 0x4037b953 in _frxt_dispatch () at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:451
Backtrace stopped: Cannot access memory at address 0xa5a5a599

======================== THREADS INFO =========================
Id Target Id Frame

  • 1 process 1070518264 panic_abort (details=0x3fcebfbc "ERROR A stack overflow in task TinyUSB has been detected.") at /opt/esp-idf/components/esp_system/panic.c:466
    2 process 1070247116 0x400559e0 in ?? ()
    3 process 1070518620 0x400559e0 in ?? ()
    4 process 1070255820 0x40378e06 in esp_cpu_wait_for_intr () at /opt/esp-idf/components/esp_hw_support/cpu.c:64
    5 process 1070253924 0x40378e06 in esp_cpu_wait_for_intr () at /opt/esp-idf/components/esp_hw_support/cpu.c:64
    6 process 1070245476 0x400559e0 in ?? ()
    7 process 1070512540 0x20000000 in ?? ()

     TCB             NAME PRIO C/B  STACK USED/FREE
    

0x3fcecff8 TinyUSB 5/5 4000/92
0x3fcaaccc ipc1 24/24 656/616
0x3fced15c core0 4/4 848/19624
0x3fcacecc IDLE1 0/0 640/888
0x3fcac764 IDLE0 0/0 640/880
0x3fcaa664 ipc0 24/24 656/608
0x3fceb99c Corrupted TCB data

==================== THREAD 1 (TCB: 0x3fcecff8, name: 'TinyUSB') =====================
#0 panic_abort (details=0x3fcebfbc "ERROR A stack overflow in task TinyUSB has been detected.") at /opt/esp-idf/components/esp_system/panic.c:466
#1 0x4037a9e0 in esp_system_abort (details=0x3fcebfbc "ERROR A stack overflow in task TinyUSB has been detected.") at /opt/esp-idf/components/esp_system/port/esp_system_chip.c:92
#2 0x4037b88d in vApplicationStackOverflowHook (xTask=0x3fcecff8, pcTaskName=0x3fced02c "TinyUSB") at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:563
#3 0x4037ccd2 in vTaskSwitchContext () at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:3701
#4 0x4037b953 in _frxt_dispatch () at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:451
Backtrace stopped: Cannot access memory at address 0xa5a5a599

==================== THREAD 2 (TCB: 0x3fcaaccc, name: 'ipc1') =====================
#0 0x400559e0 in ?? ()
#1 0x4037b841 in vPortClearInterruptMaskFromISR (prev_level=) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:560
#2 vPortExitCritical (mux=0x3fc93cf0 ) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:514
#3 0x4037d9e4 in ulTaskGenericNotifyTake (uxIndexToWait=0, xClearCountOnExit=1, xTicksToWait=) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:5765
#4 0x40375ecc in ipc_task (arg=0x1) at /opt/esp-idf/components/esp_system/esp_ipc.c:62
#5 0x4037b4a8 in vPortTaskWrapper (pxCode=0x40375ea0 <ipc_task>, pvParameters=0x1) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

==================== THREAD 3 (TCB: 0x3fced15c, name: 'core0') =====================
#0 0x400559e0 in ?? ()
Backtrace stopped: Cannot access memory at address 0x60017

==================== THREAD 4 (TCB: 0x3fcacecc, name: 'IDLE1') =====================
#0 0x40378e06 in esp_cpu_wait_for_intr () at /opt/esp-idf/components/esp_hw_support/cpu.c:64
#1 0x420052b5 in esp_vApplicationIdleHook () at /opt/esp-idf/components/esp_system/freertos_hooks.c:58
#2 0x4037c4d8 in prvIdleTask (pvParameters=0x0) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:4353
#3 0x4037b4a8 in vPortTaskWrapper (pxCode=0x4037c4cc , pvParameters=0x0) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

==================== THREAD 5 (TCB: 0x3fcac764, name: 'IDLE0') =====================
#0 0x40378e06 in esp_cpu_wait_for_intr () at /opt/esp-idf/components/esp_hw_support/cpu.c:64
#1 0x420052b5 in esp_vApplicationIdleHook () at /opt/esp-idf/components/esp_system/freertos_hooks.c:58
#2 0x4037c4d8 in prvIdleTask (pvParameters=0x0) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:4353
#3 0x4037b4a8 in vPortTaskWrapper (pxCode=0x4037c4cc , pvParameters=0x0) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

==================== THREAD 6 (TCB: 0x3fcaa664, name: 'ipc0') =====================
#0 0x400559e0 in ?? ()
#1 0x4037b841 in vPortClearInterruptMaskFromISR (prev_level=) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:560
#2 vPortExitCritical (mux=0x3fc93cf0 ) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:514
#3 0x4037d9e4 in ulTaskGenericNotifyTake (uxIndexToWait=0, xClearCountOnExit=1, xTicksToWait=) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:5765
#4 0x40375ecc in ipc_task (arg=0x0) at /opt/esp-idf/components/esp_system/esp_ipc.c:62
#5 0x4037b4a8 in vPortTaskWrapper (pxCode=0x40375ea0 <ipc_task>, pvParameters=0x0) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

==================== THREAD 7 (TCB: 0x3fceb99c, name: '') =====================
#0 0x20000000 in ?? ()

======================= ALL MEMORY REGIONS ========================
Name Address Size Attrs
.rtc.text 0x600fe000 0x0 RW
.rtc.force_fast 0x600fe000 0x1c RW A
.rtc_noinit 0x50000000 0x0 RW
.rtc.force_slow 0x50000000 0x0 RW
.iram0.vectors 0x40374000 0x404 R XA
.iram0.text 0x40374404 0xf603 R XA
.dram0.data 0x3fc93b00 0x342c RW A
.flash.text 0x42000020 0x4dfda R XA
.flash.appdesc 0x3c050020 0x100 R A
.flash.rodata 0x3c050120 0x176d8 RW A
.iram0.data 0x40383b00 0x0 RW
.iram0.bss 0x40383b00 0x0 RW
.dram0.heap_start 0x3fca9700 0x0 RW
.coredump.tasks.data 0x3fcaaccc 0x154 RW
.coredump.tasks.data 0x3fcaaa30 0x290 RW
.coredump.tasks.data 0x3fcecff8 0x154 RW
.coredump.tasks.data 0x3fcebeb0 0x1140 RW
.coredump.tasks.data 0x3fced15c 0x154 RW
.coredump.tasks.data 0x3fcb1de0 0x350 RW
.coredump.tasks.data 0x3fcacecc 0x154 RW
.coredump.tasks.data 0x3fcacc40 0x280 RW
.coredump.tasks.data 0x3fcac764 0x154 RW
.coredump.tasks.data 0x3fcac4d0 0x280 RW
.coredump.tasks.data 0x3fcaa664 0x154 RW
.coredump.tasks.data 0x3fcaa3c0 0x290 RW
.coredump.tasks.data 0x3fceb99c 0x154 RW
.coredump.tasks.data 0x20000000 0x70 RW

===================== ESP32 CORE DUMP END =====================

Done!`

@polhenarejos
Copy link
Owner

Unfortunately it doesn’t show anything meaningful. Can you cmake with -DCMAKE_BUILD_TYPE=Debug and build it again?

@HeavyDutySoul
Copy link

All the same...
`===============================================================
==================== ESP32 CORE DUMP START ====================

Crashed task handle: 0x3fcecff8, name: 'TinyUSB', GDB name: 'process 1070518264'
Crashed task is not in the interrupt context
Panic reason: ERROR A stack overflow in task TinyUSB has been detected.

================== CURRENT THREAD REGISTERS ===================
exccause 0x0 (IllegalInstructionCause)
excvaddr 0x0
epc1 0x40378e0b
epc2 0x0
epc3 0x0
epc4 0x0
epc5 0x0
epc6 0x0
eps2 0x0
eps3 0x0
eps4 0x0
eps5 0x0
eps6 0x0
pc 0x40375b24 0x40375b24 <panic_abort+16>
lbeg 0x400570e8 1074098408
lend 0x400570f3 1074098419
lcount 0x0 0
sar 0x1f 31
ps 0x60023 393251
threadptr
br
scompare1
acclo
acchi
m0
m1
m2
m3
expstate
f64r_lo
f64r_hi
f64s
fcr
fsr
a0 0x8037a9e0 -2143835680
a1 0x3fcebf70 1070514032
a2 0x3fcebfbc 1070514108
a3 0x3fcebffb 1070514171
a4 0x3fcec1b0 1070514608
a5 0x3fcec190 1070514576
a6 0x3fcec4f0 1070515440
a7 0x3fcec210 1070514704
a8 0x3fc970e0 1070166240
a9 0x1 1
a10 0x3fcec4f4 1070515444
a11 0x3fcec4f0 1070515440
a12 0x3fcec190 1070514576
a13 0x3fcec170 1070514544
a14 0x3fcec210 1070514704
a15 0x3fcec558 1070515544

==================== CURRENT THREAD STACK =====================
#0 panic_abort (details=0x3fcebfbc "ERROR A stack overflow in task TinyUSB has been detected.") at /opt/esp-idf/components/esp_system/panic.c:466
#1 0x4037a9e0 in esp_system_abort (details=0x3fcebfbc "ERROR A stack overflow in task TinyUSB has been detected.") at /opt/esp-idf/components/esp_system/port/esp_system_chip.c:92
#2 0x4037b88d in vApplicationStackOverflowHook (xTask=0x3fcecff8, pcTaskName=0x3fced02c "TinyUSB") at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:563
#3 0x4037ccd2 in vTaskSwitchContext () at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:3701
#4 0x4037b953 in _frxt_dispatch () at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:451
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

======================== THREADS INFO =========================
Id Target Id Frame

  • 1 process 1070518264 panic_abort (details=0x3fcebfbc "ERROR A stack overflow in task TinyUSB has been detected.") at /opt/esp-idf/components/esp_system/panic.c:466
    2 process 1070247116 0x400559e0 in ?? ()
    3 process 1070518620 0x400559e0 in ?? ()
    4 process 1070255820 0x40378e06 in esp_cpu_wait_for_intr () at /opt/esp-idf/components/esp_hw_support/cpu.c:64
    5 process 1070253924 0x40378e06 in esp_cpu_wait_for_intr () at /opt/esp-idf/components/esp_hw_support/cpu.c:64
    6 process 1070245476 0x400559e0 in ?? ()
    7 process 1070512540 0x20000000 in ?? ()

     TCB             NAME PRIO C/B  STACK USED/FREE
    

0x3fcecff8 TinyUSB 5/5 4000/92
0x3fcaaccc ipc1 24/24 656/616
0x3fced15c core0 4/4 848/19624
0x3fcacecc IDLE1 0/0 640/888
0x3fcac764 IDLE0 0/0 640/880
0x3fcaa664 ipc0 24/24 656/608
0x3fceb99c Corrupted TCB data

==================== THREAD 1 (TCB: 0x3fcecff8, name: 'TinyUSB') =====================
#0 panic_abort (details=0x3fcebfbc "ERROR A stack overflow in task TinyUSB has been detected.") at /opt/esp-idf/components/esp_system/panic.c:466
#1 0x4037a9e0 in esp_system_abort (details=0x3fcebfbc "ERROR A stack overflow in task TinyUSB has been detected.") at /opt/esp-idf/components/esp_system/port/esp_system_chip.c:92
#2 0x4037b88d in vApplicationStackOverflowHook (xTask=0x3fcecff8, pcTaskName=0x3fced02c "TinyUSB") at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:563
#3 0x4037ccd2 in vTaskSwitchContext () at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:3701
#4 0x4037b953 in _frxt_dispatch () at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:451
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

==================== THREAD 2 (TCB: 0x3fcaaccc, name: 'ipc1') =====================
#0 0x400559e0 in ?? ()
#1 0x4037b841 in vPortClearInterruptMaskFromISR (prev_level=) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:560
#2 vPortExitCritical (mux=0x3fc93cf0 ) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:514
#3 0x4037d9e4 in ulTaskGenericNotifyTake (uxIndexToWait=0, xClearCountOnExit=1, xTicksToWait=) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:5765
#4 0x40375ecc in ipc_task (arg=0x1) at /opt/esp-idf/components/esp_system/esp_ipc.c:62
#5 0x4037b4a8 in vPortTaskWrapper (pxCode=0x40375ea0 <ipc_task>, pvParameters=0x1) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

==================== THREAD 3 (TCB: 0x3fced15c, name: 'core0') =====================
#0 0x400559e0 in ?? ()
Backtrace stopped: Cannot access memory at address 0x60217

==================== THREAD 4 (TCB: 0x3fcacecc, name: 'IDLE1') =====================
#0 0x40378e06 in esp_cpu_wait_for_intr () at /opt/esp-idf/components/esp_hw_support/cpu.c:64
#1 0x420052b5 in esp_vApplicationIdleHook () at /opt/esp-idf/components/esp_system/freertos_hooks.c:58
#2 0x4037c4d8 in prvIdleTask (pvParameters=0x0) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:4353
#3 0x4037b4a8 in vPortTaskWrapper (pxCode=0x4037c4cc , pvParameters=0x0) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

==================== THREAD 5 (TCB: 0x3fcac764, name: 'IDLE0') =====================
#0 0x40378e06 in esp_cpu_wait_for_intr () at /opt/esp-idf/components/esp_hw_support/cpu.c:64
#1 0x420052b5 in esp_vApplicationIdleHook () at /opt/esp-idf/components/esp_system/freertos_hooks.c:58
#2 0x4037c4d8 in prvIdleTask (pvParameters=0x0) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:4353
#3 0x4037b4a8 in vPortTaskWrapper (pxCode=0x4037c4cc , pvParameters=0x0) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

==================== THREAD 6 (TCB: 0x3fcaa664, name: 'ipc0') =====================
#0 0x400559e0 in ?? ()
#1 0x4037b841 in vPortClearInterruptMaskFromISR (prev_level=) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:560
#2 vPortExitCritical (mux=0x3fc93cf0 ) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:514
#3 0x4037d9e4 in ulTaskGenericNotifyTake (uxIndexToWait=0, xClearCountOnExit=1, xTicksToWait=) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:5765
#4 0x40375ecc in ipc_task (arg=0x0) at /opt/esp-idf/components/esp_system/esp_ipc.c:62
#5 0x4037b4a8 in vPortTaskWrapper (pxCode=0x40375ea0 <ipc_task>, pvParameters=0x0) at /opt/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

==================== THREAD 7 (TCB: 0x3fceb99c, name: '') =====================
#0 0x20000000 in ?? ()

======================= ALL MEMORY REGIONS ========================
Name Address Size Attrs
.rtc.text 0x600fe000 0x0 RW
.rtc.force_fast 0x600fe000 0x1c RW A
.rtc_noinit 0x50000000 0x0 RW
.rtc.force_slow 0x50000000 0x0 RW
.iram0.vectors 0x40374000 0x404 R XA
.iram0.text 0x40374404 0xf603 R XA
.dram0.data 0x3fc93b00 0x342c RW A
.flash.text 0x42000020 0x4dfda R XA
.flash.appdesc 0x3c050020 0x100 R A
.flash.rodata 0x3c050120 0x176d8 RW A
.iram0.data 0x40383b00 0x0 RW
.iram0.bss 0x40383b00 0x0 RW
.dram0.heap_start 0x3fca9700 0x0 RW
.coredump.tasks.data 0x3fcaaccc 0x154 RW
.coredump.tasks.data 0x3fcaaa30 0x290 RW
.coredump.tasks.data 0x3fcecff8 0x154 RW
.coredump.tasks.data 0x3fcebeb0 0x1140 RW
.coredump.tasks.data 0x3fced15c 0x154 RW
.coredump.tasks.data 0x3fcb1de0 0x350 RW
.coredump.tasks.data 0x3fcacecc 0x154 RW
.coredump.tasks.data 0x3fcacc40 0x280 RW
.coredump.tasks.data 0x3fcac764 0x154 RW
.coredump.tasks.data 0x3fcac4d0 0x280 RW
.coredump.tasks.data 0x3fcaa664 0x154 RW
.coredump.tasks.data 0x3fcaa3c0 0x290 RW
.coredump.tasks.data 0x3fceb99c 0x154 RW
.coredump.tasks.data 0x20000000 0x70 RW

===================== ESP32 CORE DUMP END =====================

Done!`

@polhenarejos
Copy link
Owner

core0 is where pico-fido code resides and strangely it is not displayed.

What do you do to reproduce it?

@HeavyDutySoul
Copy link

I just tried to set the pin right after reflashing: ykman fido access change-pin -n 111111 Previously, webauthn.io offered to set the pin in the browser, now it doesn't. I've reflashed the device several times already.

@polhenarejos
Copy link
Owner

Reflashing doesn’t clear user space. If set a pin, it is still present. To clean you have to call esptool.py erase_flash and then flash.

@HeavyDutySoul
Copy link

I'm always erase flash before reflashing.

@HeavyDutySoul
Copy link

Crashed task handle: 0x3fcecff8, name: 'TinyUSB', GDB name: 'process 1070518264'
Why task handle and process name in coredump's the same? It is normal?

@polhenarejos
Copy link
Owner

What do you mean?

@polhenarejos
Copy link
Owner

@a1bert01
Copy link

development branch coredump when:

ssh-keygen -t ecdsa-sk -C "descr"

coredump.txt.gz

@polhenarejos
Copy link
Owner

Did you increase the stack size ?

@a1bert01
Copy link

a1bert01 commented Dec 19, 2024

previous coredump was with 4096*5, but looks the same with:

diff -u3 pico-keys-sdk/src/main.c~ pico-keys-sdk/src/main.c
--- pico-keys-sdk/src/main.c~	2024-12-18 19:13:51.000000000 +0100
+++ pico-keys-sdk/src/main.c	2024-12-20 00:18:52.518624493 +0100
@@ -332,7 +332,7 @@
 #endif
 
 #ifdef ESP_PLATFORM
-    xTaskCreatePinnedToCore(core0_loop, "core0", 4096*5, NULL, CONFIG_TINYUSB_TASK_PRIORITY - 1, &hcore0, 0);
+    xTaskCreatePinnedToCore(core0_loop, "core0", 4096*10, NULL, CONFIG_TINYUSB_TASK_PRIORITY - 1, &hcore0, 0);
 #else
     core0_loop();
 #endif

coredump.txt.gz

@polhenarejos
Copy link
Owner

coredumps to UART have to be decoded by yourself, as it depends on the hash of the build and mine and yours differ. Please paste the result of
idf.py coredump-info -c coredump.txt

@a1bert01
Copy link

c.txt.gz

@HeavyDutySoul
Copy link

HeavyDutySoul commented Dec 20, 2024

Did you increase the stack size ?

I tried with a larger stack size, the coredump output did not change. Now the device does not work at all after reflashing in Linux, when trying to set the pin code in Chromium, the LED blinks orange and green in turn and nothing happens. I managed several times to set pin in Chrome at Windows, after that the device works fine in both Linux and Windows.

@a1bert01
Copy link

Are we increasing the right stack?? IMO stack overflow happens in "TinyUSB" Thread, but we are increasing "core0" stack

       TCB             NAME PRIO C/B  STACK USED/FREE
---------- ---------------- -------- ----------------
0x3fcb09a8          TinyUSB      5/5         3888/204
0x3fcaafe8             ipc1    24/24          656/620
0x3fcc4b04            core0      4/4        832/81072   <---------------------
0x3fcad01c            IDLE1      0/0          640/888
0x3fcac8c0            IDLE0      0/0          640/884
0x3fcaa98c             ipc0    24/24          656/616
0x3fcaf238         neopixel    24/24          704/316


       TCB             NAME PRIO C/B  STACK USED/FREE
---------- ---------------- -------- ----------------
0x3fcb09a8          TinyUSB      5/5          4112/20
0x3fcaafe8             ipc1    24/24          656/620
0x3fcbab04            core0      4/4        832/40112  <------------------------------
0x3fcad01c            IDLE1      0/0          640/888
0x3fcac8c0            IDLE0      0/0          640/884
0x3fcaa98c             ipc0    24/24          656/616
0x3fcaf238         neopixel    24/24          704/316

@polhenarejos
Copy link
Owner

polhenarejos commented Dec 20, 2024

Yes, I think it is more likely an stack overflow in my code rather than in TinyUSB.

You can try increase the stack of TinyUSB by adding

CONFIG_TINYUSB_TASK_STACK_SIZE=16384

to pico-fido/sdkconfig.defaults. Be sure you remove pico-fido/sdkconfig first before building.

@HeavyDutySoul
Copy link

CONFIG_TINYUSB_TASK_STACK_SIZE=16384

It's work :)

@a1bert01
Copy link

looks better ;)


set_report 0 0 2
command 6
len 8
SCAN
KEY DEVICE is empty. Generating SECP256R1 curve... done!
SCAN
[fbfc0] scan fid cc00, len 32
[fbdeb] scan fid ce00, len 457
[fbddb] scan fid c000, len 4
[fbdaf] scan fid 1090, len 32
[fbd92] scan fid 1101, len 17
set_report 0 0 2
command 10
len 1
set_report 0 0 2
command 10
len 143
set_report 0 0 2
set_report 0 0 2
set_report 0 0 2
command 11
len 0

@HeavyDutySoul
Copy link

Is there any hope that someday will be an eddsa firmware for esp32?

@polhenarejos
Copy link
Owner

Great! Can you check whether CONFIG_TINYUSB_TASK_STACK_SIZE=6144 still works? I'd like to narrow the size as much as possible.

@HeavyDutySoul
Copy link

HeavyDutySoul commented Dec 20, 2024

CONFIG_TINYUSB_TASK_STACK_SIZE=6144

Nope. But I tried with unmodified main.c

@polhenarejos
Copy link
Owner

Which value do you think does it work?

@HeavyDutySoul
Copy link

Which value do you think does it work?

I'm not a coder, but 8192 is work...

@a1bert01
Copy link

6144 is OK here

@HeavyDutySoul
Copy link

HeavyDutySoul commented Dec 20, 2024

How it is possible? My device ESP32 S3 Super Mini
Detecting chip type... ESP32-S3
Chip is ESP32-S3 (QFN56) (revision v0.2)
Features: WiFi, BLE, Embedded Flash 4MB (XMC), Embedded PSRAM 2MB (AP_3v3)
Crystal is 40MHz

@polhenarejos
Copy link
Owner

It is strange. The chipset and memory are the same, defined by the MCU ESP32-S3. Perhaps there's something broken in my code that overflows randomly affecting TinyUSB's stack.

@HeavyDutySoul
Copy link

Or someone flashed the old binary, I tried several times... 7168 also works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants