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

I want to move the UART on thingy91:nRF9160.

I want to move the UART on thingy91:nRF9160.

prj_thingy91_nrf9160ns.conf added the following two line.

CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y

The asset_tracker added to the main function of the sample as follows.

/* Initialize the UART module */
uart_dev = device_get_binding(DT_LABEL(DT_NODELABEL(uart0)));
if (uart_dev == NULL) {
LOG_ERR("Cannot bind UART device\n");
return -EINVAL;
}
err = uart_callback_set(uart_dev, uart_cb, NULL);
if (err) {
LOG_ERR("Cannot set callback: %d", err);
return -EFAULT;
}

The callback uart_cb a function that does nothing.

static void uart_cb(const struct device *dev, struct uart_event *evt, void *user_data)
{}

If you do this, booting will repeat infinitely.

*** Booting Zephyr OS build v2.4.0-ncs2 ***
[00:00:00.214,385] [0m<inf> BH1749: BH1749 initialized[0m
[00:00:00.225,799] [0m<inf> asset_tracker: Asset tracker started[0m
[00:00:00.226,074] [0m<inf> watchdog: Watchdog timeout installed. Timeout: 60000[0m
[00:00:00.226,379] [0m<inf> watchdog: Watchdog started[0m
[00:00:00.226,623] [0m<inf> watchdog: Watchdog feed enabled. Timeout: 30000[0m
*** Booting Zephyr OS build v2.4.0-ncs2 ***
[00:00:00.214,385] [0m<inf> BH1749: BH1749 initialized[0m
[00:00:00.225,799] [0m<inf> asset_tracker: Asset tracker started[0m
[00:00:00.226,074] [0m<inf> watchdog: Watchdog timeout installed. Timeout: 60000[0m
[00:00:00.226,379] [0m<inf> watchdog: Watchdog started[0m
[00:00:00.226,623] [0m<inf> watchdog: Watchdog feed enabled. Timeout: 30000[0m
*** Booting Zephyr OS build v2.4.0-ncs2 ***
[00:00:00.214,416] [0m<inf> BH1749: BH1749 initialized[0m
[00:00:00.231,811] [0m<inf> asset_tracker: Asset tracker started[0m
[00:00:00.232,086] [0m<inf> watchdog: Watchdog timeout installed. Timeout: 60000[0m
[00:00:00.232,391] [0m<inf> watchdog: Watchdog started[0m
[00:00:00.232,635] [0m<inf> watchdog: Watchdog feed enabled. Timeout: 30000[0m

uart_callback_set a comment that is calling for a comment, it will move.

*** Booting Zephyr OS build v2.4.0-ncs2 ***
[00:00:00.214,385] [0m<inf> BH1749: BH1749 initialized[0m
[00:00:00.225,799] [0m<inf> asset_tracker: Asset tracker started[0m
[00:00:00.226,074] [0m<inf> watchdog: Watchdog timeout installed. Timeout: 60000[0m
[00:00:00.226,379] [0m<inf> watchdog: Watchdog started[0m
[00:00:00.226,623] [0m<inf> watchdog: Watchdog feed enabled. Timeout: 30000[0m
*** Booting Zephyr OS build v2.4.0-ncs2 ***
[00:00:00.214,447] [0m<inf> BH1749: BH1749 initialized[0m
[00:00:00.231,842] [0m<inf> asset_tracker: Asset tracker started[0m
[00:00:00.232,116] [0m<inf> watchdog: Watchdog timeout installed. Timeout: 60000[0m
[00:00:00.232,421] [0m<inf> watchdog: Watchdog started[0m
[00:00:00.232,666] [0m<inf> watchdog: Watchdog feed enabled. Timeout: 30000[0m
[00:00:00.245,849] [0m<dbg> nrf_cloud_transport.nct_client_id_get: client_id = nrf-352656101122565[0m
[00:00:00.246,215] [0m<dbg> nrf_cloud_transport.nct_topics_populate: shadow_base_topic: $aws/things/nrf-352656101122565/shadow[0m
[00:00:00.246,643] [0m<dbg> nrf_cloud_transport.nct_topics_populate: accepted_topic: nrf-352656101122565/shadow/get/accepted[0m
[00:00:00.247,070] [0m<dbg> nrf_cloud_transport.nct_topics_populate: rejected_topic: $aws/things/nrf-352656101122565/shadow/get/rejected[0m
[00:00:00.247,528] [0m<dbg> nrf_cloud_transport.nct_topics_populate: update_delta_topic: $aws/things/nrf-352656101122565/shadow/update/delta[0m
[00:00:00.248,016] [0m<dbg> nrf_cloud_transport.nct_topics_populate: update_topic: $aws/things/nrf-352656101122565/shadow/update[0m
[00:00:00.248,443] [0m<dbg> nrf_cloud_transport.nct_topics_populate: shadow_get_topic: $aws/things/nrf-352656101122565/shadow/get[0m
[00:00:00.249,389] [0m<inf> asset_tracker: Connecting to LTE network.[0m

What causes it not to move?

Parents
  • Are you able to use another UART instance than 0? Instance 0 is used for logging, and I assume it causes some issue when you change the callback handler. Remember to configure the UART instance in an overlay file, if not already configured in the dts board files (nrf/boards/arm/thingy91_nrf9160/thingy91_nrf9160_common.dts). Also, make sure to disable the SPIM/SPIS/TWIS/TWIM peripherals of the same instance (TWI=I2C).

    Best regards,

    Simon

  • Thank you for answering.

    I changed it to UART1 and went running, but the phenomenon did not change.

    prj_thingy91_nrf9160ns.conf changed as follows:

    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE=y
    CONFIG_NRFX_UARTE1=y
    CONFIG_NRFX_SPIM=n
    CONFIG_NRFX_SPIS=n
    CONFIG_NRFX_TWIS=n
    CONFIG_NRFX_TWIM=n

    thingy91_nrf9160_common.dts has not changed.

    It is set as follows:

    chosen {
    zephyr,console = &uart0;
    zephyr,shell-uart = &uart0;
    zephyr,uart-mcumgr = &uart0;
    };

    &uart0 {
    compatible = "nordic,nrf-uarte";
    current-speed = <115200>;
    status = "okay";
    tx-pin = <18>;
    rx-pin = <19>;
    rts-pin = <20>;
    cts-pin = <21>;
    };

    &uart1 {
    current-speed = <1000000>;
    status = "okay";
    tx-pin = <22>;
    rx-pin = <23>;
    rts-pin = <24>;
    cts-pin = <25>;
    };

Reply
  • Thank you for answering.

    I changed it to UART1 and went running, but the phenomenon did not change.

    prj_thingy91_nrf9160ns.conf changed as follows:

    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE=y
    CONFIG_NRFX_UARTE1=y
    CONFIG_NRFX_SPIM=n
    CONFIG_NRFX_SPIS=n
    CONFIG_NRFX_TWIS=n
    CONFIG_NRFX_TWIM=n

    thingy91_nrf9160_common.dts has not changed.

    It is set as follows:

    chosen {
    zephyr,console = &uart0;
    zephyr,shell-uart = &uart0;
    zephyr,uart-mcumgr = &uart0;
    };

    &uart0 {
    compatible = "nordic,nrf-uarte";
    current-speed = <115200>;
    status = "okay";
    tx-pin = <18>;
    rx-pin = <19>;
    rts-pin = <20>;
    cts-pin = <21>;
    };

    &uart1 {
    current-speed = <1000000>;
    status = "okay";
    tx-pin = <22>;
    rx-pin = <23>;
    rts-pin = <24>;
    cts-pin = <25>;
    };

Children
No Data
Related