my dk board is nrf51422 and nrf 52382,
the central role is nrf51422, and the peripheral role is 52382.
my sdk version of 52422 is 10.0.0 and 0.9.2 for 52382
the project of 51422 is ble_app_uart_c and the project of 52382 is ble_app_uart
i want to send to GATTserver data through uart byte by byte,so i change the project like this:
//51422
void uart_event_handle(app_uart_evt_t * p_event)
{
static uint8_t mychar;;
static uint8_t index = 0;
switch (p_event->evt_type)
{
/**@snippet [Handling data from UART] */
case APP_UART_DATA_READY:
UNUSED_VARIABLE(app_uart_get(&mychar));
printf("mychar :%c\r\n",mychar);
{
while (ble_nus_c_string_send(&m_ble_nus_c, &mychar, 1) != NRF_SUCCESS)
{
// repeat until sent
}
}
break;
/**@snippet [Handling data from UART] */
case APP_UART_COMMUNICATION_ERROR:
APP_ERROR_HANDLER(p_event->data.error_communication);
break;
case APP_UART_FIFO_ERROR:
APP_ERROR_HANDLER(p_event->data.error_code);
break;
default:
break;
}
}
//52382
static void nus_data_handler(ble_nus_t * p_nus, uint8_t * p_data, uint16_t length)
{
for (uint32_t i = 0; i < length; i++)
{
while(app_uart_put(p_data[i]) != NRF_SUCCESS);
}
//while(app_uart_put('\n') != NRF_SUCCESS);
}
If i send byte by byte ,it can be sent to the perpheral.
And if i send two to bytes at once,it can also be sent to the perpheral
And if i send mor than five bytes at once,it just can be sent four of five,and the uart is dead.
The same thing happened to the notify , too.
i changed the project in 52382, and sent byte by byte.
//52382
void uart_event_handle(app_uart_evt_t * p_event)
{
static uint8_t mychar;
uint32_t err_code;
switch (p_event->evt_type)
{
case APP_UART_DATA_READY:
UNUSED_VARIABLE(app_uart_get(&mychar));
{
err_code = ble_nus_string_send(&m_nus, &mychar, 1);
if (err_code != NRF_ERROR_INVALID_STATE)
{
APP_ERROR_CHECK(err_code);
}
}
break;
case APP_UART_COMMUNICATION_ERROR:
APP_ERROR_HANDLER(p_event->data.error_communication);
break;
case APP_UART_FIFO_ERROR:
APP_ERROR_HANDLER(p_event->data.error_code);
break;
default:
break;
}
}
At this time,it can just be sent up to 3 bytes....
Is there anyont know this issue?
thank you very much..