k_sleep() and printk() are not working on nrf54L15 dk

Hi there,

I am following  nRF Connect SDK Fundamentals and it looks like that both k_sleep() and printk() are not working.

GPIO is working but I am not sure why these two functions do not work.

Regarding printk(), I can see that CONFIG_SERIAL/CONFIG_CONSOL/CONFIG_UART_CONSO are all equal to y. So I assume nothing is needed to configurate.

Regarding k_sleep(), i have no idea what to be checked.

Could you give some hints to me so I could be able to make them work?

Thanks a lot!

Parents
  • Hello,

    If you for instance use the solution:
    https://github.com/NordicDeveloperAcademy/bt-fund/blob/main/v2.8.x-v2.7.0/l2/l2_e1_sol/src/main.c 

    Does it not work as expected? Maybe you are forgetting the K_MSEC() macro inside k_sleep()?

    Kenneth

  • Hi there!

    Thanks for reply.

    I have tried to add K_MSEC to k_sleep, it is still not working.

    Attached files show what I am using, you can find k_sleep and k_msleep in main.c

    I am using 2.8 SDK and target board is nrf54115dk/nrf54l15/cpuapp.

    32755.prj.conf

    # SPDX-License-Identifier: Apache-2.0
    
    cmake_minimum_required(VERSION 3.20.0)
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(trial)
    
    target_sources(app PRIVATE src/main.c)
    
    /*
     * Copyright (c) 2016 Intel Corporation
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    #include <stdio.h>
    #include <zephyr/kernel.h>
    #include <zephyr/drivers/gpio.h>
    
    /* 1000 msec = 1 sec */
    #define SLEEP_TIME_MS 100
    
    /* The devicetree node identifier for the "led0" alias. */
    #define LED0_NODE DT_ALIAS(led0) //led0
    
    
    /*
     * A build error on this line means your board is unsupported.
     * See the sample documentation for information on how to fix this.
     */
    static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
    
    
    
    
    int main(void)
    {
    	int ret;
    
    
    	if (!gpio_is_ready_dt(&led)) {
    		return 0;
    	}
    	ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
    	if (ret < 0) {
    		return 0;
    	}
      
    
    	while (1) {
    		
    	
    		gpio_pin_set_dt(&led,1);
    		k_msleep(SLEEP_TIME_MS);
    		gpio_pin_set_dt(&led,0);
    		k_msleep(SLEEP_TIME_MS);
    
    		gpio_pin_set_dt(&led,1);
    		k_sleep(K_MSEC(2000));
    		gpio_pin_set_dt(&led,0);
    		k_sleep(K_MSEC(2000));
    		
    	}
    	return 0;
    }
    

Reply
  • Hi there!

    Thanks for reply.

    I have tried to add K_MSEC to k_sleep, it is still not working.

    Attached files show what I am using, you can find k_sleep and k_msleep in main.c

    I am using 2.8 SDK and target board is nrf54115dk/nrf54l15/cpuapp.

    32755.prj.conf

    # SPDX-License-Identifier: Apache-2.0
    
    cmake_minimum_required(VERSION 3.20.0)
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(trial)
    
    target_sources(app PRIVATE src/main.c)
    
    /*
     * Copyright (c) 2016 Intel Corporation
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    #include <stdio.h>
    #include <zephyr/kernel.h>
    #include <zephyr/drivers/gpio.h>
    
    /* 1000 msec = 1 sec */
    #define SLEEP_TIME_MS 100
    
    /* The devicetree node identifier for the "led0" alias. */
    #define LED0_NODE DT_ALIAS(led0) //led0
    
    
    /*
     * A build error on this line means your board is unsupported.
     * See the sample documentation for information on how to fix this.
     */
    static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
    
    
    
    
    int main(void)
    {
    	int ret;
    
    
    	if (!gpio_is_ready_dt(&led)) {
    		return 0;
    	}
    	ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
    	if (ret < 0) {
    		return 0;
    	}
      
    
    	while (1) {
    		
    	
    		gpio_pin_set_dt(&led,1);
    		k_msleep(SLEEP_TIME_MS);
    		gpio_pin_set_dt(&led,0);
    		k_msleep(SLEEP_TIME_MS);
    
    		gpio_pin_set_dt(&led,1);
    		k_sleep(K_MSEC(2000));
    		gpio_pin_set_dt(&led,0);
    		k_sleep(K_MSEC(2000));
    		
    	}
    	return 0;
    }
    

Children
No Data
Related