This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52833 UART1 NCS v1.6.1

Hi,

I am using the nRF52833DK with NCS v1.6.1 in SES for a multiperipheral application. The application has the LIS2DH accelerometer which is communicating with nRF52833 using I2C. Started with the peripheral UART example and am able to print messages (acceleration data) on to a PuTTY terminal after configuring UART0 as the serial bridge with CONFIG_SERIAL=y (i.e. the default settings)

1) I need to use a UART instance to communicate with an external module. I used UART1 with rx and tx pins configured and am able to get data from the module. Now the module has changed and requires flow control. I added rts and cts pin definitions in the device overlay file and when I build the project, I am not able to see those changes in the output zephyr.dts file.Also, there is no data output from the module. What is the correct way of using UART1 with flow control? Is there a simple example to start with?

My device overlay is as follows (with rts and cts added)

&uart1 {
	status = "okay";
	current-speed = <115200>;
	tx-pin = <31>;
	rx-pin = <30>;
	rts-pin = <24>;
	cts-pin = <25>;
};

&i2c0 {
	compatible = "nordic,nrf-twim";
	status = "okay";
	sda-pin = <29>;
	scl-pin = <28>;
	clock-frequency = <I2C_BITRATE_STANDARD>;

	lis2dh@18 {
	compatible = "st,lis2dh";
	reg = <0x18>;
	label = "LIS2DH";
	};
};

2) I will have to use a second UART instance to connect with another IC. The plan is that UART0 to be used up for the IC. UART1 for the module and I2C0 for the accelerometer (both described above). How will by device overlay change for this? I want to output messages on to a terminal application on the laptop for debugging etc. How do I go about that?

Thanks

GPS

  • Hi,

    What is the correct way of using UART1 with flow control?

    To enable flow control on UART1 you have to set CONFIG_UART_1_NRF_FLOW_CONTROL=y in your prj.conf (in addition to specifying the rts and cts pins in the overlay as you have allready done).

    2) I will have to use a second UART instance to connect with another IC. The plan is that UART0 to be used up for the IC. UART1 for the module and I2C0 for the accelerometer (both described above). How will by device overlay change for this?

    You can add a second UART (0) to your overlay file and use that in that same way as you do with 1.

    I want to output messages on to a terminal application on the laptop for debugging etc. How do I go about that?

    There ARE only two UARTE peripherals, so you cannot use UART loggging if both UARTE peripherals are used for something else. An alternative then is to use RTT logging

  • Hi Einar,

    Thank you for the reply.

    I added the line to my prj.conf. I am getting this error  "warning: attempt to assign the value 'y' to the undefined symbol UART_1_NRF_FLOW_CONTROL"

    my prj.conf looks like this

    #
    # Copyright (c) 2018 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    CONFIG_BOOT_BANNER=n
    
    CONFIG_CBPRINTF_FP_SUPPORT=y
    CONFIG_SERIAL=y
    
    CONFIG_I2C=y
    CONFIG_GPIO=y
    CONFIG_SENSOR=y
    CONFIG_LIS2DH=y
    
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_UART_ASYNC_API=y
    CONFIG_UART_1_NRF_FLOW_CONTROL=y
    
    CONFIG_BT=y
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_L2CAP_TX_BUF_COUNT=5
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Test_BLE"
    CONFIG_BT_DEVICE_APPEARANCE=962
    CONFIG_HEAP_MEM_POOL_SIZE=2048
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    #
    # Copyright (c) 2018 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    cmake_minimum_required(VERSION 3.8)
    set(DTC_OVERLAY_FILE "nrf52833dk_nrf52833.overlay")
    
    #include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(NONE)
    
    # NORDIC SDK APP START
    
    target_sources(app PRIVATE
      src/main.c 
      services/test_ble.c
      drivers/test_sensor.c
    )
    
    # NORDIC SDK APP END
    zephyr_library_include_directories(.)

    and my CMakeLists.txt looks like

  • Hi,

    I am sorry, this has changed and I did not notice before. In recent NCS versions you set flow control in the device tree / overlay, using hw_flow_control.

Related