UART tx using thingy91

Hello,

I am using uart with thingy:91 to communicate between nrf52 SoC and nrf91 SiP, i am able to receive data from nrf52 but when i try to send data to nrf52 SoC the function uart_irq_tx_ready always returns 0 "UART TX is not ready", btw I am using uart0 for both nrf52 and nrf91 and for nrf91 I am using interrupt driven mode and for nrf52 I am using async api mode.

Here is my init code for nrf91 SiP and how i try to send data:

void uart_init(void)
{
    int ret;
  if (!uart_dev) {
    LOG_ERR("UART_0 failed");
    return;
  }
  ret = uart_irq_callback_user_data_set(uart_dev, uart_cb, NULL);
  if (ret < 0)
  {
    if (ret == -ENOTSUP)
    {
      LOG_ERR("Interrupt-driven UART API support not enabled\n");
    }
    else if (ret == -ENOSYS)
    {
      LOG_ERR("UART device does not support interrupt-driven API\n");
    }
    else
    {
      LOG_ERR("Error setting UART callback: %d\n", ret);
    }
    return 0;
  }
  uart_irq_rx_enable(uart_dev);
  LOG_INF("UART initialized");
}
void send_data_to_nrf52(int64_t timestamp_unix)
{
    int ret;
    uint8_t data[8];
    int64_to_uint8_array(data, timestamp_unix);
    LOG_DBG("Sending : %x | %x | %x | %x | %x | %x | %x | %x ", data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7]);
    uart_irq_tx_enable(uart_dev);
    if (!uart_irq_update(uart_dev)) {
    LOG_DBG("uart_irq_update failed");
    return;
    }
    if(uart_irq_tx_ready(uart_dev) == 0) // the issue is here always 0
    {
        LOG_ERR("UART TX not ready");
        uart_irq_tx_enable(uart_dev);
    }
    // Enable TX interrupt
   
    ret = uart_fifo_fill(uart_dev, data, sizeof(data));
    if(ret == ENOSYS || ret == ENOTSUP)
    {
        LOG_ERR("UART device does not support interrupt-driven API , error code : %d",ret);
    }
    else
    {
        LOG_INF("Data sent to nrf52 , number of bytes sent : %d",ret);
    }
    uart_irq_tx_disable(uart_dev); // disable the tx interrupt
}
Related