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

Setting up hardware uart with Nordic Thingy 52

Hello,

Im new to the Nordic Ecosystem, and have been trying to set hardware uart with Nordic Thingy 52 with CP210x  using the sdk13 uart example. I included the uart driver and library c paths into the makefile and included the app_uart.h header into the main.c file. Any help would be great. I am using JLink for flashing.

Thank you

Parents Reply Children
  • My cp210x module (has an led light which indicates data passing through) is not picking up any rx/tx data even after setting the pin to 0.02  and 0.03 in the sdk_config.h file which is a gpio pin. I am also running a serial terminal at a baud rate of 115200 which what it is set in the sdk config five and in my code.

  • I also tried to use the uart driver directly and came up with this (ignore the red error warning as it only appers when you copy from VS code and isnt visible in the IDE itself)

    #include <stdbool.h>
    #include <stdint.h>
    #include <stdio.h>
    #include "nrf_drv_uart.h"
    #include "app_error.h"
    #include "nrf_delay.h"
    #include "nrf.h"
    #include "pca20020.h"


    void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
    {

    }
    //#define ENABLE_LOOPBACK_TEST /**< if defined, then this example will be a loopback test, which means that TX should be connected to RX to get data loopback. */

    #
    /**
    * @brief Function for main application entry.
    */
    int main(void)
    {
    nrf_drv_uart_t uart_driver_instance = NRF_DRV_UART_INSTANCE(UART0_INSTANCE_INDEX);
    nrf_drv_uart_config_t config = {
    .pseltxd = TX_PIN_NUMBER,
    .pselrxd = RX_PIN_NUMBER,
    .pselcts = CTS_PIN_NUMBER,
    .pselrts = RTS_PIN_NUMBER,
    .p_context = NULL,
    .hwfc = NRF_UART_HWFC_DISABLED,
    .parity = NRF_UART_PARITY_EXCLUDED,
    .baudrate = (nrf_uart_baudrate_t)30801920,
    .interrupt_priority = UART_DEFAULT_CONFIG_IRQ_PRIORITY,
    };
    config.use_easy_dma = true;
    nrf_drv_uart_init(&uart_driver_instance, &config, NULL);
    while (true){
    uint8_t x = 95;
    nrf_drv_uart_tx(&uart_driver_instance, &x, 1);
    }
    }
  • Hi, you should catch the status code being returned from the nrf_drv_uart_init and tx calls, and see if you get any errors.

Related