UART0 unable to bring up (undefined reference to `__device_dts_ord_110')

I am trying to make the UART0 for communicating with another chip and following https://academy.nordicsemi.com/topic/exercise-1-5/

I am using nrf5340 chip and not the DK,

When I use uart_dev = DEVICE_DT_GET(DT_NODELABEL(uart0)) I am getting undefined reference to `__device_dts_ord_110'

void test_uart(void)
{
 	//uart_dev = device_get_binding("uart@8000"); // Passing but not transmitting
	uart_dev = DEVICE_DT_GET(DT_NODELABEL(uart0)); //giving  undefined reference to `__device_dts_ord_110'

	if (!device_is_ready(uart_dev)){
		 printk("device_get_binding UART0 failed\n");
	}
	 
	uart_irq_callback_set(uart_dev, uart_cb);
	uart_irq_rx_enable(uart_dev);

	while (1)
	{
		 
		uart_fifo_fill(uart_dev, "hello",6);
		k_sleep(K_MSEC(1000));
	}
}

CONFIG_GPIO=y
CONFIG_I2C=y
CONFIG_SPI=y
CONFIG_SPI=y
CONFIG_SPI_ASYNC=y
CONFIG_DEBUG_OPTIMIZATIONS=y
 
CONFIG_ADC=y
CONFIG_ADC_ASYNC=y
CONFIG_ADC_NRFX_SAADC=y
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_FPU=y

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_LF_ALWAYS_ON=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
CONFIG_PM=y
CONFIG_PM_DEVICE=y
CONFIG_BOARD_ENABLE_CPUNET=y
CONFIG_SOC_ENABLE_LFXO=n
CONFIG_DEBUG_THREAD_INFO=y


CONFIG_SERIAL=n

CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_LOG=n
CONFIG_ASSERT=y
CONFIG_ASSERT_NO_COND_INFO=y
CONFIG_ASSERT_NO_MSG_INFO=y
CONFIG_HW_STACK_PROTECTION=y
CONFIG_USE_SEGGER_RTT=y
 
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_UART_ASYNC_API=y

#CONFIG_UART_0_NRF_FLOW_CONTROL=n

 
&gpio_fwd {
    uart {
        /delete-property/ gpios;
    };

    status = "disabled";
};
  

&uart0 {
	/delete-property/ rts-pin;
	/delete-property/ cts-pin;
};

Any clue how to fix this ?

Really fed-up of this device tree and early initialization of peripherals.

Any way to totally bypass all these and write the uart and all peripherals in the traditional way and use the zephyr just as an RTOS like freeRTOS ?

Because I really want to switch between uart ports by sharing same UART0 between two different port pins of the MCU on run time and not dependent on any power modes and all.

Parents
  • Hi Vinod,

    Thank you for contacting DevZone at NordicSemi.

    Any way to totally bypass all these and write the uart and all peripherals in the traditional way

    Yes, you can use NRFX drivers if you would like to use.

    Good to know that your issue is resolved.

    Normally, using Zephyr based development environment, we have to make sure that the device is present in the DTS and it is enabled and properly configured. This part is done using the overlays. We also have to enable the drivers, libraries and related configurations using the Kconfig options in the prj.conf. Next, we need to include libraries to use the functionality in the main code.

    BR,

    Naeem

  • Okay, if so how can I change the UART GPIO pins at run time ?

    Also if I modify anything in KConfig, should I save it into proj.conf ?

    When I again open the KConfig, is it reading the changes from proj.conf to reflect previous changed parameters?

  • Dynamic pin configuration should be possible using Zephyr as well as NRFX drivers.

    Zephyr NRF Dynamic PinCtrl Sample

    NRFX UART Driver

    We enable / disable kcocnfig options using the proj.conf file

    After changes made in prj.conf, it should be saved

    When you compile after saving changes, you should be able to see the applied configurations in the /build/zephyr/.config 

    Some configurations may not take place depending upon their dependencies, so do check which configs are taking place in the .config file.

    BR,

    Naeem

  • That is great! Let me check the dynamic pinctrl sample, I will update you after it works. 

  • Hello,

    As per the document in the link,

       "Alternative configurations can only be applied if the device driver using the associated pins has not been initialized yet. Therefore, pay attention to the initialization priorities set in the :file:`prj.conf` file."

     

    This sounds like ones two PINs are assigned as UART0 RX/TX, those cannot be changed later to another PINs dynamically at run time.

    If that is the case, then it won't work for my application because I have 3 uart devices connected to different pins of nrf5340 but all those wont work together at same time. So my plan was to switch those UART0 pins dynamically to select the UART device to communicate.

    How can I do it? Thinking

  • Hi Vinod,

    vinodsdw said:
    Alternative configurations can only be applied if the device driver using the associated pins has not been initialized

    That is correct as per Zephyr documentation. 

    vinodsdw said:
    This sounds like ones two PINs are assigned as UART0 RX/TX, those cannot be changed later to another PINs dynamically at run time.

    Unfortunately, yes, that is limitation from the zephyr implementation.

    I have not done this before, but you could do this by using NRFX driver.

    Please see this ticket as well that talks about it: Uart configure dynamically

    BR,
    Naeem

Reply
  • Hi Vinod,

    vinodsdw said:
    Alternative configurations can only be applied if the device driver using the associated pins has not been initialized

    That is correct as per Zephyr documentation. 

    vinodsdw said:
    This sounds like ones two PINs are assigned as UART0 RX/TX, those cannot be changed later to another PINs dynamically at run time.

    Unfortunately, yes, that is limitation from the zephyr implementation.

    I have not done this before, but you could do this by using NRFX driver.

    Please see this ticket as well that talks about it: Uart configure dynamically

    BR,
    Naeem

Children
No Data
Related