Hi!
I'm using the ble_app_uart example with SDK 15.0.3 and nRF52840 DK. I'm using Termite as the terminal.
When receiving data from an iPad to the nRF, with the nRF as the peripheral, the nus_data_handler is invoked. I want to print the data received to the terminal, so that I can verify it. It seems to print, but it prints in ASCII, so it's not really readable. Is there a way to make it HEX or just turn off this "automatic" print so I can print it my self? In the code below is the nus_data_handler and I have figured out which line somehow does the printing, but I can not figure out how to change it.
static void nus_data_handler(ble_nus_evt_t * p_evt) { if (p_evt->type == BLE_NUS_EVT_RX_DATA) { uint32_t err_code; printf("\n\nReceived data from iPad!\n"); NRF_LOG_DEBUG("Received data from BLE NUS. Writing data on UART."); //NRF_LOG_HEXDUMP_DEBUG(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length); for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++) { do { printf("[ %i ] ", p_evt->params.rx_data.p_data[i]); // print to serial monitor err_code = app_uart_put(p_evt->params.rx_data.p_data[i]); // send data on byte on UART //printf("*"); if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_BUSY)) { NRF_LOG_ERROR("Failed receiving NUS message. Error 0x%x. ", err_code); APP_ERROR_CHECK(err_code); } } while (err_code == NRF_ERROR_BUSY); } if (p_evt->params.rx_data.p_data[p_evt->params.rx_data.length - 1] == '\r') { while (app_uart_put('\n') == NRF_ERROR_BUSY); } } }
The code line that does printing to the terminal is
err_code = app_uart_put(p_evt->params.rx_data.p_data[i]); // send data on byte on UART
Any help would be appreciated!