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

nRF52 sdk15..0.0 uart event question.

Hi, I'm using nRF52832 with my custom board. (sdk 15.0.0)

I changed ble_uart example code, so I can receive GPS data through bluetooth.

Now, I have to send GPS data to PC through UART and I succeed in receiving GPS data to my PC and UART app simultaneously.

Here's the problem. I want to receive GPS data to my pc when I am not using ble service.

However I found that APP_UART_DATA_READY event is only active when I connect app through bluetooth.

void uart_event_handle(app_uart_evt_t * p_event)
{
    static uint8_t data_array[BLE_NUS_MAX_DATA_LEN];
    static uint8_t index = 0;
    uint32_t       err_code;
	static uint8_t error_data[14]={'I','n','v','a','l','i','d',' ','d','a','t','a','\n','\r'};
	
    switch (p_event->evt_type)
    {
        case APP_UART_DATA_READY:
						
            UNUSED_VARIABLE(app_uart_get(&data_array[index]));
            index++;
				if(delay_time){

Is there a any uart event type that I can use without connect with bluetooth?

Thanks.

Parents
  • That is probably because your app is calling ble_nus_data_send inside  APP_UART_DATA_READY event handling even though you are not connected and this will return an error. Not sure how you are handling it. I am guessing that you are still getting one APP_UART_DATA_READY event and nothing after that. 

    I cannot see your code but you need to put a condition around ble_nus_data_send to send BLE data only when in connection and not otherwise.

Reply
  • That is probably because your app is calling ble_nus_data_send inside  APP_UART_DATA_READY event handling even though you are not connected and this will return an error. Not sure how you are handling it. I am guessing that you are still getting one APP_UART_DATA_READY event and nothing after that. 

    I cannot see your code but you need to put a condition around ble_nus_data_send to send BLE data only when in connection and not otherwise.

Children
Related