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

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

Related