NRF Printk

I want to use the UART20 serial port to map to other pins for easier PCB layout, but when I use the NRF54L15,

overlay config

debug_uart20_default: debug_uart20_default {
        group1 {
            psels = <NRF_PSEL(UART_TX, 1, 5)>;
        };
    };
	debug_uart20_sleep: debug_uart20_sleep {
        group1 {
            psels = <NRF_PSEL(UART_TX, 1, 5)>;
			low-power-enable;
        };
    };
    
    
    
    
mouse_debug:&uart20 {
    status = "okay";
    current-speed = <9600>;
    pinctrl-0 = <&debug_uart20_default>;
    pinctrl-1 = <&debug_uart20_sleep>;
    pinctrl-names = "default","sleep";
};


my main code 
 bsp_board_init();
    
    while (1) 
    {
        drv_sensor_init();
        dsadsa = bsp_adc_get_value(ADC_CHANNEL_0);
        printk("volatage : %d mv\n", dsadsa);
        k_msleep(1000);
    }


but  no printk  or printf

What should I do ? 
Or, in other words, only the default P1.04 can be used

Parents
  • Hi,

    Do you mean to say that the P1.05 that you are using the code doesn't seem to get the output, but only when you use P1.04, it works?

    Regards,

    Priyanka


  • There is another issue, which is that when I am using the Bluetooth routine (which is a routine for Bluetooth practice one), the board selected 'compact' without any error, but when I selected 'Nordic Soc', it reported an error, and the error that kept happening was' Clock '. I have been following Nordic's AI to solve this problem, but it has not been resolved


  • Hello, I have encountered a very strange problem now. My initialization has blocked all my code, only Printk but no printing. Is it possible that there is a problem with my project?? This is my overlay

    // 根目录
    / {	
     	zephyr,user {
    		
    	// ADC 通道
    	// io-channels 			= <&adc 1>;
    	// 鼠标按键 : 	左 		右 		中 		FB(前进) 	BB(后退)
    	mouse_key_left-gpios 		= <&gpio1 13 ( GPIO_ACTIVE_LOW )>;
    	mouse_key_right-gpios 		= <&gpio1 9  ( GPIO_ACTIVE_LOW )>;
    	mouse_key_center-gpios 		= <&gpio1 8  ( GPIO_ACTIVE_LOW )>;
    	mouse_key_fb-gpios 			= <&gpio0 4  ( GPIO_ACTIVE_LOW )>;
    	// // mouse_key_bb-gpios 	= <&gpio1 13 GPIO_ACTIVE_HIGH>;
    	// // mouse_test_led-gpios 		= <&gpio2 9 GPIO_ACTIVE_HIGH >;
    	board_led0-gpios = <&gpio2 9  	GPIO_ACTIVE_HIGH>;
    	board_led1-gpios = <&gpio1 10  	GPIO_ACTIVE_HIGH>;
    	board_led2-gpios = <&gpio2 7  	GPIO_ACTIVE_HIGH>;
    	board_led3-gpios = <&gpio1 14  	GPIO_ACTIVE_HIGH>;
    
    	// 编码器
    	encoder_one_ea-gpios 		= <&gpio1 5 ( GPIO_ACTIVE_LOW )>;
    	encoder_one_eb-gpios 		= <&gpio1 6  ( GPIO_ACTIVE_LOW )>;
    
    	// 拨码开关 三段
    	// mode_switch_24g-gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
    	// mode_switch_ble-gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;	
    	// mode_usb_gpios 	  	  = <&gpio1 13 GPIO_ACTIVE_LOW>;	
    
     	};
    	
    };
    
    
    
    &pinctrl {
    
    	// SPI30
    	paw3950_spi30_default: paw3950_spi30_default{
    		group1{
    			psels = <NRF_PSEL(SPIM_SCK,0,3)>,
    			<NRF_PSEL(SPIM_MISO,0,1)>,
    			<NRF_PSEL(SPIM_MOSI,0,2)>;
    		};
    	};
    
    	paw3950_spi30_sleep:paw3950_spi30_sleep{
    		group1{
    			psels = <NRF_PSEL(SPIM_SCK,0,3)>,
    			<NRF_PSEL(SPIM_MISO,0,1)>,
    			<NRF_PSEL(SPIM_MOSI,0,2)>;
    			low-power-enable;
    		};
    	};
    
    	// uart
    	debug_uart20_default: debug_uart20_default {
            group1 {
                psels = <NRF_PSEL(UART_TX, 1, 4)>;
            };
        };
    	debug_uart20_sleep: debug_uart20_sleep {
            group1 {
                psels = <NRF_PSEL(UART_TX, 1, 4)>;
    			low-power-enable;
            };
        };
    };
    
    mouse_debug:&uart20 {
    	status = "okay";
    	current-speed = <115200>;
    	pinctrl-0 = <&debug_uart20_default>;
    	pinctrl-1 = <&debug_uart20_sleep>;
    	pinctrl-names = "default","sleep";
    };
    
    
    // ADC
    mouse_vbat_adc:&adc{
    	#address-cells = <1>;
    	#size-cells = <0>;
    	channel@5 {
    		reg = <5>;
    		zephyr,gain = "ADC_GAIN_1";
    		zephyr,reference = "ADC_REF_INTERNAL";
    		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
    		zephyr,input-positive = <NRF_SAADC_AIN5>; /* P1.12 */
    		zephyr,resolution = <12>;
    	};
    };
    
    
    
    
    /** SPI 描述 */
    mouse_paw3950:&spi30 {
        compatible = "nordic,nrf-spim";
        status = "okay";
        pinctrl-0 = <&paw3950_spi30_default>;
        pinctrl-1 = <&paw3950_spi30_sleep>;
        pinctrl-names = "default", "sleep";
        cs-gpios = <&gpio0 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
        paw3950: mspi-device@0 {
            compatible = "bosch,bme280";
            reg = <0>;
            spi-max-frequency = <1000000>;
    		label = "paw3950";
        };
    };
    
    
    
    
    
    
    
    
    
    
    &temp {
     status = "okay";
    };
    
    &power {
     status = "okay";
    };
    
    
    // 关闭
    
    &button1 {
        status = "disabled";
    };
    
    &button0 {
        status = "disabled";
    };
    
    &button2 {
        status = "disabled";
    };
    
    &button3 {
        status = "disabled";
    };
    
    &led0 {
        status = "disabled";
    };
    
    &led1 {
        status = "disabled";
    };
    
    &led2 {
        status = "disabled";
    };
    
    &led3 {
        status = "disabled";
    };
    
    // &spi00 {
    // 	status = "disable";
    // };
    
    // &nfct {
    // 	status = "disable";
    // };
    
    
    &timer20 {
     status = "disabled";
    };
    
    
    // 删除
    /delete-node/ &mx25r64;
    
    /delete-node/ &{/pin-controller/pwm20_default/group1/};
    
    // /delete-node/ &{/soc/peripheral@40000000/uart@c6000/a01nyub/};
    
    /delete-node/ &{/pin-controller/uart20_default/group2/};
    
    
    

    my code

    #include <zephyr/kernel.h>
    #include <zephyr/sys/printk.h>
    
    #include "app_task.h"
    
    
    
    int main()
    {
        // app_driver_init();
        // bsp_24g_init();
        while(1)
        {
            printk("dasdsadsa");
            // k_msleep(1000);
            // k_sleep(K_MSEC(0xFFFFFFFF));
            // app_task_schedule();
            
        }
    }
    
    
    

  • I found the problem, it's really strange. I just wanted to engineer code that can use 2.4G and BLE, but surprisingly

    # CONFIG_NCS_SAMPLES_DEFAULTS=y
    # CONFIG_DK_LIBRARY=y
    
    # CONFIG_LOG=y
    # CONFIG_LOG_DEFAULT_LEVEL=3
    # CONFIG_LOG_MODE_DEFERRED=y
    
    # # ESB
    # CONFIG_ESB=y
    
    # # RADIO DEBUGGING/PERF MEASUREMENT
    # CONFIG_PPI_TRACE=y
    
    # # MULTI-ROLE
    # CONFIG_MPSL=y
    # CONFIG_BT_UNINIT_MPSL_ON_DISABLE=y
    
    # # CONFIG_MPSL_TIMESLOT_SESSION_COUNT=2
    
    # # CONFIG_SHARED_INTERRUPTS=y # this one seems no good
    # CONFIG_DYNAMIC_INTERRUPTS=y
    # CONFIG_DYNAMIC_DIRECT_INTERRUPTS=y
    
    # CONFIG_ESB_DYNAMIC_INTERRUPTS=y
    # CONFIG_MPSL_DYNAMIC_INTERRUPTS=y


    I just need to annotate here, why is this happening????

  • Hi,

    i am a bit confused with what your issue is.

    Could you tell me a bit more clearly as to what your current problem is?

    Is it that you are not observing any output even though you are using printk statements?

    -Priyanka

  • Yes, my main function has nothing, only printk still hasn't output, but commenting out the above 2.4g prj.conf is enough. I think this problem can be reproduced. I don't understand why this happened

  • Hi,

    Sorry for the late response.

    But I think maybe the issue was with your overlay configuration.

    The initial ay you tried was correct, but could you add the following to your overlay file?

    / {
    chosen {
    zephyr,console = &uart20;
    zephyr,uart-mcumgr = &uart20; /* optional */
    };
    };

    In your overlay file, you are just defining the pinctrl, etc, but I think maybe without the chosen { zephyr,console = &uart20; } line, printk() may go to another backend (often RTT), which then looks like “no output.”

    -Priyanka

Reply
  • Hi,

    Sorry for the late response.

    But I think maybe the issue was with your overlay configuration.

    The initial ay you tried was correct, but could you add the following to your overlay file?

    / {
    chosen {
    zephyr,console = &uart20;
    zephyr,uart-mcumgr = &uart20; /* optional */
    };
    };

    In your overlay file, you are just defining the pinctrl, etc, but I think maybe without the chosen { zephyr,console = &uart20; } line, printk() may go to another backend (often RTT), which then looks like “no output.”

    -Priyanka

Children
No Data
Related