zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.93k stars 6.65k forks source link

TaskList for Supporting RaspberryPi Pico peripherals #53810

Open soburi opened 1 year ago

soburi commented 1 year ago

A task list for hardware support for the RaspberryPi Pico. (Inspired by #38657.)

Peripherals

Peripherals RP2350

PIO

System

System: RP2040

System: RP2350

Boards: RP2040

Boards: RP2350

Wifi/Bluetooth support

soburi commented 1 year ago

@yonsch @andrei-edward-popa @burumaj @petejohanson I made a list to check the support status. Please comment if there is something that should be fixed.

andrei-edward-popa commented 1 year ago

@soburi Here is also the counter driver for Pico which uses RTC. https://github.com/zephyrproject-rtos/zephyr/pull/52312

petejohanson commented 1 year ago

And this PR I opened last night: #53811 for reboot support into bootloader.

ajf58 commented 1 year ago

I've been working on adding support for hardware_timer as I'm generally interested in adding a bit more support for the RP2040 and the RPi Pico and Pico W to Zephyr. Is there a way to throw my hat into the ring on this?

DaAwesomeP commented 1 year ago

@soburi issue for MPU support: https://github.com/zephyrproject-rtos/zephyr/issues/44318

soburi commented 1 year ago

Hi, @ajf58

Is there a way to throw my hat into the ring on this?

Thank you for your interest.

The best way is creating PR as draft and add the the number of it to this list. I think this list can edit by anyone, please tell me if not so. I'll update it.

soburi commented 1 year ago

@DaAwesomeP

I created a PR to fix the issue. https://github.com/zephyrproject-rtos/zephyr/pull/53973

yonsch commented 1 year ago

@soburi Thank you for this list. I've edited this list to add a few items, but mainly to remove entries that seemed redundant. Here are the ones removed with the reasons for the removal:

DaAwesomeP commented 1 year ago

Possibilities to add:

I found pico_base, not sure if it is really useful.

yonsch commented 1 year ago

@DaAwesomeP

https://github.com/raspberrypi/pico-sdk/pull/1111 is a new method that will be supported soon

As far as I can tell this is a pure software implementation (the RP2040 does not have and RNG). The only thing about it that is "optimized" to the Pico is that it uses the flash's unique ID for generating numbers (as far as I can tell). So in that case I think we would better stick to Zephyr's implementation.

pico_bit_ops: is this covered by pico_divider/double/float/int64_ops?

No, but I agree that it might be useful so I'll add it

DaAwesomeP commented 1 year ago

@yonsch The pico version seems to make use of the ROSC as an entropy source as well as the Bus Performance Counter. I'm not certain if the latter is pico-specific or an M0+ feature.

I agree that the Zephyr implementation is probably best, but I do wonder if there is a way to input additional sources of entropy to the Zephyr methods. At a quick glance, it doesn't seem like the Zephyr version has a way to make use of that as a source of entropy (this was a very surface level check). I can look into this more later if there is interest.

soburi commented 1 year ago

@soburi Thank you for this list. I've edited this list to add a few items, but mainly to remove entries that seemed redundant. Here are the ones removed with the reasons for the removal:

Thank you for updating this list. It was helpful because I was not confident in my judgment.

We got many functions are now available. It seems PIO is a difficult piece. I wish to discuss and make progress about it.

rp1231 commented 1 year ago

Are there any plans to support bluetooth functionality on the pi pico wireless? Thanks

yonsch commented 1 year ago

Are there any plans to support bluetooth functionality on the pi pico wireless? Thanks

@rp1231 Once the interface to the cyw43 (SPI over PIO) is supported, support for both wifi and Bluetooth will be possible.

ThreeEights commented 1 year ago

@soburi - Can you add this pull request for SPI via PIO to the list? #60395 I'm not sure whether it should be listed under SPI or PIO.

PatrickE94 commented 1 year ago

Hey everyone,

I'm also interested in both Zephyr and Pico W support. I jumped over a few steps in creating proper support and wrote a small wifi driver using the cyw43-driver library from pico sdk (via the hal module). I say jumped over since I mostly ported the SPI over PIO from pico sdk.

This is all working, at least in some sense. Running the samples/net/wifi sample successfully with DHCP and communication over both TCP and UDP. I'm currently fiddling with the interrupt for the wake-pin.

I would be happy to contribute to this in any way for proper support. I'm completely new to Zephyr, my main experience is not mainly embedded but I have a few years of professional embedded on FreeRTOS and many years C programming.

Can anyone point me in a good direction forward? Should I push my early driver as a draft PR, or begin switching to @ThreeEights SPI over PIO implementation?

Thanks

ThreeEights commented 1 year ago

Hi, @PatrickE94 - Of course, I'd be most pleased if you work with my SPI via PIO implementation. :-) You should know that it currently doesn't support the 3-wire SPI configuration needed to access the WiFi chip on the Pico W. I'm trying to debug that today. We also have a project in our team to complete a Zephyr driver for the CYW43439 chip, though that's still some weeks away from being ready.

Meanwhile ... welcome to Zephyr! Steve

PatrickE94 commented 1 year ago

Hi, @PatrickE94 - Of course, I'd be most pleased if you work with my SPI via PIO implementation. :-) You should know that it currently doesn't support the 3-wire SPI configuration needed to access the WiFi chip on the Pico W. I'm trying to debug that today.

Neat, then perhaps I will start at the other end :-)

We also have a project in our team to complete a Zephyr driver for the CYW43439 chip, though that's still some weeks away from being ready.

I found that out a few hours ago. Since that's the Infineon guys doing a more generic implementation (with more features, AMDPU etc) than the one in pico sdk, I agree that's the right way! Quickly checking their wifi-host-driver concept, it doesn't look to intimidating to implement a SPI HAL layer which should enable their driver on the pico. They've done a good job documenting it.

Meanwhile ... welcome to Zephyr! Steve

Many thanks! Patrick

JohnConnett commented 1 year ago

Hi @ThreeEights, @PatrickE94,

I'm also interested in WiFi support on Pico W. What's the current state of play?

ThreeEights commented 1 year ago

@JohnConnett - I have a PIO SPI driver that works on everything except the Pico W, for some reason I'm trying to debug, and a pull request is pending for the CYW43xxx WiFi driver. We're trying to pull it all together.

PatrickE94 commented 1 year ago

@JohnConnett I have just put together some glue for the cyw driver and the PIO SPI. It looks like it should work, given that @ThreeEights gets three wire SPI to work. But I haven't tested anything since I have no communication...

I have an old branch where I've mashed in the official pico sdk driver which works, but it's not very neat.

I've been pretty busy with life recently, but I might just take a slow evening to see if I can support @ThreeEights. Let me know if there's anything you'd like me to take a peek at. I have access to Salae logic analysers and some other fine equipment at work.

JohnConnett commented 1 year ago

I've been pretty busy with life recently, but I might just take a slow evening to see if I can support @ThreeEights. Let me know if there's anything you'd like me to take a peek at. I have access to Salae logic analysers and some other fine equipment at work.

I currently have a single Pico W (no headers), with a Pico WH and Pi Debug Probe on order.

The plan is to use a Pico W with a PicoADC16 and Photo Transistor Light Sensors to monitor the state of LEDs on an underfloor heating controller and report them using MQTT to OpenEnergyMonitor. The LEDs indicate if the electrothermal actuators and circulation pump are energized.

We will probably use MicroPython initially. I was interested in Zephyr as a possible alternative.

Thanks for the comments. I might be interested in exploring Zephyr on Pico W for other things when WiFi is available.

wasfan commented 11 months ago

any evolving of Zephyr driver for the CYW43439 chip? I can't wait for btstack to support bluetooth le audio. I try to port driver from pico sdk. pio spi > cyw43 driver > hci.

DaAwesomeP commented 4 months ago

Something to potentially add to the list: PIO-based Ethernet MAC Example: https://github.com/holysnippet/pico_eth

DaAwesomeP commented 4 months ago

The "binary info" feature was I think completed through here: #54464 (can be checked off).