How to assign pins for UART for nRF52840 dev kit using the nRF connect desktop VS code?

Hi Team,

I am using the nRF52840 development kit and I want to use the UART example on it, I am using the nRF Connect VS code example central_uart. I am unable to find where I am suppose to give the pin numbers for my UART in the code. I am aware that the nRF52840 has two uarts, how do I enable one of them?

Thanks,

Pranathi

Parents
  • Hi,

    The central uart sample will already use 1 UART to send and receive data from the UART and transmit over Bluetooth. Are you asking how you can add another UART to this sample?

    regards

    Jared

  • Yes, And also can you share the UART pins for both the uarts for nRF52840? I couldn't find them in the datasheet.

  • I have came across the concept called Device Tree to configure the GPIO and all. Am I correct? Can you share me some guidance on how to modify the device tree form scratch?

  • Hi,

    The UART pins are configurable, which means that you can use any GPIO for the UART. The central_uart sample will use P0.05, P0.06, P0.0.07 and P0.08 for the UART as they are connected to the onboard interface chip on the nRF52840 development kit. The interface chip will act as an UART-to-USB bridge and forward the data to the virtual port on the computer. The central uart example will use uart0.

    If you want to add another UART instance, then you can start with the UART lesson in the Devacedemy fundamental course. After finishing the lesson, you can try to merge that code into the central UART sample. Note that you have to change the instance that is used in the lesson since it uses uart0. 

    regards

    Jared

  • what does peripheral_uart example has default pins for UART?

    Where do we give the pin assignment in the code?

    I am only able to see the pin assinged on the device tree file.

Reply
  • what does peripheral_uart example has default pins for UART?

    Where do we give the pin assignment in the code?

    I am only able to see the pin assinged on the device tree file.

Children
  • The peripheral_uart example use P0.05, P0.06, P0.07 and P.08 and uart0 by default, you can change it by changing the pins in the devicetree in the uart0 node,

    regards

    Jared