BEACON USING AT COMMANDS DA14531

Hello,

I want to build a Beacon using  the DA14531MOD-00F01002 module and a PIC microcontroller. 

The Pic microcontroller should control the DA14531 module via  AT commands. I read the CodeLess

manual and I sаw that the commands "AT+ADVDATA" and "AT+ADVRESP" for DA14531 are not available.

How can I configure the Beacon advertising data and how to configure advertising to be

Non-Connectable?

 

  • Hi GeorgeY,

    Thank you for posting your question online.
    Yes, according to the Codeless User Manual the ADVDATA and ADVRESP AT commands are not available for DA14531.
    You could modify the Codeless SDK and insert your own Advertising Data and set the advertising mode to non-connectable. 
    If you are new to our SDK6 I would suggest checking the following tutorials:
    DA145xx Tutorial SDK6 Getting Started — DA145XX Tutorial SDK Getting started (renesas.com)
    DA145XX Tutorial BLE Advertising — DA145XX Tutorial BLE Advertising (renesas.com)
    With these tutorials you will have a better understanding of the SDK6 features and how to work with Advertising.
    On Codeless SDK,if you go on user_callback_config.h file you can see that for default advertising we have declared a custom callback function called user_advertise:

    static const struct default_app_operations user_default_app_operations = {
        //.default_operation_adv = user_advertise, // advertise at startup
        .default_operation_adv = user_advertise, // NULL in order to not advertise at startup
    };
    

    On user_codeless.c you can find the implementation of user_advertise callback function:
    void user_advertise(void)
    {
        struct gapm_start_advertise_cmd* cmd;
    
        if (codeless_env.is_connectable) {
            cmd = app_easy_gap_undirected_advertise_get_active();
        } else {
            cmd = app_easy_gap_non_connectable_advertise_get_active();
        }
    		
        // Specify the advertise data
        cmd->info.host.adv_data_len = codeless_env.adv_data_len;
        memcpy(&cmd->info.host.adv_data, &codeless_env.adv_data, codeless_env.adv_data_len);
        // Specify scan response data (if any)
        if (codeless_env.resp_data_len > 0 && codeless_env.is_connectable) {
            cmd->info.host.scan_rsp_data_len = codeless_env.resp_data_len;
            memcpy(&cmd->info.host.scan_rsp_data, &codeless_env.resp_data, codeless_env.resp_data_len);
        } else {
            cmd->info.host.scan_rsp_data_len = 0;
        }
        // Set advertising interval
        cmd->intv_min = codeless_env.adv_intv;
        cmd->intv_max = codeless_env.adv_intv;
        // Set the advertise mode
        if (codeless_env.is_connectable) {
            cmd->info.host.mode = GAP_GEN_DISCOVERABLE;
        } else {
            cmd->info.host.mode = GAP_BROADCASTER_MODE;
        }
    	
    	if (codeless_env.is_connectable) {
            app_easy_gap_undirected_advertise_start();			  
        } else {
            app_easy_gap_non_connectable_advertise_start();   			  
        }
    
        // Retain the current activity state
        codeless_env.gap_activity = ADVERTISING;
    }

    As you can see, we check if the codeless_env.is_connectable is true or false. For codeless_env.is_connectable true we start connectable advertising, for codeless_env.is_connectable equal to false then we start non-connectable advertising.
    In order to set codeless_env.is_connectable to false without modifying anything into the Codeless SDK, you will have to use the AT+BROADCASTER command:

    And on user_at_commands.c file you can see that the AT+BROADCASTER command sets the codeless_env.is_connectable to false:
    #ifdef USE_AT_BROADCASTER
    void user_at_broadcaster(struct at_cmd_params_t* arg, char* reply_string)
    {
    
    #ifdef CODELESS_585
        if ((codeless_env.bt_role == GAP_ROLE_CENTRAL || codeless_env.bt_role == GAP_ROLE_PERIPHERAL)
            && (codeless_env.gap_activity == IDLE) && (arg->cmd_source == CMD_SRC_LOCAL)
            && (ke_state_get(TASK_APP) != APP_CONNECTED))
    #endif
        {
            // Set broadcaster role
            codeless_env.is_connectable = false;
            user_app_configuration_func(GAP_ROLE_BROADCASTER);
            // command successful but dont send reply for this command
            arg->success_flag = true;
            arg->reply_flag = false;
        }
    }
    #endif


    Kind Regards,
    OV_Renesas

  • Thank you for the quick reply! It was very helpful.