Blinky sample code not working on nrf52840 custom board

Hi , 

Our custom board uses the nRF52840 chip, and we followed the Nordic official webinar 'Adding Custom Board Support in nRF Connect SDK' during development.

We noticed that the blinky sample example does not work in debug mode or after flashing. In debug mode, the code halts somewhere in reset.s or sometimes the cpu_idle file, but it never reaches the main function.

After significant troubleshooting, we discovered that the LED blinks and single stepping becomes possible if we enable the internal RC oscillator with the following configurations in the prj.conf file:

#Internal RC low-frequency oscillator (LFRC)
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

We're also working with the hardware team to investigate potential issues with the external crystal or capacitors. We'd like to investigate the issue from a firmware perspective simultaneously. The same problem has been observed on three separate boards.


Thanks & Regards,
Gaurav 



 

  • Just to confirm, it works without debugging and stepping when using internal crystal? 

    Yes, with the internal LPRC, it works without debugging (flashing) and also supports single-stepping in debug mode.

    please refer custom board dts 

    // Copyright (c) 2024 Nordic Semiconductor ASA
    // SPDX-License-Identifier: Apache-2.0
    
    /dts-v1/;
    #include <nordic/nrf52840_qfaa.dtsi>
    
    / {
    	model = "EmbeddedGateway nrf52840";
    	compatible = "test,embeddedgateway-nrf52840";
    
    	chosen {
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    	};
    
    	leds {
    		compatible = "gpio-leds";
    		led1: led_1 {
    			label = "LED 1";
    			gpios = <&gpio1 8 0>;
    		};
    	};
    
    			/* These aliases are provided for compatibility with samples */
    			aliases {
    				led1 = &led1;
    	
    			};
    
    };
    
    &flash0 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x0 0xc000>;
    		};
    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0xc000 0x72000>;
    		};
    		slot1_partition: partition@7e000 {
    			label = "image-1";
    			reg = <0x7e000 0x72000>;
    		};
    		scratch_partition: partition@f0000 {
    			label = "image-scratch";
    			reg = <0xf0000 0xa000>;
    		};
    		storage_partition: partition@fa000 {
    			label = "storage";
    			reg = <0xfa000 0x6000>;
    		};
    	};
    };
    
    
    
    
    
    &gpio0 {
    	status = "disabled";
    };
    
    &gpio1 {
    	status = "okay";
    };
    
    &gpiote {
    	status = "okay";
    };
    


    defconfig 

    # Copyright (c) 2024 Nordic Semiconductor ASA
    # SPDX-License-Identifier: Apache-2.0
    
    CONFIG_SOC_SERIES_NRF52X=y
    CONFIG_SOC_NRF52840_QFAA=y
    CONFIG_BOARD_EMBEDDEDGATEWAY_NRF52840=y
    
    # Enable MPU
    CONFIG_ARM_MPU=y
    
    # Enable hardware stack protection
    CONFIG_HW_STACK_PROTECTION=y
    
    
    # enable GPIO
    CONFIG_GPIO=y
    
    

Related