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

Error with multiple UART

Hi, I am trying to connect a GPS through UART to nRF52 and get the reading and write it to the serial USB of my PC. I am using app_uart_init() and app_uart_close(). My idea is to init the GPS UART, get a reading, then close it; init the serial USB, write the GPS reading and close it. For now, I am just testing the code (init and close fns) without getting GPS readings, and with writing a standard text. I am getting junk character through the serial USB. Any idea ?

const app_uart_comm_params_t comm_params =
  {
      8,
      6,
      RTS_PIN_NUMBER,
      CTS_PIN_NUMBER,
      APP_UART_FLOW_CONTROL_ENABLED,
      false,
      UART_BAUDRATE_BAUDRATE_Baud115200
  };

const app_uart_comm_params_t comm_params_GPS =
  {
      17,
      18,
      0,
      1,
      APP_UART_FLOW_CONTROL_DISABLED,
      false,
      UART_BAUDRATE_BAUDRATE_Baud115200
  };
  while(1){
      APP_UART_FIFO_INIT(&comm_params_GPS,
                     UART_RX_BUF_SIZE,
                     UART_TX_BUF_SIZE,
                     uart_event_handle_GPS,
                     APP_IRQ_PRIORITY_LOW,
                     err_code);
app_uart_close();

APP_UART_FIFO_INIT(&comm_params,
                     UART_RX_BUF_SIZE,
                     UART_TX_BUF_SIZE,
                     uart_event_handle,
                     APP_IRQ_PRIORITY_LOW,
                     err_code);
printf("\nTest\n");

app_uart_close();	
nrf_delay_ms(2000)	;
}		 
Related