waveshare rp2350-one initialize failed #105

Open
opened 2025-08-23 11:05:51 +08:00 by freeskyflying · 6 comments

I purchased three Waveshare RP2350-One hardware units and used them to flash the firmware for Pico-HSM and Pico-Fido. I encountered similar issues across all of them.

1.I was unable to configure them via the web-based Pico-Commissioner. The responses appeared error-free, but I tested this on both Edge and Chrome with the same result.

Image

2.I tried using pico-hsm-tool.py initialize on both Windows and macOS, but encountered the same issue:

"Pico HSM Tool v2.4
Author: Pol Henarejos
Report bugs to https://github.com/polhenarejos/pico-hsm/issues
Traceback (most recent call last):
File "C:\Users\frees\Desktop\tmp\pico-hsm-tool.py", line 643, in
run()
~~~^^
File "C:\Users\frees\Desktop\tmp\pico-hsm-tool.py", line 640, in run
main(args)
~~~~^^^^^^
File "C:\Users\frees\Desktop\tmp\pico-hsm-tool.py", line 607, in main
picohsm = PicoHSM(args.pin, slot=args.slot)
File "C:\Users\frees\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\picohsm\PicoHSM.py", line 225, in init
self.__card.connect()
~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\frees\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\smartcard\CardConnectionDecorator.py", line 52, in connect
self.component.connect(protocol, mode, disposition)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\frees\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\smartcard\pcsc\PCSCCardConnection.py", line 159, in connect
raise CardConnectionException("Context already released")
smartcard.Exceptions.CardConnectionException: Context already released

3.I attempted to patch the firmware for a specific ID via the website. For Pico-Fido, version 6.4 worked, but for Pico-HSM, none of the patched UF2 files were accepted
4.Output from .\pkcs11-tool.exe -L:

Available slots:
Slot 0 (0x0): Pol Henarejos Pico Key HID Interface 0
token label :
token manufacturer :
token model : PKCS#15
token flags : rng, token initialized
hardware version : 24.13
firmware version : 5.6
serial num :
pin min/max : 4/8
uri : pkcs11:model=PKCS%2315;manufacturer=;serial=;token=

Is there anyone who can offer some assistance with this?

I purchased three Waveshare RP2350-One hardware units and used them to flash the firmware for Pico-HSM and Pico-Fido. I encountered similar issues across all of them. 1.I was unable to configure them via the web-based Pico-Commissioner. The responses appeared error-free, but I tested this on both Edge and Chrome with the same result. <img width="408" height="648" alt="Image" src="https://github.com/user-attachments/assets/c63bd9be-ddb4-427a-a921-36e660a8f594" /> 2.I tried using pico-hsm-tool.py initialize on both Windows and macOS, but encountered the same issue: > "Pico HSM Tool v2.4 Author: Pol Henarejos Report bugs to https://github.com/polhenarejos/pico-hsm/issues Traceback (most recent call last): File "C:\Users\frees\Desktop\tmp\pico-hsm-tool.py", line 643, in <module> run() ~~~^^ File "C:\Users\frees\Desktop\tmp\pico-hsm-tool.py", line 640, in run main(args) ~~~~^^^^^^ File "C:\Users\frees\Desktop\tmp\pico-hsm-tool.py", line 607, in main picohsm = PicoHSM(args.pin, slot=args.slot) File "C:\Users\frees\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\picohsm\PicoHSM.py", line 225, in __init__ self.__card.connect() ~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\frees\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\smartcard\CardConnectionDecorator.py", line 52, in connect self.component.connect(protocol, mode, disposition) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\frees\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\smartcard\pcsc\PCSCCardConnection.py", line 159, in connect raise CardConnectionException("Context already released") smartcard.Exceptions.CardConnectionException: Context already released 3.I attempted to patch the firmware for a specific ID via the website. For Pico-Fido, version 6.4 worked, but for Pico-HSM, none of the patched UF2 files were accepted 4.Output from .\pkcs11-tool.exe -L: > Available slots: Slot 0 (0x0): Pol Henarejos Pico Key HID Interface 0 token label : token manufacturer : token model : PKCS#15 token flags : rng, token initialized hardware version : 24.13 firmware version : 5.6 serial num : pin min/max : 4/8 uri : pkcs11:model=PKCS%2315;manufacturer=;serial=;token= Is there anyone who can offer some assistance with this?

same problem:

(base) ➜  pico-hsm git:(master) ✗ python3 tools/pico-hsm-tool.py --pin 648219 initialize --so-pin 57621880
Pico HSM Tool v2.4
Author: Pol Henarejos
Report bugs to https://github.com/polhenarejos/pico-hsm/issues


Traceback (most recent call last):
  File "/Users/test/develop/rpi-pico/pico-hsm/tools/pico-hsm-tool.py", line 642, in <module>
    run()
    ~~~^^
  File "/Users/test/develop/rpi-pico/pico-hsm/tools/pico-hsm-tool.py", line 639, in run
    main(args)
    ~~~~^^^^^^
  File "/Users/test/develop/rpi-pico/pico-hsm/tools/pico-hsm-tool.py", line 607, in main
    picohsm = PicoHSM(args.pin, slot=args.slot)
  File "/opt/homebrew/anaconda3/lib/python3.13/site-packages/picohsm/PicoHSM.py", line 225, in __init__
    self.__card.connect()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/anaconda3/lib/python3.13/site-packages/smartcard/CardConnectionDecorator.py", line 52, in connect
    self.component.connect(protocol, mode, disposition)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/lib/python3.13/site-packages/smartcard/pcsc/PCSCCardConnection.py", line 159, in connect
    raise CardConnectionException("Context already released")
smartcard.Exceptions.CardConnectionException: Context already released
(base) ➜  pico-hsm git:(master) ✗
same problem: ``` (base) ➜ pico-hsm git:(master) ✗ python3 tools/pico-hsm-tool.py --pin 648219 initialize --so-pin 57621880 Pico HSM Tool v2.4 Author: Pol Henarejos Report bugs to https://github.com/polhenarejos/pico-hsm/issues Traceback (most recent call last): File "/Users/test/develop/rpi-pico/pico-hsm/tools/pico-hsm-tool.py", line 642, in <module> run() ~~~^^ File "/Users/test/develop/rpi-pico/pico-hsm/tools/pico-hsm-tool.py", line 639, in run main(args) ~~~~^^^^^^ File "/Users/test/develop/rpi-pico/pico-hsm/tools/pico-hsm-tool.py", line 607, in main picohsm = PicoHSM(args.pin, slot=args.slot) File "/opt/homebrew/anaconda3/lib/python3.13/site-packages/picohsm/PicoHSM.py", line 225, in __init__ self.__card.connect() ~~~~~~~~~~~~~~~~~~~^^ File "/opt/homebrew/anaconda3/lib/python3.13/site-packages/smartcard/CardConnectionDecorator.py", line 52, in connect self.component.connect(protocol, mode, disposition) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/anaconda3/lib/python3.13/site-packages/smartcard/pcsc/PCSCCardConnection.py", line 159, in connect raise CardConnectionException("Context already released") smartcard.Exceptions.CardConnectionException: Context already released (base) ➜ pico-hsm git:(master) ✗ ```

Please try to use pyscard at version 2.2.1, for me it worked fine.

pip3 install --upgrade pyscard==2.2.1
Please try to use `pyscard` at version 2.2.1, for me it worked fine. ```bash pip3 install --upgrade pyscard==2.2.1 ```

Hi @pejotes thanks for the hint ... it seems to make things better, but still does not work:

C:\Temp\tests\pico\pico-hsm\tools>python pico-hsm-tool.py --pin 648219 initialize --so-pin 57621880
Pico HSM Tool v2.4
Author: Pol Henarejos
Report bugs to https://github.com/polhenarejos/pico-hsm/issues


  • PLEASE READ IT CAREFULLY *

This tool will erase and reset your device. It will delete all private and secret keys.
Are you sure?
[Press enter to confirm]
Public Point: 04b870e8dc4003897607a2a6227f1343be7fdeb177bd7645b277f63b189a74ddafc87daebeb3f7f97d11e05ecc5cc989904c317b9f131e24be7bcf2a21d3ce35ca
Traceback (most recent call last):
File "C:\Temp\tests\pico\pico-hsm\tools\pico-hsm-tool.py", line 642, in
run()
File "C:\Temp\tests\pico\pico-hsm\tools\pico-hsm-tool.py", line 639, in run
main(args)
File "C:\Temp\tests\pico\pico-hsm\tools\pico-hsm-tool.py", line 611, in main
initialize(picohsm, args)
File "C:\Temp\tests\pico\pico-hsm\tools\pico-hsm-tool.py", line 253, in initialize
if (picohsm.platform in (Platform.RP2350, Platform.ESP32, Platform.EMULATION)):
^^^^^^^^^^^^^^^^
AttributeError: 'PicoHSM' object has no attribute 'platform'

(I'm on Windows 11, PicoHSM on a Waveshare ESP32-S3 Mini).

Any further hints? Ideas?

Thanks!

Hi @pejotes thanks for the hint ... it seems to make things better, but still does not work: > C:\Temp\tests\pico\pico-hsm\tools>python pico-hsm-tool.py --pin 648219 initialize --so-pin 57621880 > Pico HSM Tool v2.4 > Author: Pol Henarejos > Report bugs to https://github.com/polhenarejos/pico-hsm/issues > > > ******************************** > * PLEASE READ IT CAREFULLY * > ******************************** > > This tool will erase and reset your device. It will delete all private and secret keys. > Are you sure? > [Press enter to confirm] > Public Point: 04b870e8dc4003897607a2a6227f1343be7fdeb177bd7645b277f63b189a74ddafc87daebeb3f7f97d11e05ecc5cc989904c317b9f131e24be7bcf2a21d3ce35ca > Traceback (most recent call last): > File "C:\Temp\tests\pico\pico-hsm\tools\pico-hsm-tool.py", line 642, in <module> > run() > File "C:\Temp\tests\pico\pico-hsm\tools\pico-hsm-tool.py", line 639, in run > main(args) > File "C:\Temp\tests\pico\pico-hsm\tools\pico-hsm-tool.py", line 611, in main > initialize(picohsm, args) > File "C:\Temp\tests\pico\pico-hsm\tools\pico-hsm-tool.py", line 253, in initialize > if (picohsm.platform in (Platform.RP2350, Platform.ESP32, Platform.EMULATION)): > ^^^^^^^^^^^^^^^^ > AttributeError: 'PicoHSM' object has no attribute 'platform' (I'm on Windows 11, PicoHSM on a Waveshare ESP32-S3 Mini). Any further hints? Ideas? Thanks!

Try using latest commit of https://github.com/polhenarejos/pypicohsm

Try using latest commit of https://github.com/polhenarejos/pypicohsm

Thanks for the quick response ... But does not change anything. It seems pico-hsm-tool.py does not fit to pyicohsm.

(Installed pip install git+https://github.com/polhenarejos/pypicohsm.git@ff9cf9381bbafb417b1318a5911f00296affe31a - which seems to be 1.7).

Thanks for the quick response ... But does not change anything. It seems pico-hsm-tool.py does not fit to pyicohsm. (Installed pip install git+https://github.com/polhenarejos/pypicohsm.git@ff9cf9381bbafb417b1318a5911f00296affe31a - which seems to be 1.7).

I encountered the same issue (Context already released), on Ubunt and Win11.

modify the line 224 in PicoHSM.py
self.__card = cardrequest.waitforcard().connection

to
`self.__card_service = cardrequest.waitforcard()

self.__card = self.__card_service.connection
`

seems to fix the issue. I guess the main cause is that card_service is auto released by python if it's not referenced, maybe releated to python version.

I encountered the same issue (Context already released), on Ubunt and Win11. modify the line 224 in PicoHSM.py ` self.__card = cardrequest.waitforcard().connection ` to `self.__card_service = cardrequest.waitforcard() self.__card = self.__card_service.connection ` seems to fix the issue. I guess the main cause is that card_service is auto released by python if it's not referenced, maybe releated to python version.
Sign in to join this conversation.