my dk board : nrf51422 and nrf 52382,
the central role : nrf51422, and the peripheral role is 52382.
my sdk version : 52422 is 10.0.0 and 0.9.2 for 52382
the project : 51422 is ble_app_uart_c and the project of 52382 is ble_app_uart
i want to send to GATT server data through uart byte by byte,
in my given project(which shows in the end of my question),this means that the the uart will print four consecutive characters.
i.e. if i input 'a', the uart will print 'abcd'
and the uart is not died.
but if i change
for(index = 0 ; index < 4 ; index ++)
to
for(index = 0 ; index < 5 ; index ++)
it can only print the front four characters
i.e. i input '1' , the uart print '1234' and the uart is died.
this means , i can not call the 'sd_ble_gattc_write' for four times consecutively
it is the same take string instead of characters, and i wanna know why it is happens and do not use the array or string instead of the characters. :(
code shows here:
void uart_event_handle(app_uart_evt_t * p_event)
{
static uint8_t mychar = 'a';
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);
{
for(index = 0 ; index < 4 ; index ++)
{
while (ble_nus_c_string_send(&m_ble_nus_c, &mychar, 1) != NRF_SUCCESS)
// repeat until sent
}
mychar += 1;
}
}
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;
}
}