Hi guys,
I've done a custom board with NRF5340 + NRF21540 and I'm not sure the right way to link the cpuapp and cpunet for control the output power of NRF21540.
I tried to following the documentation https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0-rc2/zephyr/build/dts/api/bindings/gpio/nordic%2Cnrf-gpio-forwarder.html
The nrf5340_cpuapp_common.dts is like.
/* * Copyright (c) 2019-2020 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 * MODIFICADO */ #include "nrf5340_cpuapp_common-pinctrl.dtsi" / { chosen { zephyr,console = &uart0; zephyr,shell-uart = &uart0; zephyr,uart-mcumgr = &uart0; zephyr,bt-mon-uart = &uart0; zephyr,bt-c2h-uart = &uart0; zephyr,bt-hci-rpmsg-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,ieee802154 = &ieee802154; }; leds { compatible = "gpio-leds"; led0: led_0 { gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; label = "Green LED 0"; }; led1: led_1 { gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>; label = "Green LED 1"; }; }; buttons { compatible = "gpio-keys"; button0: button_0 { gpios = <&gpio0 27 (GPIO_ACTIVE_LOW)>; label = "Push button 0"; }; }; nrf_radio_fem: nrf21540 { compatible = "nordic,nrf21540-fem"; tx-en-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; rx-en-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; pdn-gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>; mode-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; ant-sel-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; }; gpio_fwd: nrf-gpio-forwarder { compatible = "nordic,nrf-gpio-forwarder"; nrf21540-gpio-if { gpios = <&gpio1 13 0>, <&gpio0 30 0>, <&gpio0 26 0>, <&gpio1 14 0>, <&gpio0 31 0> ; }; }; /* These aliases are provided for compatibility with samples */ aliases { led0 = &led0; led1 = &led1; sw0 = &button0; bootloader-led0 = &led0; mcuboot-button0 = &button0; mcuboot-led0 = &led0; watchdog0 = &wdt0; spi-flash0 = &is25lp; }; }; &adc { status = "okay"; }; &gpiote { status = "okay"; }; &gpio0 { status = "okay"; }; &gpio1 { status = "okay"; }; &uart0 { status = "okay"; current-speed = <115200>; pinctrl-0 = <&uart0_default>; pinctrl-1 = <&uart0_sleep>; pinctrl-names = "default", "sleep"; }; &uart1 { status = "okay"; current-speed = <115200>; pinctrl-0 = <&uart1_default>; pinctrl-1 = <&uart1_sleep>; pinctrl-names = "default", "sleep"; }; &timer0 { status = "okay"; }; &timer1 { status = "okay"; }; &timer2 { status = "okay"; }; &flash0 { partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; boot_partition: partition@0 { label = "mcuboot"; reg = <0x00000000 0x00010000>; }; slot0_partition: partition@10000 { label = "image-0"; }; slot0_ns_partition: partition@50000 { label = "image-0-nonsecure"; }; slot1_partition: partition@80000 { label = "image-1"; }; slot1_ns_partition: partition@c0000 { label = "image-1-nonsecure"; }; scratch_partition: partition@f0000 { label = "image-scratch"; reg = <0x000f0000 0xa000>; }; storage_partition: partition@fa000 { label = "storage"; reg = <0x000fa000 0x00006000>; }; }; }; &ieee802154 { status = "okay"; }; zephyr_udc0: &usbd { compatible = "nordic,nrf-usbd"; status = "okay"; }; / { reserved-memory { #address-cells = <1>; #size-cells = <1>; ranges; sram0_image: image@20000000 { /* Zephyr image(s) memory */ }; sram0_s: image_s@20000000 { /* Secure image memory */ }; sram0_ns: image_ns@20040000 { /* Non-Secure image memory */ }; }; }; /* Include partition configuration file */ #include "nrf5340_cpuapp_partition_conf.dts"
In nrf5340_myboard_cpunet.dts
/* * Copyright (c) 2020 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ /dts-v1/; #include <nordic/nrf5340_cpunet_qkaa.dtsi> #include "nrf5340_dsboxv5_cpunet-pinctrl.dtsi" / { model = "Nordic NRF5340 DSBOXV5 Network"; compatible = "nordic,nrf5340-dsboxv5-cpunet"; chosen { zephyr,console = &uart0; zephyr,shell-uart = &uart0; zephyr,uart-mcumgr = &uart0; zephyr,bt-mon-uart = &uart0; zephyr,bt-c2h-uart = &uart0; zephyr,bt-hci-rpmsg-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,sram = &sram1; zephyr,flash = &flash1; zephyr,code-partition = &slot0_partition; zephyr,ieee802154 = &ieee802154; }; nrf_radio_fem: nrf21540_fem { compatible = "nordic,nrf21540-fem"; tx-en-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; rx-en-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; pdn-gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>; mode-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; ant-sel-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; spi-if = <&nrf_radio_fem_spi>; supply-voltage-mv = <3300>; }; /* These aliases are provided for compatibility with samples */ aliases { watchdog0 = &wdt0; }; }; &gpiote { status = "okay"; }; &gpio0 { status = "okay"; }; &gpio1 { status = "okay"; }; &uart0 { status = "okay"; current-speed = <115200>; pinctrl-0 = <&uart0_default>; pinctrl-1 = <&uart0_sleep>; pinctrl-names = "default", "sleep"; }; fem_spi: &spi0 { status = "okay"; cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; pinctrl-0 = <&spi0_default>; pinctrl-1 = <&spi0_sleep>; pinctrl-names = "default", "sleep"; nrf_radio_fem_spi: nrf21540_fem_spi@0 { compatible = "nordic,nrf21540-fem-spi"; status = "okay"; reg = <0>; spi-max-frequency = <8000000>; }; }; &radio { fem = <&nrf_radio_fem>; }; &timer0 { status = "okay"; }; &timer1 { status = "okay"; }; &timer2 { status = "okay"; }; &flash1 { partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; boot_partition: partition@0 { label = "mcuboot"; reg = <0x00000000 0xc000>; }; slot0_partition: partition@c000 { label = "image-0"; reg = <0x0000C000 0x12000>; }; slot1_partition: partition@1e000 { label = "image-1"; reg = <0x0001E000 0x12000>; }; scratch_partition: partition@30000 { label = "image-scratch"; reg = <0x00030000 0xa000>; }; storage_partition: partition@3a000 { label = "storage"; reg = <0x0003a000 0x6000>; }; }; }; &ieee802154 { status = "okay"; }; /* Include shared RAM configuration file */ #include "nrf5340_shared_sram_planning_conf.dts"
The proj.conf is
##LOGs CONFIG_LOG=y CONFIG_CONSOLE=y CONFIG_PRINTK=y CONFIG_STDOUT_CONSOLE=y CONFIG_LOG_BACKEND_RTT=y CONFIG_RTT_CONSOLE=y CONFIG_USE_SEGGER_RTT=y CONFIG_UART_CONSOLE=n ## Settings CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4196 CONFIG_MAIN_STACK_SIZE=10240 CONFIG_REBOOT=y ## Log CONFIG_LOG_PRINTK=y CONFIG_LOG_DEFAULT_LEVEL=3 # CONFIG_LOG_BACKEND_UART=y CONFIG_GPIO=y # ENABLE SERIAL DRIVER CONFIG_SERIAL=y CONFIG_UART_ASYNC_API=y CONFIG_BT=y CONFIG_BT_DEBUG_LOG=n CONFIG_BT_SMP=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_CENTRAL=y CONFIG_BT_GATT_CLIENT=y CONFIG_BT_PRIVACY=n CONFIG_BT_DEVICE_NAME="GTW-V5" CONFIG_BT_DIS=y CONFIG_BT_DIS_PNP=n CONFIG_BT_BAS=y CONFIG_BT_HRS=y # CONFIG_BT_DEVICE_APPEARANCE=833 # CONFIG_FEM_AL_LIB=y # CONFIG_BOARD_ENABLE_CPUNET=y # CONFIG_MBOX=y # Allow for large Bluetooth data packets. CONFIG_BT_L2CAP_TX_MTU=498 CONFIG_BT_BUF_ACL_RX_SIZE=502 CONFIG_BT_BUF_ACL_TX_SIZE=502 CONFIG_FLASH=y CONFIG_SPI=y CONFIG_FLASH_JESD216_API=y # CONFIG_DT_HAS_JEDEC_SPI_NOR_ENABLED=y CONFIG_SPI_NOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
Are these files properly configured?
In the application, how can I set a specific output power using the spi channel?
My problem is that I couldn't change the output power.