3 Replies Latest reply on May 20, 2020 12:06 AM by XinghaoZ_26

    Why dose the device local name only support 17  at most?


      APP sends “SN+123456789012345678901234567890”,I use the customServiceData to change the device name

      Set BLE name2.png

        • 1. Re: Why dose the device local name only support 17  at most?

          Your TX buffer has only 20 bytes.


          1 of 1 people found this helpful
          • 2. Re: Why dose the device local name only support 17  at most?



            I found the function description for Cy_BLE_SetLocalName().  See lines 11-13


            * Function Name: Cy_BLE_SetLocalName
            *  This function is used to set the local device name - a Characteristic of the
            *  GAP Service. If the characteristic length entered in the Component customizer
            *  is shorter than the string specified by the "name" parameter, the local device
            *  name will be cut to the length specified in the customizer.
            *  \param name: The local device name string. The name string to be written as
            *              the local device name. It represents a UTF-8 encoded User
            *              Friendly Descriptive Name for the device. The length of the local
            *              device string is entered into the Component customizer and it can
            *              be set to a value from 0 to 248 bytes. If the name contained in
            *              the parameter is shorter than the length from the customizer, the
            *              end of the name is indicated by a NULL octet (0x00).
            *  \return
            *  \ref cy_en_ble_api_result_t : Return value indicates if the function succeeded or
            *  failed. The following are possible error codes.
            *  Error Codes                        | Description
            *  ------------                        | -----------
            *  CY_BLE_SUCCESS                      | The function completed successfully.
            *  CY_BLE_ERROR_INVALID_PARAMETER      | On specifying NULL as input parameter.


            The only place I found to set the LocalName in the BLE  customizer is on the "Gap Settings" tab:

            Try setting "Device Name:" to a name with the maximum size desired like:  "123456789012345678901234567890".


            I believe the structure created will be large enough for your serial number when you change it in the code.


            I suspect the current name in "Device Name:" is the reason for the limit of the LocalName.



            1 of 1 people found this helpful
            • 3. Re: Why dose the device local name only support 17  at most?

              The local name set in the application code is limitted by the initiated name length in the component.

              For example, if you set the name "1234567890" in the component, then the maximum length you can set in the application code is 10 bytes. So please set a name long enough in the BLE component. You may use space to extend the length, such as "Find Me                      ".


              Besides, the name length in the component is also restricted by the advertising packet or scan response packet if you add the device name to the packet. The two packets can have 31 bytes as most. I suggest to use the short name in these packet if you want to set a name longer than 31 byts.