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

connect to the nRF52840-DK with the STM32F103 development board

Hi, recently I want to establish a connection between two development boards (STM32F103 + nRF52840-DK), that the STM32f103 board can create the data and send it to the nRF52840-DK, the openwsn has been ported to the nRF52840-DK. I want to combine development boards and Component wireless sensor networks. But I find that the nRF52840-DK has only one usart port pin(reference datasheet), If there has the other UARTport I don't find, please correct me. So I want to use other communication protocols (like I2C and SPI, etc). But I am not familiar with 52840 programming, I hope I can provide some help.

Parents
  • the nRF52840 has 2 UART. The reason why you don't see a specific pin for it is because any gpio pin can be used for it.  You see only 1 uart pin on the DK because it is being used and connected to the onboard jlink. The 2 uart is not used therefore not mapped anywhere. 

  • Thanks, I have found the definition of the serialization_application_board. If I can use this port to implement UART communication? 

  • I want to know how to specify the specific configuration of the UART1. I always configure the UART0 and the UART1 doesn't work.Which files should I modify.

    void uart_init(){

    const app_uart_comm_params_t comm_params =
    {
    SER_APP_RX_PIN,SER_APP_TX_PIN,
    SER_APP_RTS_PIN,SER_APP_CTS_PIN,
    /*RX_PIN_NUMBER,
    TX_PIN_NUMBER,
    RTS_PIN_NUMBER,
    CTS_PIN_NUMBER,*/
    UART_HWFC,
    false,
    #if defined (UART_PRESENT)
    NRF_UART_BAUDRATE_115200
    #else
    NRF_UARTE_BAUDRATE_115200
    #endif
    };

    APP_UART_FIFO_INIT(&comm_params,
    UART_RX_BUF_SIZE,
    UART_TX_BUF_SIZE,
    uart_error_handle,
    APP_IRQ_PRIORITY_LOWEST,
    err_code);

    APP_ERROR_CHECK(err_code);

    }

  • kyh-ly said:
    I want to know how to specify the specific configuration of the UART1.

    Depending on what you would like to configure, it is either done in sdk_config or during the initialization.

    kyh-ly said:
    I always configure the UART0 and the UART1 doesn't work.Which files should I modify.

    The UART instance is configured in your sdk_config file, and the global instance should be initialized at the beginning of your main file.
    What is your UART configurations in sdk_config?

    Best regards,
    Karl

  • Same as sdk_config.h provided in the UART example.

    //UARTE configure

    #ifndef NRFX_UARTE_ENABLED
    #define NRFX_UARTE_ENABLED 1
    #endif
    // <o> NRFX_UARTE0_ENABLED - Enable UARTE0 instance
    #ifndef NRFX_UARTE0_ENABLED
    #define NRFX_UARTE0_ENABLED 0
    #endif

    // <o> NRFX_UARTE1_ENABLED - Enable UARTE1 instance
    #ifndef NRFX_UARTE1_ENABLED
    #define NRFX_UARTE1_ENABLED 0
    #endif

    //NRFX_UART_ENABLED - nrfx_uart - UART peripheral driver

    #ifndef NRFX_UART_ENABLED
    #define NRFX_UART_ENABLED 1
    #endif
    // <o> NRFX_UART0_ENABLED - Enable UART0 instance
    #ifndef NRFX_UART0_ENABLED
    #define NRFX_UART0_ENABLED 0
    #endif

    // <e> UART_ENABLED - nrf_drv_uart - UART/UARTE peripheral driver - legacy layer
    //==========================================================
    #ifndef UART_ENABLED
    #define UART_ENABLED 1
    #endif


    // <e> UART0_ENABLED - Enable UART0 instance
    //==========================================================
    #ifndef UART0_ENABLED
    #define UART0_ENABLED 1
    #endif
    // <q> UART0_CONFIG_USE_EASY_DMA - Default setting for using EasyDMA

    #ifndef UART0_CONFIG_USE_EASY_DMA
    #define UART0_CONFIG_USE_EASY_DMA 1
    #endif

    // </e>

    // <e> UART1_ENABLED - Enable UART1 instance
    //==========================================================
    #ifndef UART1_ENABLED
    #define UART1_ENABLED 0
    #endif

  • Can there have a complete using uart0 and uart1 transmission example? It's difficult for me to work for it. And I also find I can not use two UARTs(UART1 and UART0) at the same time.By configurating APP_UART_DRIVER_INSTANCE 0/1, I can use UART0/UART1 respectively.

  • Hello,

    From the sdk_config you shared - which is the same as the UART example's - it is apparent that you are only enabling UART0, and not UART1.
    This is the reason why you are not able to use UART1.
    Please define UART1_ENABLED to 1, and see if you then are able to create a UART1 instance in your application.

    kyh-ly said:
    And I also find I can not use two UARTs(UART1 and UART0) at the same time.

    Please be advised that when you are using the legacy UART ( instead of nrfx_uarte ) the CPU will need to be involved in each transfer. Instead, I recommend that you use the nrfx_uarte driver, which uses the easyDMA feature.
    Which SDK version are you working with?

    Best regards,
    Karl

Reply
  • Hello,

    From the sdk_config you shared - which is the same as the UART example's - it is apparent that you are only enabling UART0, and not UART1.
    This is the reason why you are not able to use UART1.
    Please define UART1_ENABLED to 1, and see if you then are able to create a UART1 instance in your application.

    kyh-ly said:
    And I also find I can not use two UARTs(UART1 and UART0) at the same time.

    Please be advised that when you are using the legacy UART ( instead of nrfx_uarte ) the CPU will need to be involved in each transfer. Instead, I recommend that you use the nrfx_uarte driver, which uses the easyDMA feature.
    Which SDK version are you working with?

    Best regards,
    Karl

Children
No Data
Related