Fix board not detected after unplug replug #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I experienced an issue where the headphones would connect be detected by my computer only in BOOTSEL mode. I can flash once in BOOTSEL mode, and it behaves normally until you reboot the computer or unplug/re-plug the device. This behavior was noted on both Linux and Windows. The device does not show up in dmesg when plugged in, which means the device fails very early. For reference on this, see this video for how little is required to show up in dmesg/device manager.
After research, it seems to be the same issue as issue1304 in the pico-sdk repo for the RP2040 Zero. To summarize, the RP2040 SPI clock gets set higher that the flash chip is rated for. This causes the MCU to get held up and not attempt to boot. The solution is to reduce the SPI clock speed so that this does not happen.
My implementation is to define a board header file, specific to the Ploopy Headphone Amplifier Board. It was named to align with the naming convention found in pico-sdk/src/boards/include/. It modifies the configuration that is currently used (pico.h), to have a lower SPI clock. Additional modifications specific to this board can also be made in this file.