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

boards/rpi-pico: add support #15822

Open
tprrt opened this issue Jan 21, 2021 · 24 comments · Fixed by #16609
Open

boards/rpi-pico: add support #15822

tprrt opened this issue Jan 21, 2021 · 24 comments · Fixed by #16609
Labels
Area: cpu Area: CPU/MCU ports Community: good first issue This issue is good for newcomers to RIOT to be addressed / implemented Community: help wanted The contributors require help from other members of the community Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT

Comments

@tprrt
Copy link
Contributor

tprrt commented Jan 21, 2021

Description

Add the support for the mcu RP2040 as weel as the Raspberry-Pi Pico board.

Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces. Key features include:

RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom
Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz
264KB of SRAM, and 2MB of on-board Flash memory
Castellated module allows soldering direct to carrier boards
USB 1.1 with device and host support
Low-power sleep and dormant modes

Drag-and-drop programming using mass storage over USB
26 × multi-function GPIO pins
2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, 16 × controllable PWM channels
Accurate clock and timer on-chip
Temperature sensor
Accelerated floating-point libraries on-chip
8 × Programmable I/O (PIO) state machines for custom peripheral support

Useful links

https://www.raspberrypi.org/blog/raspberry-pi-silicon-pico-now-on-sale
https://www.raspberrypi.org/documentation/pico/getting-started/
https://raspberrypi.github.io/pico-sdk-doxygen/index.html

@bergzand bergzand added Type: new feature The issue requests / The PR implemements a new feature for RIOT Area: cpu Area: CPU/MCU ports labels Jan 21, 2021
@dylad dylad added the Community: help wanted The contributors require help from other members of the community label Jan 21, 2021
@aabadie aabadie added the Platform: ARM Platform: This PR/issue effects ARM-based platforms label May 20, 2021
@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 21, 2021
@aabadie
Copy link
Contributor

aabadie commented Jul 5, 2021

See #16609

@maribu
Copy link
Member

maribu commented Jul 14, 2021

Maybe we can keep the issue open a bit to sync who's working on which feature

@maribu
Copy link
Member

maribu commented Jul 14, 2021

@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 15, 2021
@benpicco benpicco added the Community: good first issue This issue is good for newcomers to RIOT to be addressed / implemented label Oct 2, 2021
@krzysztof-cabaj
Copy link
Contributor

I have tried to flash RPI-pico using uf2conv programmer, using the command:

make BOARD=rpi-pico PROGRAMMER=uf2conv flash

Unfortunately, nothing happened after a successful compilation, linking, and coping UF2 file. After some inspection, I found that UF2 file generated by uf2conv program is incompatible with RPI-pico UF2 bootloader. Everything worked fine when I converted the generated elf file using elf2uf2 tool from pico-SDK and manually copied it to the flash. After some investigation, I detect minor changes in the each UF2 block header between images generated by uf2conv and elf2uf2. If details are needed, I could provide them.

Currently, after some hardcoded changes in RIOT makefiles, I could program the board using elf2uf2 conversion tool (instead of uf2conv) without any problems.

My RPI-pico is using an older RP2-B1 chip. If this problem appears in the most recent RP2-B2 chip version (unfortunately, I have no access to this version) I could add elf2uf2 tool to RIOT code.

@smurfix
Copy link

smurfix commented May 3, 2022

Is anybody working on enhancing this? there seem to be some missing peripherals …

@fabian18
Copy link
Contributor

fabian18 commented May 3, 2022

Is anybody working on enhancing this? there seem to be some missing peripherals …

Any unassigned peripheral is probably waiting to be implemented. Right now, I have more important work to do, than to continue to implement PIO support. Do you require any particular peripheral, or are you asking in general?

@smurfix
Copy link

smurfix commented May 3, 2022

Besides PIO, ADC support would be nice to have, at least for my current project.

bors bot added a commit that referenced this issue Jan 14, 2023
19071: boards/rpi-pico-w: initial support for rpi pico W board r=maribu a=krzysztof-cabaj

### Contribution description

This PR adds initial RIOT OS support for the Raspberry Pico W - the Raspberry Pico with a Wifi/Bluetooth Infineon CYW 43439 module (*).

The code is based on PR #15822 and contains changes associated with small differences between RPi Pico and Pico W. The most important is that LED0 is connected to the CYW 43439 module and without PIO (PR #17425) cannot be used (RP2040 and CYW 43439 are connected together using SPI and Pico SDK utilize PIO to program SPI). Current LED0 implementation is similar to one for `native` board and prints appropriate texts on STDIO.      

(*) Currently network connectivity not implemented.

### Testing procedure

Flash sample program and look at doc:

```
make doc
xdg-open doc/doxygen/html/group__boards__rpi__pico__w.html
```

### Issues/PRs references

Based on PR #15822.
Needs PR #17425.

Additional doc:
[Raspberry Pi Pico and Pico W](https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html)

Co-authored-by: krzysztof-cabaj <kcabaj@gmail.com>
@fengelhardt
Copy link
Contributor

I am working on SPI support right now. I can maybe add some more, it seems not that difficult.

@dylad
Copy link
Member

dylad commented Apr 22, 2023

I've started to work on an ADC driver for this MCU.

@dylad
Copy link
Member

dylad commented Apr 28, 2023

periph_pwm is my next target.

@MacT900
Copy link

MacT900 commented Sep 20, 2023

I'm new here. Can I add i2c?

@benpicco
Copy link
Contributor

Sure, go ahead!
Currently I2C is implemented via PIO, but afaik there is also a native I2C peripheral in the RP2040

@maribu
Copy link
Member

maribu commented Sep 20, 2023

yes there is :-) And @fabian18 already has already created the stubs where it would call to either PIO or native I2C implementation.

Thanks for picking this up :-)

@MacT900
Copy link

MacT900 commented Sep 22, 2023

Can I ask questions here or should I ask in forum? How and from what I create branch or pull request?

@dylad
Copy link
Member

dylad commented Sep 22, 2023

If you have a question about something related to RP2040 (hardware or software). You can ask it here.
Otherwise, if you have questions about RIOT itself, or something else, it would be better to go to the forum. (This way this issue can focus on RP2040 only).

I strongly suggest you to have a look at a few entries in our wiki regarding RIOT development and contribution:
How to make a pull request
Contribution guidelines
Coding Conventions

Feel free to join us on Matrix, we might also help you there.

@studiosoftdev
Copy link

I'm currently doing a bachelors degree level project and intend to check some items off this list - looking at starting with pwm or i2c, then pm, usb and pio if there's no existing implementation for that. Posting here to ask what the current state of these features are so I don't try and do something that someone else is already doing :)

@dylad
Copy link
Member

dylad commented Oct 31, 2023

I have the periph_pwm almost ready. Just need to do some testing on my side. Don't waste time on it ;)

@MacT900
Copy link

MacT900 commented Feb 17, 2024

Hi, I'm back from little break. Should I add an option to use I2C as a slave and where I can find info about I2C drive strength?

@dylad
Copy link
Member

dylad commented Feb 22, 2024

Hi @MacT900,
In the current state, RIOT doesn't support I2C slave. There is discussion about this here
Regarding I2C drive strength, you could either set it to a compile-time default value in periph_cpu.h or create a special field in the I2C configuration structure defined in periph_conf.h. The current I2C API doesn't handle pull strength selection in the current state.

@dylad
Copy link
Member

dylad commented Mar 19, 2024

periph_pwm support was just merged.

@fengelhardt
Copy link
Contributor

I will give periph_usbus a try.

@dylad
Copy link
Member

dylad commented Mar 23, 2024

I will give periph_usbus a try.

That's nice ! I have some experience with this, so don't hesitate to ask if you need help or have any questions.

@fengelhardt
Copy link
Contributor

I have my periph_usbus code almost ready. However, I have doubts if I understood correctly what the two event handlers should do, and what should happen in the ISR and in the xmit functions.

Maybe I could push my code as a WIP Pull Request to clarify?

The code is compiling but not working at all. I just ordered a Black Magic Probe for debugging just in case 😄

@dylad
Copy link
Member

dylad commented Aug 18, 2024

Please go ahead.
That's something I can help to polish.
No promises on how fast I'll be but that's something I'd like to see merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports Community: good first issue This issue is good for newcomers to RIOT to be addressed / implemented Community: help wanted The contributors require help from other members of the community Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging a pull request may close this issue.