Skip to content

Conversation

@dsch
Copy link
Contributor

@dsch dsch commented May 6, 2025

Add support for Waveshare RP2040 Plus board, a Raspberry Pi Pico like board including a battery charger.

See: https://www.waveshare.com/wiki/RP2040-Plus

@dsch dsch force-pushed the boards/waveshare/rp2040_plus branch 3 times, most recently from 3b43046 to 82eb1b0 Compare May 7, 2025 11:25
@github-actions github-actions bot added the area: ADC Analog-to-Digital Converter (ADC) label May 7, 2025
@github-actions github-actions bot requested a review from anangl May 7, 2025 11:26
@soburi soburi self-assigned this Jun 2, 2025
@soburi soburi added the platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) label Jun 2, 2025
@soburi soburi requested review from ThreeEights and ajf58 June 2, 2025 08:00
@dsch dsch force-pushed the boards/waveshare/rp2040_plus branch 2 times, most recently from a22fa86 to 19fff2e Compare June 6, 2025 09:53
@dsch dsch requested a review from soburi June 6, 2025 09:55
@dsch dsch force-pushed the boards/waveshare/rp2040_plus branch from 19fff2e to 9aad349 Compare June 7, 2025 05:28

west flash

In alternative you can locate the generated :file:`build/zephyr/zephyr.uf2` file and simply drag-and-drop to the device after entering the UF2 flashing mode.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In alternative you can locate the generated :file:`build/zephyr/zephyr.uf2` file and simply drag-and-drop to the device after entering the UF2 flashing mode.
Alternatively, you can locate the generated :file:`build/zephyr/zephyr.uf2` file and simply drag-and-drop to the device after entering the UF2 flashing mode.

};

&flash0 {
reg = <0x10000000 DT_SIZE_M(4)>;
Copy link
Contributor

Choose a reason for hiding this comment

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

There seem to be two variants: a 4MB and a 16MB. It would be good to reflect this in the codebase.

Not a blocker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What solution do you propose to support both variants?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think within Zephyr's parlance they'd be different board variants. Not a blocker, and defaulting to the smaller 4MB is the safer thing to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

followup PR: #92384

if I2C_DW

config I2C_DW_CLOCK_SPEED
default 125
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reason for this clock speed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not have a answer for your question. I was using the RPI Pico board as a blueprint which contains the same define:

config I2C_DW_CLOCK_SPEED
default 125

All of the other RP2040 based boards I checked have the same definition.

Comment on lines +166 to +179
channel@3 {
reg = <3>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};

channel@4 {
reg = <4>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
Copy link
Contributor

Choose a reason for hiding this comment

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

What's going on with these ADC channels? I've looked at the circuit diagram at https://files.waveshare.com/wiki/RP2040-Plus/RP2040_Plus.pdf but I can't see the ADCs being used.

Can you offer a bit more information?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ADC channel 3 (GPIO29) is connected to VSYS via voltage divider R2/R8.
To keep it compatible with samples/boards/nordic/battery I choose "vbatt" as node name although technically not 100% correct as it will be ~0.4V lower than the actual battery voltage.
https://github.com/dsch/zephyr/blob/9aad3493350f8d0d86f5a1442fe5bbff8b4d8667/boards/waveshare/rp2040_plus/rp2040_plus.dts#L80-L85

ADC channel 4 is connected to on-chip temperature sensor. This channel is used in "dietemp" node:

die_temp: dietemp {
compatible = "raspberrypi,pico-temp";
io-channels = <&adc 4>;
status = "disabled";
};

Refer to RP2040 Datasheet, section 4.9. ADC and Temperature Sensor

Add support for Waveshare RP2040 Plus board a Raspberry Pi Pico like
board including a battery charger.

Signed-off-by: David Schneider <[email protected]>
@dsch dsch force-pushed the boards/waveshare/rp2040_plus branch from 9aad349 to db4d4e9 Compare June 10, 2025 07:17
@sonarqubecloud
Copy link

@danieldegrasse danieldegrasse merged commit f3f8513 into zephyrproject-rtos:main Jun 27, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ADC Analog-to-Digital Converter (ADC) platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants