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

Blinky not working on custom nrf5340 board

Hi

Migrating from NCS1.3.1 to NCS1.4.1, the Blinky sample stops working on my custom nrf5340 board. No compile error, but not running. I also have a nRF5340PDK. Works fine on this! Note that Blinky also works fine on my custom board when using NCS1.3.1.

How can I debug this?

Since Blinky works fine with NCS1.3.1 and not with NCS1.4.1  it's no HW fail !?

But since Blinky works fine with both versions on the PDK, there's no SW fail !? 

note: initially I had this trouble: Case ID: 256874 https://devzone.nordicsemi.com/f/nordic-q-a/66280/blinky-non-secure-sample-not-running (maybe they are the same)

Parents
  • Hi!

    Which revision of the nRF5340 chip are you using for your HW? I'm asking this as we released revision 1 in december, which behaves a bit differently compared to the engineering samples. Anyway, if you have the oppertunity to step through the code in SES we could get some idea of what's actually happening. 

    Are you using a custom board file (.DTS) for your board? 

    As for the other issue I will talk with Håkon and see what his thoughts are. I guess it can be related to how the pin is configured in the code.

    Best regards,
    Carl Richard

  • I'm using the engineering version marked nRF5340 QKAAAE 1940AB. The DK has nRF5340 QKAAAE 1934AB

    I'm able to step thru code on both targets (PDK and Custom). The code on custom board never enters main loop. I can step to line 479 in init.c: switch_to_main_thread(prepare_multithreading()); But stepping further; the code loop thru fault_s.S (enters line80) and bak to line 479 in init.c.

    Using NCS 1.3.1 both targets are debugged ok. Starting in main(void) in main.c <- NO SPM

    Note: Trying to enable SPM in NCS 1.3.1, I get the following compile error:

    c:/nordicsdk/v1.3.1/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a(fw_info.c.obj):(.firmware_info+0xc): undefined reference to `_fw_info_size'

    I'm using the same DTS for both boards -> identical code.

  • Is this the case for both your modified Blinky sample (from the other ticket) and the original Blinky sample? If possible, could you give me a screenshot of SES from then the sample has entered the fault state. I want to take a look at the call stack and registers.

    How are other applications performing? Could you maybe try the Zephyr hello_world sample?

    Best regards,
    Carl Richard

Reply
  • Is this the case for both your modified Blinky sample (from the other ticket) and the original Blinky sample? If possible, could you give me a screenshot of SES from then the sample has entered the fault state. I want to take a look at the call stack and registers.

    How are other applications performing? Could you maybe try the Zephyr hello_world sample?

    Best regards,
    Carl Richard

Children
  • I have modified my Blinky back to (nearly) the original Blinky. -> same issue.

    hello_world is ok on PDK and debugger is running. On Custom board same issue as Blinky.

    main.c : (nearly same as original Blinky)

    /*
     * Copyright (c) 2016 Intel Corporation
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    #include <zephyr.h>
    #include <device.h>
    #include <devicetree.h>
    #include <drivers/gpio.h>
    
    /* 1000 msec = 1 sec */
    #define SLEEP_TIME_MS   1500
    
    /* The devicetree node identifier for the "led0" alias. */
    #define LED0_NODE DT_ALIAS(led0)
    #define LED1_NODE DT_ALIAS(led1)
    
    #if DT_NODE_HAS_STATUS(LED0_NODE, okay)
    #define LED0	DT_GPIO_LABEL(LED0_NODE, gpios)
    #define PIN	DT_GPIO_PIN(LED0_NODE, gpios)
    #define FLAGS	DT_GPIO_FLAGS(LED0_NODE, gpios)
    #else
    /* A build error here means your board isn't set up to blink an LED. */
    #error "Unsupported board: led0 devicetree alias is not defined"
    #define LED0	""
    #define PIN	0
    #define FLAGS	0
    #endif
    
    #if DT_NODE_HAS_STATUS(LED1_NODE, okay)
    #define LED1	DT_GPIO_LABEL(LED1_NODE, gpios)
    #define PIN1	DT_GPIO_PIN(LED1_NODE, gpios)
    #define FLAGS1	DT_GPIO_FLAGS(LED1_NODE, gpios)
    #endif
    
    void main(void)
    {
    	const struct device *dev;
    	const struct device *dev1;
    	//const struct device *pin_dev;
    	bool led_is_on = true;
    	int ret;
    
    	dev = device_get_binding(LED0);
    	if (dev == NULL) {
    		return;
    	}
    	dev1 = device_get_binding(LED1);
    	if (dev1 == NULL) {
    		return;
    	}
    
    	ret = gpio_pin_configure(dev, PIN, GPIO_OUTPUT_ACTIVE | FLAGS);
    	if (ret < 0) {
    		return;
    	}
    	ret = gpio_pin_configure(dev1, PIN1, GPIO_OUTPUT_ACTIVE | FLAGS1);
    	if (ret < 0) {
    		return;
    	}
    
       	//pin_dev = device_get_binding("GPIO_0");
        //    gpio_pin_configure(pin_dev, 24, GPIO_OUTPUT);
        //    gpio_pin_configure(pin_dev, 16, GPIO_OUTPUT);
    
    	while (1) {
    		gpio_pin_set(dev, PIN, (int)led_is_on);
    		gpio_pin_set(dev, PIN1, (int)led_is_on);
    		//gpio_pin_set(pin_dev, 24, (int)led_is_on);
    		//gpio_pin_set(pin_dev, 16, (int)led_is_on);
    		led_is_on = !led_is_on;
    		k_msleep(SLEEP_TIME_MS);
    	}
    }
    

  • Thanks. I will look into it.

    Could you add the following #else to the DT_NODE_HAS_STATUS(LED1_NODE, okay) check aswell and see if the build returns an error?

     

    /* A build error here means your board isn't set up to blink an LED. */
    #error "Unsupported board: led1 devicetree alias is not defined"
    #define LED0	""
    #define PIN	0
    #define FLAGS	0
    #endif

    Just want to make sure that the LED is actually found.

    Best regards,
    Carl Richard

  • just added it -> no compile error. Both LEDS are blinking on the PDK.

  • Ok. Now that I think of it that makes sense as you're using the same DTS-file. I believe your error may be related to changes in the DTS file between the NCS versions. Looking into that now.

    Best regards,
    Carl Richard

  • Hi again!

    Apologies for the slow progress of this issue. I have not managed to reproduce it here and I'm awaiting answers from the developers on possible issues. Please try out the attached .hex-files on your devices, so that we can rule out any environment issues. One is compiled for the PDK and the other for the DK.

    DK: 5126.blinky_dk.hex

    PDK: 2063.blinky_pdk.hex

    In addition, could you try to step through again and copy the full register values here when it crashes? Press the button as shown in the picture below:

    Best regards,
    Carl Richard

Related