This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2340R5: Align broadcasting name and pairing name of BT

Part Number: CC2340R5
Other Parts Discussed in Thread: SYSCONFIG

Hi TI members,

We found a weird situation that the broadcasting name of our CC2340R5 and the name shown after it is paired with another device would be different.

By now, I knew scanResData1 decided the broadcasting name, and we managed to modify it in Peripheral_start() which was called in App_StackInitDoneHandler of app_main.c.

But we also found that the name after pairing would use attDeviceName instead of scanResData1.

So, we tried to modify attDeviceName as we did to scanResData1 by following codes:

uint8_t *setAdvName()
{
uint8_t *devAddr = NULL;
uint8_t systemId[DEVINFO_SYSTEM_ID_LEN] = {0};
char hex[] = "0123456789ABCDEF";

devAddr = GAP_GetDevAddress( TRUE );

memcpy( &systemId[0], &devAddr[0], 3 ); // use 6 bytes of device address for 8 bytes of system ID value
memset( &systemId[3], 0xFFFE, 2 ); // set middle bytes to 0xFFFE
memcpy( &systemId[5], &devAddr[3], 3 ); // shift three bytes up

scanResData1[6] = hex[systemId[2] >> 4];
scanResData1[7] = hex[systemId[2] & 0x0F];
scanResData1[8] = hex[systemId[1] >> 4];
scanResData1[9] = hex[systemId[1] & 0x0F];
scanResData1[10] = hex[systemId[0] >> 4];
scanResData1[11] = hex[systemId[0] & 0x0F];

return scanResData1;
}

We thought these parameters were first called in BLEAppUtil_init(&criticalErrorHandler, &App_StackInitDoneHandler,
&appMainParams, &appMainPeriCentParams);

But we found that while appMainParams was defined earlier, even if we tried to point attDeviceName to scanResData1, it still used the default name defined in syscfg.

How would TI recommend to make the broadcasting name and pairing name aligned?

Thanks.

BR,

  • Hi YW,

    Thank you for reaching out.

    As you have mentioned, the Device Name characteristic in the GAP GATT Service is set at stack initialization by the function GGS_SetParameter . In the out of the box code, this function is called within BLEAppUtil_stackInit > bleStack_initGatt.

      // Set the Device Name characteristic in the GAP GATT Service
      // For more information, see the section in the User's Guide:
      // http://software-dl.ti.com/lprf/ble5stack-latest/
        status = GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, (void *)pAttDeviceName);
        if (status != SUCCESS)
        {
          return status;
        }

    To make it easy for you, I would suggest to set the attDeviceName to a default value within SysConfig. You can then call GGS_SetParameter with parameter GGS_DEVICE_NAME_ATT to set the updated device name.

    I hope this will help,

    Best regards,

  • Hi Clément,

    1. Did you mean we shall call BLEAppUtil_stackInit instead of BLEAppUtil_init in our app_main.c?

    Because we didn't see BLEAppUtil_stackInit called in our app_main.c.

    And neither did bleStack_initGatt and GGS_SetParameter.

    or

    2. Shall we simply call GGS_SetParameter() and assign a modified version of attDeviceName that has been aligned with scanResData1 whenever we want to change the name of pairing?

    Thanks.

    BR,

    YuWen

  • Hi YuWen,

    I meant to use approach #2

    2. Shall we simply call GGS_SetParameter() and assign a modified version of attDeviceName that has been aligned with scanResData1 whenever we want to change the name of pairing?

    Regards,