Skip to content

Commit

Permalink
boards: st: add adc1 peripheral for nucleo_h533re
Browse files Browse the repository at this point in the history
This nucleo board inherit from the root `h5` dts some special nodes:
- `vbat` on adc1 channel 2
- `vref` on adc1 channel 17
- `die_temp` on adc1 channel 16

The issue is discussed here:
zephyrproject-rtos/zephyr#72914

(cherry picked from commit 648f6dc)

Original-Signed-off-by: Alex Fabre <alex.fabre@rtone.fr>
GitOrigin-RevId: 648f6dc
Change-Id: I73bbe54c7534709464e3d7eb23c6461b44c1932e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5666209
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
  • Loading branch information
AlexFabre authored and Chromeos LUCI committed Jun 28, 2024
1 parent faabf0e commit b334ba7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
18 changes: 18 additions & 0 deletions boards/st/nucleo_h533re/nucleo_h533re.dts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
pwm-led0 = &green_pwm_led;
sw0 = &user_button;
watchdog0 = &iwdg;
die-temp0 = &die_temp;
volt-sensor0 = &vref;
volt-sensor1 = &vbat;
};
};

Expand Down Expand Up @@ -118,10 +120,26 @@
};
};

&adc1 {
pinctrl-0 = <&adc1_inp0_pa0>; /* Arduino A0 */
pinctrl-names = "default";
st,adc-clock-source = <ASYNC>;
st,adc-prescaler = <8>;
status = "okay";
};

&die_temp {
status = "okay";
};

&vref {
status = "okay";
};

&vbat {
status = "okay";
};

&rng {
status = "okay";
};
Expand Down
25 changes: 25 additions & 0 deletions tests/drivers/adc/adc_api/boards/nucleo_h533re.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) Alex Fabre <alex.fabre@rtone.fr>
*/

/ {
zephyr,user {
/* adjust channel number according to pinmux in board.dts */
io-channels = <&adc1 0>;
};
};

&adc1 {
#address-cells = <1>;
#size-cells = <0>;

channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};

0 comments on commit b334ba7

Please sign in to comment.