0

This is my first RPi Pico experiment, so I'm a rookie here. I've connected an ultrasonic sensor to it and written a script in Python (in Thonny) to get readings and save them to local flash memory. After some experimenting, I can no longer go to bootsel mode with the Pico.

What I see:

  • when connecting the Pico to my dev machine, it shows up over the USB/serial link: I can modify the main.py script on the Pico, I can see the measurements file next to it in Pico flash memory

  • I can send files back and forth between the dev. machine and the Pico over the USB/serial link within Thonny: md5sum confirm that I can send a 1.4 MB file (that's as large as it would take) to the Pico and get it back without damage

  • when I connect the Pico to the dev machine while pressing the bootsel button, the Pico flash memory does not register as a new storage device on my dev machine; instead, this is what I see in my logs:

    ==> syslog <== Dec 10 15:33:29 k kernel: [2852368.257759] usb 3-2.4: device not accepting address 96, error -62 Dec 10 15:33:30 k kernel: [2852368.337903] usb 3-2.4: reset full-speed USB device number 96 using xhci_hcd Dec 10 15:33:35 k kernel: [2852373.425890] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command

    ==> kern.log <== Dec 10 15:33:35 k kernel: [2852373.425890] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command Dec 10 15:33:40 k kernel: [2852378.801844] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command Dec 10 15:33:40 k kernel: [2852379.009767] usb 3-2.4: device not accepting address 96, error -62 Dec 10 15:33:40 k kernel: [2852379.010453] sd 2:0:0:0: [sdc] No Caching mode page found Dec 10 15:33:40 k kernel: [2852379.010462] sd 2:0:0:0: [sdc] Assuming drive cache: write through Dec 10 15:33:40 k kernel: [2852379.010975] usb 3-2.4: USB disconnect, device number 96 Dec 10 15:33:40 k kernel: [2852379.025840] sdc: detected capacity change from 262144 to 0 Dec 10 15:33:40 k kernel: [2852379.025864] sd 2:0:0:0: [sdc] Attached SCSI removable disk Dec 10 15:33:40 k kernel: [2852379.157781] usb 3-2.4: new full-speed USB device number 97 using xhci_hcd

Additional observations:

  • I can copy e.g. flash.nuke.uf2 using Thonny to Pico flash memory, disconnect the Pico, and connect it while holding the bootsel button, but the uf2 remains there and doesn't seem to do anything (wipe out flash memory, for example)
  • Whatever my main.py script writes to flash memory seems to be correctly written

I thought I might have burned out flash memory because during initial tests I wrote chunks of 10-20 bytes ~10 times per second to a file recreated at every Pico start, so if flash writes occur in units of 256-byte pages (which seems to be the case), I could inadvertently trigger ~25 rewrites per page on each run, and if the file gets created in the same pages every time, after ~20 runs, that might be 500 writes to the same pages, possibly wearing the pages out, if Pico flash doesn't have wear levelling electronics (which seems likely). I don't know how many rewrite cycles this chip can handle.

Anyway, the problem with the corrupted flash memory theory is that, for anything other than bootsel mode, flash seems to be working as expected. Still, I need the Pico to appear as a USB drive.

Any idea how to investigate this or what might be the cause?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.