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

Waveshare RP2040-Zero board definition #5820

Merged
merged 3 commits into from Jan 12, 2022

Conversation

CharString
Copy link

@CharString CharString commented Jan 7, 2022

board.NEOPIXEL works. Once you have an LED cycling colours, you're 99% done. :-)

Any comments and pointers on how to proceed are welcome. I copied the pin definitions from a different board. This was the shortest path to Blinkenlichten.

  • Blink the neopixel
  • Get the vendor to register a Product ID
  • Check learn.adafruit.com on how to add a board for a checklist

`board.NEOPIXEL` works. Once you have an LED cycling colours, you're 99%
done. :-)
There's just the NEOPIXEL on this board, no other LED.
@tannewt
Copy link
Member

tannewt commented Jan 10, 2022

Is this ready for review? It looks ok to me but I'm not sure if you've updated the pinout. The Learn guide is here: https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython

@CharString
Copy link
Author

@tannewt Thanks, I found the guide and have been looking at the QT PY code and schematics (hurrah for open source hardware) as an example.
tl;dr I have Zero (no pun intended) experience with python on mcu's. So I still have planned to test the UART with an FTDI board I still have laying around from my Huzzah. And setup a pot as a voltage divider to test the ADC A0-3 pins. And try the I2C oled displays I have, following one of the Adafruit tutorials.

That said. It builds, installs and the REPL and neopixel work as expected. But I'm unsure about the other pin definitions. I think those SNPS, VBUS and VOLTAGE_MONITOR pins are incorrect. I just copied them over from the Pico code, because the docs pointed heavily to the Pico. And I'm unsure what the default I2C, SPI and UART busses should be.
It seems that many of the pins can do that, and it's a matter of choice. And that the QT PY board definition is the way it is, because of the silk screen markings and qwiic/Stemma qt connector.

I went with pin 0 and 1 for the UART because those are mentioned as default UART 0 in the docs. I don't know whether the definitions in pin.c do anything more than mapping an attribute on board to a certain pin, or whether addressing the pin through a different name has the side effect of configuring that pin to be say, analogue or digital input. I think I read that the NEOPIXEL definition sets up the state machine of the rp2040 to help with timings.

So ready for review? I don't know. Not quite yet? You tell me :-)

@tannewt
Copy link
Member

tannewt commented Jan 11, 2022

It seems that many of the pins can do that, and it's a matter of choice. And that the QT PY board definition is the way it is, because of the silk screen markings and qwiic/Stemma qt connector.

Correct, default buses are those marked by the silkscreen of the board. SDA and SCL typically for I2C, MOSI, MISO and SCK for SPI and TX and RX for UART. If those names aren't marked then there's no default bus.

I went with pin 0 and 1 for the UART because those are mentioned as default UART 0 in the docs. I don't know whether the definitions in pin.c do anything more than mapping an attribute on board to a certain pin, or whether addressing the pin through a different name has the side effect of configuring that pin to be say, analogue or digital input. I think I read that the NEOPIXEL definition sets up the state machine of the rp2040 to help with timings.

The pins.c contents will not cause any auto-init. The #defines will though.

So ready for review? I don't know. Not quite yet? You tell me :-)

You've got the board to test with so it's up to you. Sounds like you've done a fair bit of testing to start so I'm happy to merge this in now. Folks can always fix/change it later.

This brings the pins in line with the documented [pinouts]. The only
"special" pins:

 - GP0, GP1 are mentioned as the default UART, so we init them as
   such and give them the TX and RX alternative names.
 - GP16 is connected to the onboard neopixel DIN line and we assign it
   the NEOPIXEL name. (Power of the neopixel is connected to the 3.3V
   rail, not a pin. See [schematic].)
 - GP26, GP27, GP28, GP29 have unambiguous ADC designations in the
   [pinouts], so we assign the `A` analogue names as the Pico board
   definition does.

  [pinouts]: https://www.waveshare.com/wiki/RP2040-Zero#Pinouts
  [schematic]: https://www.waveshare.com/w/upload/4/4c/RP2040_Zero.pdf
@CharString CharString changed the title WIP: Waveshare RP2040-Zero board definition Waveshare RP2040-Zero board definition Jan 12, 2022
@CharString
Copy link
Author

If this builds, it should be ready for a merge. I did this in my lunch break, so I don't have the board nor complete build env. But these last changes I did aren't rocket science, and should break the things I already tested.
Thanks for providing all the help that you all did.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It builds and looks good. Thanks!

@tannewt tannewt merged commit ae58858 into adafruit:main Jan 12, 2022
@CharString CharString deleted the waveshare_rp2040_zero branch January 17, 2022 12:12
@IsaacDynamo
Copy link

IsaacDynamo commented Jan 28, 2022

Hi, pretty new to Circuit python and wanted to try it on the Waveshare RP2040-Zero.
Is there any reason why there isn't a 7.1.1 release for it? Is it just to new, and should I just use latest build for now? And wait until 7.2.0 drops.
https://circuitpython.org/board/waveshare_rp2040_zero/

@kattni
Copy link

kattni commented Jan 28, 2022

@IsaacDynamo The board was added after we already moved towards 7.2.0. You can use the latest build for now, it's pretty stable for the most part. Please let us know if you run into any issues. It's best to file a new issue if there isn't already a related one. Comments on closed PRs and issues are often missed!

@rcarmo
Copy link

rcarmo commented May 30, 2022

Hi there,

I can't use I2C on the Waveshare. The board should be able to use several sets of GPIOs as I2C pins, but I can't get any of them to work:

image

...and I don't see any of them defined as such in pins.c.

@dhalbert
Copy link
Collaborator

@rcarmo this sounds more like a support issue. What is not working? You should be able to do

i2c = busio.I2C(board.GP1, board.GP0)

etc. for any pair of I2C pins (I2C0 or I2C1 pair).

@rcarmo
Copy link

rcarmo commented May 30, 2022

The instant I issue that call I get

RuntimeError: No pull up found on SDA or SCL; check your wiring

Regardless of pin, circuit, device, anything. This leads me to believe the I2C initialization is broken.

@dhalbert
Copy link
Collaborator

@rcarmo Please open a thread in https://forums.adafruit.com or on discord: https://adafru.it/discord. Include your code and a photo of your wiring, and which version of CircuitPython you are using. Are you using breakouts with pullups?

There are other RP2040 boards very similar to this that work fine (e.g., QT Py), and I don't see anything unusual about this board definition.

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

Successfully merging this pull request may close these issues.

None yet

6 participants