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

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
zhch_4550981
Level 3
Level 3
10 replies posted 10 questions asked 5 replies posted

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

Set BLE name2.png

0 Likes
1 Solution
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

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.

View solution in original post

0 Likes
3 Replies
LiDo_2439176
Level 5
Level 5
First question asked 50 replies posted 50 sign-ins

Your TX buffer has only 20 bytes.

tx_len.png

Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

zhch,

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:

pastedImage_5.png

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.

Len

Len
"Engineering is an Art. The Art of Compromise."
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

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.

0 Likes