This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF9160 DK & Seeed Relay Shield v3.0

Please provide sample code on how to configure pins to control Relay Shield from Seeed on nRF9160 DK

https://wiki.seeedstudio.com/Relay_Shield_v3/

I have used the following code but it is not working:

struct device * relay_device = device_get_binding(DT_LABEL(DT_NODELABEL(gpio0)));
gpio_pin_configure(relay_device, 4, GPIO_OUTPUT);
gpio_pin_configure(relay_device, 5, GPIO_OUTPUT);
gpio_pin_configure(relay_device, 6, GPIO_OUTPUT);
gpio_pin_configure(relay_device, 7, GPIO_OUTPUT);

gpio_pin_set(relay_device, 4, true);
gpio_pin_set(relay_device, 5, true);
gpio_pin_set(relay_device, 6, true);
gpio_pin_set(relay_device, 7, true);
Parents
  • Found the answer in the zephyrproject documentation. Set pins 4-7 to "Route to Arduino pins" 

    docs.zephyrproject.org/.../index.html

    Board controller firmware

    The board controller firmware is a small snippet of code that takes care of routing specific pins on nRF9160 SiP to different components on the board, such as LEDs, switches, and specific nRF52840 SoC pins.

    When compiling a project for nrf9160dk_nrf52840, the board controller firmware will be compiled and run automatically after the Kernel has been initialized.

    By default, the board controller firmware will route the following:

    Component

    Routed to

    nRF9160 UART0

    VCOM0

    nRF9160 UART1

    VCOM2

    LEDs 1-4

    physical LEDs

    Buttons 1-2

    physical buttons

    Switches 1-2

    physical switches

    MCU Interface 0

    Arduino pin headers

    MCU Interface 1

    Trace interface

    MCU Interface 2

    COEX interface

    It is possible to configure the behavior of the board controller firmware by using Kconfig and editing its options under “Board options”.

Reply
  • Found the answer in the zephyrproject documentation. Set pins 4-7 to "Route to Arduino pins" 

    docs.zephyrproject.org/.../index.html

    Board controller firmware

    The board controller firmware is a small snippet of code that takes care of routing specific pins on nRF9160 SiP to different components on the board, such as LEDs, switches, and specific nRF52840 SoC pins.

    When compiling a project for nrf9160dk_nrf52840, the board controller firmware will be compiled and run automatically after the Kernel has been initialized.

    By default, the board controller firmware will route the following:

    Component

    Routed to

    nRF9160 UART0

    VCOM0

    nRF9160 UART1

    VCOM2

    LEDs 1-4

    physical LEDs

    Buttons 1-2

    physical buttons

    Switches 1-2

    physical switches

    MCU Interface 0

    Arduino pin headers

    MCU Interface 1

    Trace interface

    MCU Interface 2

    COEX interface

    It is possible to configure the behavior of the board controller firmware by using Kconfig and editing its options under “Board options”.

Children
No Data
Related