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

Buttons not working #4

Closed
advotax opened this issue Feb 20, 2024 · 10 comments
Closed

Buttons not working #4

advotax opened this issue Feb 20, 2024 · 10 comments

Comments

@advotax
Copy link

advotax commented Feb 20, 2024

Seems like I ran into the same problem as Didiet (issue #3): I built the hardware in different versions including the full version with active battery measurement. I used power supply over USB and directly to Vbus and Vsys, battery supply, different picos but in every instance I too can NOT (I think that was a typo in issue #3) navigate using the buttons and therefore not play any files. I tried the GPIO buttons as well as the headphone buttons (by making a resistor divider as the schematic implies, even checked the android specs) and both at the same time. None seem to work.

The player starts as expected:

  • Connecting 5V to Vbus the screen shows "Charging" and turns off again. Pressing the center button long wakes up the system.
  • Connecting 5V to Vsys starts the player directly.
  • After one minute it says "Bye" and goes to sleep.
  • Pressing the center button long again (or any of the headphone buttons connected to GPIO#26) the player wakes up again.
  • If logo.jpg is on the SD card it shows the picture.

So I gather I succeeded at least in putting it together the right way and display and SD card communication work.

It starts with the file view although it should first show the version(?) as I understand main.cpp but even if it should start with file view and even if the plus and minus button are not connected correctly, at least the center button should do something, no? That button obviously works since the wake up works. Pressing it long should go to config mode, right? Well, it doesn't.

I even tried leaving out the pull up resistors, since one could read

When GPIO Push Buttons are not implemented, pull up GP20 and GP22 with 4.7Kohm x 2.

as if the GPIO Push Buttons ARE being implemented, no pull up resistors should be used. I can't imagine why, but I tried it anyway. It doesn't work either.

Since I can't build the firmware myself (nmake exits the build because it doesn't find my_pico_stdio_usb_headers and I don't know how to solve this) I can only use the pre-built 0.9.2 as provided. If that build is faulty and the problem I am pretty much stuck....

Thanks in advance.

@elehobica elehobica mentioned this issue Feb 25, 2024
@elehobica
Copy link
Owner

elehobica commented Feb 25, 2024

Thank you for your report.

Before starting to discuss about button issue, I have also recognized the problem of "cannot find -lmy_pico_stdio_usb_headers", which has been reported from other person before as well. I applied the fix for it with latest pico-sdk 1.5.1.

As for the button issue, I appreciate you've described the symptom in detail. It will help me to understand what's going on. I'm still not for sure, however, it seems that unexpected active button action prevent from recognizing correct button action. Most likely problem would be mis-recognition caused by lack of pull-up resisters for PLUS, MINUS buttons. Therefore, just in case, I've append internal pull-up attribute for those pins even if external pull-ups don't work.

Another point, which is more likely to the cause, is that there was obsolete CENTER button (GPIO21) and lack of pull-up of this can also make problem. I've completely deleted GPIO21 function.

I've not confirmed the effect of those fixes because my hardware is currently with unnecessary pull-ups. If you could confirm the latest build solve your problem, I'll appreciate.

edit: if you need the latest binary, please use attached.
RPi_Pico_WAV_Player.zip

@advotax
Copy link
Author

advotax commented Feb 26, 2024

I saw the definition of GPIO 21 as the center button in the source code for the "old" design, as well as the comment that it is no longer used so I didn't really consider it to be the problem. Furthermore I was sure (not so sure anymore) that I tried pulling it up nevertheless. But that was definitely on a breadboard and I could have easily missed the right pin and tried it only once, because I was also under the impression, input pins are internally pulled up by default. Obviously not.

Anyway.

I tried the binary. It works now! No further testing yet than playing a file, but navigation works, long push works (config mode), double click works - I think it the button issue is definitely solved.

For the sake of science I installed the pull up on GPIO21 in combination with the old binary still on the other pico. This time soldering it onto the pcb. That made it work as well. So it was obviously the open GPIO21 that caused the problem.

Then tried to build the firmware myself but couldn't. But probably I need to delete everything and start from scratch. BTW your copy & paste friendly formatting under "How to build" somehow got corrupted.

Thank you very much for the fix and for the project in general!

@elehobica
Copy link
Owner

Thanks for quick trial and report. It's so good that now the problem is cleared thanks to your detail explanation. Without it, I couldn't reach the trap about obsolete center pin.
I also revised the format corruption of README.
If you find another problem about build, please let me know. until it get cleared as well, I will keep this issue open.

@elehobica
Copy link
Owner

For your reference for build, I've changed the way to set PICO_SDK_PATH, PICO_EXTRAS_PATH variables. now they should be defined as environmental variables.
For example, if assuming to work under d:\work\RPi_Pico_WAV_Player, locate pico-sdk, pico-extras and pico-examples on d:\work as well and set environmental variables as follows (in case of Windows):

PICO_SDK_PATH      d:\work\pico-sdk
PICO_EXTRAS_PATH   d:\work\pico-extras

As you say, I recommend to delete RPi_Pico_WAV_Player\build directory and restart build from scratch.

@DietzWN
Copy link

DietzWN commented Feb 26, 2024

Just to clarify :
For GPIO Button : Pull Ups resistors (4K7 GP20, GP22 and 2K2 GP26) not needed
For headphone button : Pull Ups resistors (4K7 GP20, GP22 and 2K2 GP26) needed

@elehobica
Copy link
Owner

Thanks @DietzWN for the confirmation. In precise, 4.7K for GPIO20, GPIO22 are not needed any longer, however 2.2K for GPIO26 is mandatory regardless of the usage of headphone buttons. I'll update schematics as well later.

@DietzWN
Copy link

DietzWN commented Feb 26, 2024

Tried with latest binaries, it work with headphone button. Thanks

@elehobica
Copy link
Owner

Thanks for the trial report! @DietzWN

@advotax
Copy link
Author

advotax commented Feb 28, 2024

Can confirm that building now works for me.

Deleted all folders. Cloned and updated everything again as the "How to build" section states. Set the environmental variables in windows and sucessfully compiled everything without any errors or warnings. The resulting file has the exact same size and works fine on my hardware. Nice.

@elehobica
Copy link
Owner

@advotax Thanks for the confirmation of updated build procedure. I close this issue.

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

3 participants