-
Notifications
You must be signed in to change notification settings - Fork 7.4k
boards: seeed: xiao_esp32c6 external antenna support #90059
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
base: main
Are you sure you want to change the base?
boards: seeed: xiao_esp32c6 external antenna support #90059
Conversation
1826bde
to
d1744d6
Compare
22f751f
to
676792e
Compare
Hello @mariopaja There are hooks for board initialization: To make the hooks functional they should be enabled in Kconfig: config BOARD_XIAO_ESP32C6
+ select BOARD_EARLY_INIT_HOOK
+ select BOARD_LATE_INIT_HOOK I think these hooks were added for scenarios like yours. Best regards |
@msalau Thank you for the input! I will have a look into it :) |
return 0; | ||
} | ||
|
||
SYS_INIT(board_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use board hook
boards/seeed/xiao_esp32c6/Kconfig
Outdated
|
||
config XIAO_ESP32C6_EXT_ANTENNA | ||
bool "XIAO ESP32C6 External Antenna" | ||
default n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default n |
@@ -37,6 +37,17 @@ | |||
watchdog0 = &wdt0; | |||
}; | |||
|
|||
rf_switch { | |||
compatible = "gpio-keys"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK gpio-keys
is meant for inputs not outputs.
I don't know about any generic GPIO output driver, so gpio-leds
is the best candidate.
Other boards use it for generic outputs too.
E.g.
heltec_wifi_lora32_v2/heltec_wifi_lora32_v2_procpu.dts
heltec_wifi_lora32_v2/board_init.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually good point, you need to create a custom DTS binding, use of LED for this is not allowed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nordicjm would dts/bindings/output/gpio-switch.yaml
be okay. I guess then this would have to be added in a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mariopaja a board can have custom dts bindings.
E.g.:
arduino/opta/dts/bindings/gpio-power-switches.yaml
arduino/opta/arduino_opta-common.dtsi#L35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you :D
7839e88
to
ad8031d
Compare
169a8fd
to
e6a1373
Compare
@mariopaja One last note :) Is the feature specific to E.g.: config XIAO_ESP32C6_EXT_ANTENNA
bool "XIAO ESP32C6 External Antenna Selector"
+ depends on BOARD_XIAO_ESP32C6_ESP32C6_HPCORE
select BOARD_LATE_INIT_HOOK
help
Select the external antenna of the XIAO ESP32-C6.
By default, the onboard antenna is used.
if(CONFIG_BOARD_XIAO_ESP32C6_ESP32C6_HPCORE)
zephyr_library()
zephyr_library_sources(hpcore_init.c)
endif() |
@msalau I am not sure to tell the truth |
|
@mariopaja I think the antenna option (Kconfig and binding) should be SoC specific and not board specific. This Kconfig could be in |
@sylvioalves sure, I can do that Is it okay if I move the Kconfig and dts in a separate commit, or I need to do a separate PR for that? Is |
|
@sylvioalves I started reworking the PR but I dont know where exactly to put the binding. Should I add it here |
e6a1373
to
8588e0b
Compare
8588e0b
to
ae1a724
Compare
Group of GPIO-controlled relays used to enable an RF switch and select the active antenna. | ||
compatible: "gpio-rf-switch" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The binding looks too generic for me. There is nothing RF or switch specific. This binding can be used to define a GPIO for any purpose.
It seems there nothing RF specific in the switch in general so I'd expect a devicetree entry for an RF switch to be something like this (inspired by zephyr,devmux):
rf_switch: rf-switch {
compatible = "gpio-switch";
enable-gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
select-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
selected = <1>;
status = "okay";
};
This way we have pre-defined properties for GPIOs and also can pre-define the selection if needed.
Also adding a generic driver for it doesn't look unreasonable but this widens scope of the PR significantly from a board specific initialization step to a driver for GPIO controllable switches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msalau You are right :/
Isnt it then better to be moved to dts/bindings/misc
and be renamed into zephyr,gpio-switch
.
I wouldnt mind opening another PR specifically for GPIO controllable switches, but I would appreciate to agree upon it :)
Do you accidentally know who is responsible for dts/bindings/misc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nobody is specifically responsible, because of the nature of them being miscellaneous. But generic bindings of all kind should be reviewed by DT maintainers
This commit add the required dts and Kconfigs to enable external antennas on custom boards Signed-off-by: Mario Paja <mariopaja@hotmail.com>
c87554e
to
0f77ae3
Compare
This PR adds adds The RF switch node and support for the extenal antenna. Signed-off-by: Mario Paja <mariopaja@hotmail.com>
0f77ae3
to
f869dea
Compare
|
This PR adds The RF switch node and support for the extenal antenna.
Based on: XIAO ESP32C6 Getting Started