Hello All,
I have 2 evaluation boards nrf53840 EVB "PCA10056".
I would like to run on them the "ble_app_uart" in "nRF5_SDK_15.3.0_59ac345" as following:
- A custom board send via uart a buffer for example of 30 characters to the peripheral on the pin P0.26 every 5 ms.
- The Board "peripheral" send this packet via bluetooth to the "central board" (where I uploaded the "ble_app_uart_c" code)
- The "central board" print via uart the packet received.
Let's say that I have previous tried to remove all the possible bottle necks of the app, for instance commenting out the part where the bytes received from the central board are sent back again:
static void ble_nus_chars_received_uart_print(uint8_t * p_data, uint16_t data_len)
{
ret_code_t ret_val;
NRF_LOG_DEBUG("Receiving data.");
NRF_LOG_HEXDUMP_DEBUG(p_data, data_len);
for (uint32_t i = 0; i < data_len; i++)
{
do
{
ret_val = app_uart_put(p_data[i]);
if ((ret_val != NRF_SUCCESS) && (ret_val != NRF_ERROR_BUSY))
{
NRF_LOG_ERROR("app_uart_put failed for index 0x%04x.", i);
APP_ERROR_CHECK(ret_val);
}
} while (ret_val == NRF_ERROR_BUSY);
}
if (p_data[data_len-1] == '\r')
{
while (app_uart_put('\n') == NRF_ERROR_BUSY);
}
// if (ECHOBACK_BLE_UART_DATA)
// {
// // Send data back to the peripheral.
// do
// {
// ret_val = ble_nus_c_string_send(&m_ble_nus_c, p_data, data_len);
// if ((ret_val != NRF_SUCCESS) && (ret_val != NRF_ERROR_BUSY))
// {
// NRF_LOG_ERROR("Failed sending NUS message. Error 0x%x. ", ret_val);
// APP_ERROR_CHECK(ret_val);
// }
// } while (ret_val == NRF_ERROR_BUSY);
// }
}
Then I tried to put this part of code:
ble_gap_phys_t const phys =
{
.rx_phys = BLE_GAP_PHY_2MBPS,
.tx_phys = BLE_GAP_PHY_2MBPS,
};
err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
APP_ERROR_CHECK(err_code);
at the end of the BLE_GAP_EVT_CONNECTED event in the following routine:
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
on_connect(p_ble_evt);
ret_code_t err_code;
ble_gap_phys_t const phys =
{
.rx_phys = BLE_GAP_PHY_2MBPS,
.tx_phys = BLE_GAP_PHY_2MBPS,
};
err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
APP_ERROR_CHECK(err_code);
break;
case BLE_GAP_EVT_DISCONNECTED:
on_disconnect(p_ble_evt);
break;
case BLE_GATTS_EVT_WRITE:
on_write(p_ble_evt);
break;
case BLE_GAP_EVT_CONN_PARAM_UPDATE:
on_conn_params_update(p_ble_evt);
break;
}
}
In order to request a phy change (I hope so).
But when I start to send the packet to the board at that speed they disconnect.
Am I doing any mistake?
Should I change something else in order to get a phy change and using the 2Mbps?
Are there any other bottle necks that I am missing?
Thanks in advance,