golioth / golioth-zephyr-boards

Zephyr board definitions for custom Golioth boards
Apache License 2.0
1 stars 0 forks source link

nRF9160 DK board-specific overlay for Arduino Uno Click shield is not found #18

Closed cdwilson closed 5 months ago

cdwilson commented 6 months ago

There is an upstream Zephyr bug (https://github.com/zephyrproject-rtos/zephyr/issues/71113) that prevents board-specific overlays from being found if they are defined in a Zephyr module's boards/shields/<shield>/boards/ directory. This is currently preventing overlay files for the nRF9160 DK board in https://github.com/golioth/golioth-zephyr-boards/tree/main/boards/shields/arduino_uno_click/boards from being picked up by the build system.

The current workaround for apps targeting the nRF9160 DK board + Arduino Uno Click shield is to add the following pinctrl definitions to the app/boards/nrf9160dk_nrf9160_ns.overlay file:

&pinctrl {
    /*
     * The original Arduino Uno provides the same SCL/SDA on two sets of
     * pins, but the nRF9160 DK maps these pins to two different pairs of
     * GPIO. When using the Arduino Uno Click Shield board with the nRF9160
     * DK, the P0.18/P0.19 pair must be used.
     */
    i2c2_default: i2c2_default {
        group1 {
            psels = <NRF_PSEL(TWIM_SDA, 0, 18)>,
                <NRF_PSEL(TWIM_SCL, 0, 19)>;
        };
    };

    i2c2_sleep: i2c2_sleep {
        group1 {
            psels = <NRF_PSEL(TWIM_SDA, 0, 18)>,
                <NRF_PSEL(TWIM_SCL, 0, 19)>;
            low-power-enable;
        };
    };

    /*
     * The default pin group for the nRF9160 DK includes RTS/CTS HW flow
     * control, but the Arduino Uno Click Shield board does not connect
     * these pins (only TX/RX are connected on the shield). This keeps RX/TX
     * on the same pins, but just removes RTS/CTS from the pin groups.
     */
    uart1_default: uart1_default {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 1)>,
                <NRF_PSEL(UART_RX, 0, 0)>;
        };
    };

    uart1_sleep: uart1_sleep {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 1)>,
                <NRF_PSEL(UART_RX, 0, 0)>;
            low-power-enable;
        };
    };
};

Once https://github.com/zephyrproject-rtos/zephyr/issues/71113 is fixed, this can be removed from the app/boards/nrf9160dk_nrf9160_ns.overlay file in the app because it will be automatically pulled from overlays in this module instead.

cdwilson commented 5 months ago

From the discussion in https://github.com/zephyrproject-rtos/zephyr/issues/71113, this is intended behavior (not a bug). The boards/shields/arduino_uno_click/boards directory should be removed from this module and the workaround above used for any app that needs these modifications in the nrf9160dk_nrf9160_ns.overlay file.