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

picodisplay.init(buf) affects pin 9? #119

Closed
teuler opened this issue Apr 6, 2021 · 3 comments
Closed

picodisplay.init(buf) affects pin 9? #119

teuler opened this issue Apr 6, 2021 · 3 comments

Comments

@teuler
Copy link

teuler commented Apr 6, 2021

Hi,
I am a bit puzzled: I am using 3 pins (2, 9, and 10) to drive servos via PWM. This works fine until I call picodisplay.init(buf):

[...]
dx = picodisplay.get_width()
dy = picodisplay.get_height()
buf = bytearray(dx *dy *2)
picodisplay.init(buf)

Then the servo at pin 9 cannot be controlled any more and shows erratic behavior (e.g. drifts in one direction). This holds on until the rp2 is hard-resetted. It does not seem to matter if I call picodisplay.init(buf) before or after I grab pin 9 for the servo ... The pin "reports" still the correct frequency and duty cycle, but does not respond.

I looked at the underlying C/C++ code (https://github.com/pimoroni/pimoroni-pico) but cannot find any undocumented reference to pin 9. I used the newest code to built the image.

Does anyone have an idea what happens here?
Thanks!

@teuler
Copy link
Author

teuler commented Apr 6, 2021

P.S.: I soldered a bridge on my PCB to use pin 21 instead of pin 9 and now it works for me. Still curious, this side effect on pin 9 ...

@Gadgetoid
Copy link
Member

I'm going to hazard a guess that pin 9 is part of the same PWM slice as pins 6, 7 and 8 used for the RGB LED. Or, specifically, pin 8.

image

This might be worth documenting 🤔

@teuler
Copy link
Author

teuler commented Apr 7, 2021

Yes, this sounds like a possible explanation. This potential issue is not clearly pointed out in the pico board description - at least, I did not find it. And yes, a warning - ideally in the rp2040 specific pages in the MicroPython docs - would be useful.

@teuler teuler closed this as completed Apr 7, 2021
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

2 participants