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

Getting invalid state error after executing ble_nus_data_send() function in the Nordic SDK 15.0.0 example code.

HI,

The nordic MCU I am using is NRF52832.

I am flashing the example code ble_app_uart which is coming in the directory "nRF5_SDK_15.0.0_a53641a\examples\ble_peripheral\" as part of the SDK example code.

When starting, I got build issue due to redeclaration of putchar() which I resolved by changing FILE * in int __putchar(int ch, FILE * p_file) to int __putchar(int ch, __printf_tag_ptr p_file).

After this, when I compiled and executed the code, I was succesfuly able to see two custom characteristics. And when I connected to the NRF device from nrfConnect app using BLE, I couldnt

see any prints in the TeraTerm application (in the COM port corresponding to the NRF device).

I tried to hardcode some data and send it to nrfConnect app using the function ble_nus_data_send(), but I was getting INVALID_STATE_ERROR.

I tried the steps in this link also 

NRF_ERROR_INVALID_STATE when calling ble_nus_data_send after connection is established (https://devzone.nordicsemi.com/f/nordic-q-a/42244/nrf_error_invalid_state-when-calling-ble_nus_data_send-after-connection-is-established/164647#164647). 

But I couldnt see any prints corresponding to check whether notifications are enabled or not.

Kindly help in resolving this issue.

Related