rp-rs / rp-hal

A Rust Embedded-HAL for the rp series microcontrollers
https://crates.io/crates/rp2040-hal
Apache License 2.0
1.46k stars 237 forks source link

Implement support for XipCS1 pin function. #873

Open Altaflux opened 1 week ago

Altaflux commented 1 week ago

Implement support for XipCS1 pin function which is necessary to implement support for external ram or flash.

Note: The rp235x-pac is missing function select definition for XipCS1: https://github.com/rp-rs/rp235x-pac/blob/main/svd/RP2350.yaml#L321

But FUNCSEL_A::GPCK has the same value (9). We should add a variant specific for XipCS1.

Altaflux commented 1 day ago

Hey @thejpster let me know if there is anything else you would like to be changed or if you would like to wait until https://github.com/rp-rs/rp235x-pac/issues/7 gets addressed.

thanks

thejpster commented 21 hours ago

Looks ok. I'd like to try it though. Do you have an example?

Altaflux commented 1 hour ago

I am not sure how to test it without a Pimoroni Pico Plus 2. I use this functionality on my project to enable its PSRAM. Here is the relevant code, I know for a fact that not setting the pin 47 to the correct function will not let PSRAM be initialized:

https://github.com/Altaflux/gb-rp2350/blob/main/src/main.rs#L375 https://github.com/Altaflux/gb-rp2350/blob/main/src/hardware/psram.rs

If you have a Pimoroni Pico Plus 2 I am more than happy to build a sample project for the PSRAM only for you to test if you want to.