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

Thingy:91 nRF52840 UART configuration

Hi,

We want to make some BLE application for nRF52840 on Thingy:91. Referring to PCA20035 schematic, there are some spare pins which we assume is available for GPIO as backed up by nrf52840 pin functionality described in nRF52840 Product specification v1.2.

The pins are configured as:

#define UART_RX                         NRF_GPIO_PIN_MAP(0,6)                     // Refer to PCA20035 schematics
#define UART_TX                         NRF_GPIO_PIN_MAP(0,5)

void uart_config()
{
      uint32_t err_code;  
      uint8_t * tx_data = (uint8_t *)("\r\nUART CONFGED\r\n");
      
      nrf_gpio_cfg_input(UART_RX, NRF_GPIO_PIN_PULLUP);
      nrf_gpio_cfg_output(UART_TX);
      
      const app_uart_comm_params_t comm_params =
      {
          UART_RX,                                 //RX
          UART_TX,                                 //TX
          RTS_PIN_NUMBER,                          //RTS
          CTS_PIN_NUMBER,                          //CTS
          UART_HWFC,                              
          false,                                   //Parity
          NRF_UART_BAUDRATE_115200                 //Baudrate
      };

      APP_UART_FIFO_INIT(&comm_params,
                           UART_RX_BUF_SIZE,
                           UART_TX_BUF_SIZE,
                           uart_error_handle,
                           APP_IRQ_PRIORITY_LOWEST,
                           err_code);
      
      for (uint32_t i = 0; i < 17; i++)
      {
          app_uart_put(tx_data[i]);
          nrf_delay_ms(10);
      }
      return;
}

As we are not using Hardware flow control, we are not bothered about those pins. We cannot see anything on the terminal emulator (Teraterm). The application is based on Softdevice S140 v6.0.0 with nRF SDK 15.0.0. This is a snippet from sdk config.

#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 1
#endif

// <o> NRFX_UART_DEFAULT_CONFIG_HWFC  - Hardware Flow Control
 
// <0=> Disabled 
// <1=> Enabled 

#ifndef NRFX_UART_DEFAULT_CONFIG_HWFC
#define NRFX_UART_DEFAULT_CONFIG_HWFC 0
#endif

// <o> NRFX_UART_DEFAULT_CONFIG_PARITY  - Parity
 
// <0=> Excluded 
// <14=> Included 

#ifndef NRFX_UART_DEFAULT_CONFIG_PARITY
#define NRFX_UART_DEFAULT_CONFIG_PARITY 0
#endif

// <o> NRFX_UART_DEFAULT_CONFIG_BAUDRATE  - Default Baudrate
 
// <323584=> 1200 baud 
// <643072=> 2400 baud 
// <1290240=> 4800 baud 
// <2576384=> 9600 baud 
// <3866624=> 14400 baud 
// <5152768=> 19200 baud 
// <7729152=> 28800 baud 
// <8388608=> 31250 baud 
// <10309632=> 38400 baud 
// <15007744=> 56000 baud 
// <15462400=> 57600 baud 
// <20615168=> 76800 baud 
// <30924800=> 115200 baud 
// <61845504=> 230400 baud 
// <67108864=> 250000 baud 
// <123695104=> 460800 baud 
// <247386112=> 921600 baud 
// <268435456=> 1000000 baud 

#ifndef NRFX_UART_DEFAULT_CONFIG_BAUDRATE
#define NRFX_UART_DEFAULT_CONFIG_BAUDRATE 30924800
#endif

Is there anything which is missing for UART configuration on nRF52840?

Thanks!!

Shivek

Parents Reply
  • Hi Jonathan,

    Thanks for the links. I went through these links but unfortunately these links are associated with getting the pins accessed from nrf9160 not from nrf52840, on top of that these links talk about device tree structure of Zephyr whereas I am using Softdevice . To be more transparent, I want to get access to UART peripheral from nRF52840 on Thingy:91. So, I thought I may use the spare pins available from nrf52840 which is mentioned in my first post. But I still not getting any response from UART.

    I tried monitoring UART with scope on pin 5 and 6 of port P6 of Thingy:91 as described in Thingy:91 schematics

    But I was not sure about which pin is number 6 and 5. So, I had to check them all.

    So, I would really appreciate if you can help me with the UART configuration from nRF52840 (using Softdevice APIs).

    Regards,

    Shivek

Children
Related