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 Reply
  •  Can the TX pin of this UART be set arbitrarily? Last time, I randomly set the CLK pin of SPI and found that there was no clock, but MOSI, MISO, and CS. Later, I discovered that CLK must be set on a pin with the CLK suffix to have a clock.
    So the main issue is what are the requirements for the TX setting of UART20, and whether it only needs to be the P1 port that is not used. ?

    Sometimes I want to create an Overlay, but I don't know why VSCode doesn't pop up the overlay file. I just copy the overlay that I successfully created before. If I encounter the problem of not being able to create an overlay and need to manually create it, what should be the naming convention?

Children
  • LinJunXuan said:
    what are the requirements for the TX setting of UART20, and whether it only needs to be the P1 port that is not used. ?

    Yes, UART20 TX must be mapped to an unused P1 pin.

    LinJunXuan said:
    If I encounter the problem of not being able to create an overlay and need to manually create it, what should be the naming convention?

    You need to name it nrf54l15dk\nrf54l15\cpuapp.overlay and place it in a folder called boards in you project file.

    -Priyanka

  • nrf54l15dk_nrf54l15_cpuapp.overlay   ?

    Will the overlay built directly in the future be placed in the boards folder according to the boards we configured? Assuming I am currently in NS
    nrf54l15dk_nrf54l15_cpuapp_ns.overlay?

  • No, the build folder will as usual be placed in your project folder itself, but the overlays need to be placed in a separate "boards" file in your project folder. Similar to this:

    LinJunXuan said:
    Assuming I am currently in NS
    nrf54l15dk_nrf54l15_cpuapp_ns.overlay?

    Yes that's right. 

    -Priyanka


  • 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????

Related