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

Getting error code 4 while trying to initialize device information services repeatedly from main

Hi 

I am working on the application in which I wanted to initialize and uninitialize different services. I am using device information services to read manufacturer data from connected devices. 

below is my code snippet for initialization and initialization of dis services. 

static ble_dis_init_t dis_init;

void dis_init( void )

{

memset( &dis_init, 0, sizeof(ble_dis_init_t) );
ble_srv_ascii_to_utf8( &dis_init.manufact_name_str, (char*)MANUFACTURER_NAME );

dis_init.dis_char_rd_sec = SEC_OPEN;
ret_code_t error_code = ble_dis_init( &dis_init );
APP_ERROR_CHECK( error_code );

}

void dis_uninit( void )

{

dis_init.dis_char_rd_sec = SEC_NO_ACCESS;
dis_init.manufact_name_str.length = 0;
dis_init.manufact_name_str.p_str = NULL;

}

This routine is working fine when I call this once from my main code. but if I call this repeatedly (when 3rd time it is called) from my code "ble_dis_init(  &dis_init) returns error code 4.

One solution I know I can change my RAM settings but that wont resolve my issue. 

Am I doing anything wrong in this?

Thanks 

KRA

Parents Reply Children
No Data
Related