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

What's the proper way to run nrf9160 DK's app working on nrf9160 SiP?

Hi there,

I'm having a lot of fun with running apps on nrf9160 SiP on board of nrf9160 DK.

nrf52840 SoC contains the standard board controller fw.

nrf9160 SiP contains the standard secure bootloader from samples and modem fw.

My app is very simple and uses only leds.

What I'm trying to do is just to blink by LED1 each 100 msec. Only Zephyr's main thread is being used.

The probability of a successful run when i see a blinking led is about 20-30% of all tries.

I've tried several DK start sequences and none of them give me a 100% success rate:

* switch DK off / on and wait

* switch DK off / on, push reset button (nrf91 debug state) and wait

* switch DK off / on, set nrf52 debug, push reset button and wait

* switch DK off / on, set nrf52 debug, push reset button, set nrf91 debug, push reset button and wait

3 sec delay has been added to the very beginning of the main thread to give time for the board controller to boot and init all routes.

In all successful runs it takes about 10-30 seconds to start blinking. 

What's the proper start sequence for nrf9160 DK?

Parents
  • Hi Alex,

    First things first, the lte_ble_gateway sample is not necessary the best sample to build upon in your case where you test out basic functionality.

    (for simple samples I would suggest you to check out this repository.)


    The reason you see this "strange" behaviour is that you have enabled alot of things in the prj.conf file which you do not need.

    For example, when you set:

    # LTE link control
    CONFIG_LTE_LINK_CONTROL=y

    You say to the application to try to establish a link with a base station before your main runs. This can take ~30-60 seconds, and that is why you see this delay when running your application before the LED starts to toggle.


    • What you can do is strip everything down from the lte_ble_gateway sample.

    1. Only enable the necessary things in prj.conf

    # Trusted execution
    CONFIG_TRUSTED_EXECUTION_NONSECURE=y
    
    # Library for buttons and LEDs
    CONFIG_DK_LIBRARY=y
    CONFIG_DK_LIBRARY_INVERT_LEDS=n 

    2. Strip down the main.c

     

    /*
    
    * Copyright (c) 2012-2014 Wind River Systems, Inc.
    
    *
    
    * SPDX-License-Identifier: Apache-2.0
    
    */
    
    #include <zephyr.h>
    #include <misc/printk.h>
    #include <dk_buttons_and_leds.h>
    
    static void leds_init(void)
    {
    	int err;
    
    	err = dk_leds_init();
    	if (err) {
    		printk("Could not initialize leds, err code: %d\n", err);
    	}
    
    	err = dk_set_leds_state(0, DK_ALL_LEDS_MSK);
    	if (err) {
    		printk("Could not set leds state, err code: %d\n", err);
    	}
    }
    
    void main(void)
    {
    	static bool led_1_on = false;
    	int err;
    	u32_t leds_on_mask;
    
    	printk("BLE to NB-IoT gateway started\n");
    	leds_init();
    
    	while (true) {
    		led_1_on = !led_1_on;
    		leds_on_mask = 0;
    		if (led_1_on) {
    			leds_on_mask |= DK_LED1_MSK;
    		}
    
    		err = dk_set_leds_state(leds_on_mask, DK_ALL_LEDS_MSK);
    		if (err) {
    			printk("Could not set leds state, err code: %d\n", err);
    		}
    
    		k_sleep(K_MSEC(200));
    	}
    }
    

    3. Strip down the CMakeLists.txt

    #
    # Copyright (c) 2018 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    
    cmake_minimum_required(VERSION 3.8.2)
    
    include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
    project(NONE)
    
    target_sources(app PRIVATE src/main.c)
    


    • Or another option is to unzip  simple_led.zip in [ nrf\samples\nrf9160\] and build/run.

    It should work out-of-the box with your specification for the application. (and it should be easier to build upon)

    Best Regards,

    Martin L.

  • Thanks a lot! Yes, the only option which is preventing a quick start is 

    CONFIG_LTE_LINK_CONTROL=y

    Disabling the option has helped.

Reply Children
No Data
Related