Error in configuring UART pins in SDK2.3.0

Hi there,

I have recently switched my complete "Bluetooth Peripheral" Project from the SDK version 1.9.1 to 2.3.0 

I have been facing some of the pin control issue for the UART, as I have observe you have change the way the UART is working and added the pinctrl functionality.

Previously on the 1.9.1, I was using the UART pins shown under.

&uart0 {
	rts-pin = < 0xff >;
	cts-pin = < 0xff >;
};

&uart2 {
	current-speed = <9600>;
	status = "okay";
	tx-pin = <4>;  
	rx-pin = <5>;
	rts-pin = < 0xff >;
	cts-pin = < 0xff >;
	rx-pull-up;
};

I am using this UART2 for communicating with the BMS(Battery management system), but now in the new SDK when using the same pin configuration, I am getting the error 

"d:\v2.3.0\zephyr\include\zephyr\toolchain\gcc.h:78:36: error: static assertion failed: "/soc/peripheral@50000000/uart@b000 defined without required pin configuration""

"d:\v2.3.0\zephyr\include\zephyr\toolchain\gcc.h:78:36: error: static assertion failed: "/soc/peripheral@50000000/uart@b000 has legacy *-pin properties defined although PINCTRL is enabled"

I am using SDK 2.3.0, and my board is the Nordic Thingy53.

Could you please advise on how to resolve this error and properly configure the UART on my SoC?

Regards 
Sachin

Parents
  • Hello sachin,

    As   mentioned it is a major change from NCS 1.9.x to 2.x.x, see the Migration guide. Introduced pinctrl which is a standard API for configuring the peripheral pins. You can go through this tutorial from Nordic for understanding the UART communication with NCS v2.x..x. But I suspect the error you are seeing now is not because of this. Could you run your code with a debugger and take look where it is crashing.

    I recommend you to try configuring UART before running the whole project and see whether it's working fine or not? Please expect a delay after this response since it is a holiday week here in Norway.

    Kind Regards,

    Abhijith

Reply
  • Hello sachin,

    As   mentioned it is a major change from NCS 1.9.x to 2.x.x, see the Migration guide. Introduced pinctrl which is a standard API for configuring the peripheral pins. You can go through this tutorial from Nordic for understanding the UART communication with NCS v2.x..x. But I suspect the error you are seeing now is not because of this. Could you run your code with a debugger and take look where it is crashing.

    I recommend you to try configuring UART before running the whole project and see whether it's working fine or not? Please expect a delay after this response since it is a holiday week here in Norway.

    Kind Regards,

    Abhijith

Children
  • Hi  ,  

       thanks for giving me this tutorial link.

    I have gone as per the tutorial

    set all these values to y 

    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE0=y
    CONFIG_SERIAL=y
    CONFIG_UART_NRFX=y

    added the header file, and at last added this line 
    bms_uart = DEVICE_DT_GET(DT_NODELABEL(uart2));
      if (!device_is_ready(bms_uart)) {
        printk("Failed to get UART2 binding\n");
    }
    This is my .overlay
    &uart2 {
        current-speed = <9600>;
        status = "okay";    
        pinctrl-0 = <&uart2_default>;
        pinctrl-1 = <&uart2_sleep>;
        pinctrl-names = "default", "sleep";
    };
    &pinctrl {
        uart2_default: uart2_default {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 4)>;
            };
            group2 {
                psels = <NRF_PSEL(UART_RX, 0, 5)>;
                bias-pull-up;
            };
        };
    
        uart2_sleep: uart2_sleep {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 4)>,
                    <NRF_PSEL(UART_RX, 0, 5)>;
                low-power-enable;
            };
        };
    };

    But it is showing this error 
    *** Booting Zephyr OS build v3.2.99-ncs2 ***
    02> [00:00:17.387,420] <inf> fs_nvs: nvs_mount: 8 Sectors of 4096 bytes
    02> [00:00:17.388,092] <inf> fs_nvs: nvs_mount: alloc wra: 0, fd0
    02> [00:00:17.388,702] <inf> fs_nvs: nvs_mount: data wra: 0, 1a
    02> Bluetooth initialized as slave
    02> [00:00:17.407,897] <err> os: usage_fault: ***** USAGE FAULT *****
    02> [00:00:17.408,508] <err> os: usage_fault:   Illegal use of the EPSR
    02> [00:00:17.409,118] <err> os: esf_dump: r0/a1:  0x0004ac2c  r1/a2:  0x20007294  r2/a3:  0x0000000d
    02> [00:00:17.409,973] <err> os: esf_dump: r3/a4:  0x000003e8 r12/ip:  0x00000000 r14/lr:  0x0001aabf
    02> [00:00:17.410,797] <err> os: esf_dump:  xpsr:  0x00000000
    02> [00:00:17.411,407] <err> os: esf_dump: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
    02> [00:00:17.412,414] <err> os: esf_dump: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
    02> [00:00:17.413,421] <err> os: esf_dump: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
    02> [00:00:17.414,428] <err> os: esf_dump: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000000
    02> [00:00:17.415,435] <err> os: esf_dump: fpscr:  0x00000000
    02> [00:00:17.416,015] <err> os: esf_dump: Faulting instruction address (r15/pc): 0x00000000
    02> [00:00:17.416,717] <err> os: z_fatal_error: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
    02> [00:00:17.417,480] <err> os: z_fatal_error: Current thread: 0x20004040 (unknown)
    02> [00:00:17.423,217] <err> fatal_error: k_sys_fatal_error_handler: Resetting system[0m
Related