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

nrf_serial lib has bug ?

I found a small chance that I couldn't get any data from the s

#include "mt_sw_mutex.h"
#include "mt_transfer.h"
#include "nrf_serial.h"

#define NRF_LOG_MODULE_NAME mt_trsf
#include "nrf_log.h"
NRF_LOG_MODULE_REGISTER();


#define SERIAL_BUF_SIZE     256



#define OP_QUEUES_SIZE          3
#define APP_TIMER_PRESCALER     NRF_SERIAL_APP_TIMER_PRESCALER

NRF_SERIAL_DRV_UART_CONFIG_DEF(m_uarte0_drv_config,
                      8, 6,
                      0, 0,
                      NRF_UART_HWFC_DISABLED, NRF_UART_PARITY_EXCLUDED,
                      NRF_UARTE_BAUDRATE_115200,
                      UART_DEFAULT_CONFIG_IRQ_PRIORITY);

#define SERIAL_FIFO_TX_SIZE 1
#define SERIAL_FIFO_RX_SIZE 2048

NRF_SERIAL_QUEUES_DEF(serial0_queues, SERIAL_FIFO_TX_SIZE, SERIAL_FIFO_RX_SIZE);

#define SERIAL_BUFF_TX_SIZE 1
#define SERIAL_BUFF_RX_SIZE 10

NRF_SERIAL_BUFFERS_DEF(serial0_buffs, SERIAL_BUFF_TX_SIZE, SERIAL_BUFF_RX_SIZE);
NRF_SERIAL_CONFIG_DEF(serial0_config, NRF_SERIAL_MODE_DMA,
                      &serial0_queues, &serial0_buffs, NULL, NULL);
NRF_SERIAL_UART_DEF(serial0_uarte, 0);




static uint8_t m_polling = 1;

static void serial_cb(void)
{
    ret_code_t error_code;
    size_t len = 255;

        error_code = nrf_serial_read(&serial0_uarte, cache, SERIAL_BUF_SIZE, &len, 30);
        NRF_LOG_INFO("lens %d", len);


}

void mt_transfer_polling(void)
{
  serial_cb();
}

int mt_transfer_init(void *serial_cfg, mt_ble_tunnel_sd_wrap_t *tunnel_params)
{

    APP_ERROR_CHECK(nrf_serial_init(&serial0_uarte, &m_uarte0_drv_config, &serial0_config));

    return error_code;
}
erial library. At this time, the serial port has data input.

Parents Reply Children
No Data
Related