Hi,
Im working on n2f52805 where i need to include uart in my application.But when i call APP_UART_INIT function it is giving an event in uart_event_handle and giving the error APP_UART_COMMUNICATION_ERROR .In this project custom ble is working.I don't want to use uart fifo so i removed app_uart_fifo.c and added app_uart.c .
void uart_event_handle(app_uart_evt_t * p_event)
{
static uint8_t data_array[MAX_DATA_LEN];
static uint8_t index = 0;
uint32_t err_code;
NRF_LOG_INFO("uart_event_handle.");
switch (p_event->evt_type)
{
case APP_UART_DATA_READY:
NRF_LOG_INFO("APP_UART_DATA_READY.");
UNUSED_VARIABLE(app_uart_get(&data_array[index]));
break;
case APP_UART_COMMUNICATION_ERROR:
NRF_LOG_INFO("APP_UART_COMMUNICATION_ERROR.");
APP_ERROR_HANDLER(p_event->data.error_communication);
break;
case APP_UART_FIFO_ERROR:
NRF_LOG_INFO("APP_UART_FIFO_ERROR.");
APP_ERROR_HANDLER(p_event->data.error_code);
break;
default:
break;
}
}
/**@brief Function for initializing the UART module.
*/
/**@snippet [UART Initialization] */
static void uart_init(void)
{
uint32_t err_code = NRF_SUCCESS;
app_uart_comm_params_t const comm_params =
{
.rx_pin_no = RX_PIN_NUMBER,
.tx_pin_no = TX_PIN_NUMBER,
.rts_pin_no = RTS_PIN_NUMBER,
.cts_pin_no = CTS_PIN_NUMBER,
.flow_control = APP_UART_FLOW_CONTROL_DISABLED,
.use_parity = false,
#if defined (UART_PRESENT)
.baud_rate = NRF_UART_BAUDRATE_115200
#else
.baud_rate = NRF_UARTE_BAUDRATE_115200
#endif
};
APP_UART_INIT(&comm_params, uart_event_handle, APP_IRQ_PRIORITY_LOWEST, err_code);
NRF_LOG_INFO("UART INIT %d.",err_code);
APP_ERROR_CHECK(err_code);
}
/**@brief Application main function.
*/
int main(void)
{
bool erase_bonds;
// Initialize.
log_init();
uart_init();
/* timers_init();
buttons_leds_init(&erase_bonds);
power_management_init();
ble_stack_init();
gap_params_init();
gatt_init();
services_init();
advertising_init();
conn_params_init();
//peer_manager_init();
// Start execution.
NRF_LOG_INFO("Template example started.");
application_timers_start();
advertising_start(erase_bonds);
// Enter main loop.
for (;;)
{
idle_state_handle();
}*/
while(1){
app_uart_put('A');
app_uart_put('K');
app_uart_put('S');
app_uart_put('H');
app_uart_put('A');
app_uart_put('Y');
app_uart_put('\n');
}
}