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

Serial Port 2

Hi

Yes. I want to do something like Peripheral_uart example but  I want to connect my serial device sensor  to NRF5340-DK via gpio pins available.

Then I want to get the sensor serial data by serial port of NRF5340 and then send it via BLE to a demanding device. In Peripherial_uart example

the direction of data flow is in opposite . 

Parents
  • Hi

    Uart 0 use pins 0x13, 0x14, 0x15 and 0x16. I found this in the zephyr.dst file:

    You can use other pins than these.
    In that case  you need  to change the pin configurations, you need to change the device tree. The nRF Connect SDK Tutorial - Part 2 describes how to change the device tree. I recommend the whole three part tutorial for learning how to work with NCS, it explained the concepts very well.

    You should use 3.3v:
    Look at the GPIO levels in the Regulators documentation of the nRF5340.

    Regards,
    Hellesvik

  • Hi again

    Actually I don't understand the meaning of <0x16> and <0x14>.What is its equivalent GPIO pin number

    in NRF5340-DK development board. As far as I searched the schematic of this board I couldn't find RX

    and TX pins of Uart_0 to which you can connect your serial device.

  • Hi again

    Actually I don't understand the meaning of <0x16> and <0x14>.What is its equivalent GPIO pin number

    in NRF5340-DK development board. As far as I searched the schematic of this board I couldn't find RX

    and TX pins of Uart_0 to which you can connect your serial device.

  • Hi

    It was not wrong, the zephyr.dts file contains the compiled device tree, meaning that RX should be P0.16 and TX should be P0.14.
    See the Zephyr link overview on more information on the Zephyr build process.

    I am sorry, I was mistaken on the 0x16 and 0x14.

    In the "nrf52840dk_nrf52840.dts" file, the correct pins are listed

    Here pins are P0.06, P0.08, P0.05 and P0.09.

    In the nRF5340, the peripherals can be configured to use different pins. This is set from registers in the nRF5340. However, in NCS, you do not need to write to these registers manually. Instead, you configure the pins using ".dts" or ".overlay" files, and NCS automatically configures the nRF5340.

    This means you can change what pins you want to use for TX and RX if needed.

    Regards,
    Sigurd Hellesvik

  • /*
    * Copyright (c) 2020 Nordic Semiconductor ASA
    *
    * SPDX-License-Identifier: Apache-2.0
    */

    /dts-v1/;
    #include <nordic/nrf5340_cpuapp_qkaa.dtsi>
    #include "nrf5340_cpuapp_common.dts"

    / {
    model = "Nordic NRF5340 DK NRF5340 Application";
    compatible = "nordic,nrf5340-dk-nrf5340-cpuapp";

    chosen {
    zephyr,sram = &sram0_image;
    zephyr,flash = &flash0;
    zephyr,code-partition = &slot0_partition;
    zephyr,sram-secure-partition = &sram0_s;
    zephyr,sram-non-secure-partition = &sram0_ns;
    };
    };

    &spi2 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    sck-pin = <47>;
    miso-pin = <46>;
    mosi-pin = <45>;
    };

    &usbd {
    compatible = "nordic,nrf-usbd";
    status = "okay";
    };

    The above code is the  nrf5340dk_nrf5340_cpuapp.dts file in NSC.As you can see there is no

    Uart configuration code in this file.

Reply
  • /*
    * Copyright (c) 2020 Nordic Semiconductor ASA
    *
    * SPDX-License-Identifier: Apache-2.0
    */

    /dts-v1/;
    #include <nordic/nrf5340_cpuapp_qkaa.dtsi>
    #include "nrf5340_cpuapp_common.dts"

    / {
    model = "Nordic NRF5340 DK NRF5340 Application";
    compatible = "nordic,nrf5340-dk-nrf5340-cpuapp";

    chosen {
    zephyr,sram = &sram0_image;
    zephyr,flash = &flash0;
    zephyr,code-partition = &slot0_partition;
    zephyr,sram-secure-partition = &sram0_s;
    zephyr,sram-non-secure-partition = &sram0_ns;
    };
    };

    &spi2 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    sck-pin = <47>;
    miso-pin = <46>;
    mosi-pin = <45>;
    };

    &usbd {
    compatible = "nordic,nrf-usbd";
    status = "okay";
    };

    The above code is the  nrf5340dk_nrf5340_cpuapp.dts file in NSC.As you can see there is no

    Uart configuration code in this file.

Children
Related