Hi, i'm using nRF52840
I'm using 2 uarts :
one (uart0) is only for logging and another one (uart1) is for communication.
I can send from both uart, i can see i receive datas from uart1 but i can't read it
I try to read with an event_handle, event occurs i go inside in correct case, i can see i'm in the good case (using docklight software i can send one charac then another... and each time i send one i enter in case for reading)
see below code for init :
NRF_SERIAL_DRV_UART_CONFIG_DEF(m_uart0_drv_config, ARDUINO_SDA_PIN, ARDUINO_SCL_PIN, ARDUINO_12_PIN, ARDUINO_13_PIN, APP_UART_FLOW_CONTROL_DISABLED, NRF_UART_PARITY_EXCLUDED, NRF_UART_BAUDRATE_57600, APP_IRQ_PRIORITY_LOWEST); NRF_SERIAL_DRV_UART_CONFIG_DEF(m_uart1_drv_config, RX_PIN_NUMBER, TX_PIN_NUMBER, RTS_PIN_NUMBER, CTS_PIN_NUMBER, APP_UART_FLOW_CONTROL_DISABLED, NRF_UART_PARITY_EXCLUDED, NRF_UART_BAUDRATE_19200, APP_IRQ_PRIORITY_LOWEST); NRF_SERIAL_QUEUES_DEF(serial0_queues, 32, 32); NRF_SERIAL_QUEUES_DEF(serial1_queues, 32, 32); NRF_SERIAL_BUFFERS_DEF(serial0_buffs, 1, 1); NRF_SERIAL_BUFFERS_DEF(serial1_buffs, 1, 1); NRF_SERIAL_CONFIG_DEF(serial0_config, NRF_SERIAL_MODE_IRQ, &serial0_queues, &serial0_buffs, NULL, sleep_handler); NRF_SERIAL_CONFIG_DEF(serial1_config, NRF_SERIAL_MODE_IRQ, &serial1_queues, &serial1_buffs, uart_event_handle, sleep_handler); NRF_SERIAL_UART_DEF(serial0_uart, 0); NRF_SERIAL_UART_DEF(serial1_uart, 1);
and code for event_handle :
void uart_event_handle(struct nrf_serial_s const * p_serial, nrf_serial_event_t event) { switch (event) { case NRF_SERIAL_EVENT_RX_DATA : //I enter each time i send one charac SEGGER_RTT_WriteString(0, "Uart : NRF_SERIAL_EVENT_RX_DATA\n"); mbedtls_mutex_lock( &mutex_uart ); char c; nrf_serial_read(&serial1_uart, &c, sizeof(c), NULL, 1000); SEGGER_RTT_printf(0, "Data reçue : %#02x \n", c); //I always receive 10 mbedtls_mutex_unlock( &mutex_uart ); default: SEGGER_RTT_WriteString(0, "Uart : default\n"); break; } }
All this code comes from examples provided bay sdk...
maybe i'm not reading the correct buffer but i don't know which one to read then.
thx for help
Geoffroy