This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

can't send data with usbd ble _uart example using ble_nus_data_send

I am trying to send data obtained from  my sensor (calculating with twi scanner example )  via BLE using the ble_nus_data_send function. I just tried to send this data via UART with app_usbd_cdc_acm_write function and it works correctly . but when I want to send the same data  via  BLE it does'nt function . the type of data that I am using iss uint32_t.

Could anyone help me to find a way to solve this problem?

this is the function that I am using to send the data :

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void sendcom(char c[]) {
uint8_t length;
length = strlen(c);
ret_code_t ret = app_usbd_cdc_acm_write(&m_app_cdc_acm,
c,
length);
ret = ble_nus_data_send(&m_nus,
spo2,
&length,
m_conn_handle);
if (ret == NRF_SUCCESS) {
NRF_LOG_RAW_INFO(" %s \n \r ", c);
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

here is where I  call  this function

Fullscreen
1
2
3
4
5
6
7
8
9
10
case NRF_TIMER_EVENT_COMPARE3:
if (cycle_timer == 1) {
cycle1();
}
if (cycle_timer % 2 == 0) {
itoa(spo2, result, 10);
strcat(result, "\r\n");
sendcom(result);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX