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

Device is not advertising when creating custom service using UART service

Hi,

In my application I am creating one more custom service using UART service. I have created new files named ble_nus1.c and ble_nus1.h. In these files I have changed the variable names . But still the device is not advertising when flashing the code.

I am attaching main file and library files here. please can any help me to resolve the issue.

nus_hrs.c

library files:

ble_nus2.c

ble_nus2.h

Parents
  • In ble_stack_init, you need to increase ble_enable_params.common_enable_params.vs_uuid_count when adding a custom service with a 128-bit UUID.

  • Hi Jastin,

    Thank you so much for the reply. Yes by changing the count to 2 it starts advertising. I can see the two different services on APP. But when I enable both notification only then I am receiving data using second custom service.
    following is the code to send any rough values to custom service from nrf52.

    				void send_to_app()
    		{
    			uint32_t    err_code;
    			uint8_t buff[10] = {0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x55};
    		//    err_code = ble_nus_string_send(&m_nus, buff, 20);
    		//    if (err_code != NRF_ERROR_INVALID_STATE)
    		//    {
    		//			APP_ERROR_CHECK(err_code);
    		//    }		
    			err_code = ble_nus_string_send1(&m_nus1, buff, 20);
    			if (err_code != NRF_ERROR_INVALID_STATE)
    			{
    					APP_ERROR_CHECK(err_code);
    			}
    

    Here I am using two different functions which points to to two different libraries that I have crested for two services.

    When I enable notification of custom service control should transfer to data_handler 1 when send any data data from app. It is not happening.

Reply
  • Hi Jastin,

    Thank you so much for the reply. Yes by changing the count to 2 it starts advertising. I can see the two different services on APP. But when I enable both notification only then I am receiving data using second custom service.
    following is the code to send any rough values to custom service from nrf52.

    				void send_to_app()
    		{
    			uint32_t    err_code;
    			uint8_t buff[10] = {0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x55};
    		//    err_code = ble_nus_string_send(&m_nus, buff, 20);
    		//    if (err_code != NRF_ERROR_INVALID_STATE)
    		//    {
    		//			APP_ERROR_CHECK(err_code);
    		//    }		
    			err_code = ble_nus_string_send1(&m_nus1, buff, 20);
    			if (err_code != NRF_ERROR_INVALID_STATE)
    			{
    					APP_ERROR_CHECK(err_code);
    			}
    

    Here I am using two different functions which points to to two different libraries that I have crested for two services.

    When I enable notification of custom service control should transfer to data_handler 1 when send any data data from app. It is not happening.

Children
No Data
Related