4865 views|9 replies

43

Posts

0

Resources
The OP
 

About initialization problem [Copy link]

 

I would like to ask what is wrong with my initialization that causes the Bluetooth to not turn on the receiving function and report the error failed:0x48. Specifically, I would like to ask where the problem is.

void Add_Server(void)
{
uint8_t status = BLE_STATUS_SUCCESS;

const uint8_t uuid[16] = {0x66,0x9a,0x0c,0x20,0x00,0x08,0x81,0x98,0xeb,0x11,0x8b,0x7d,0x20,0xd1,0x69,0x86};
const uint8_t charUuidTX[16] = {0x66 ,0x9a,0x0c,0x20,0x00,0x08,0x81,0x98,0xeb,0x11,0x8b,0x7d,0x21,0xd1,0x69,0x86};
const uint8_t charUuidRX[16] = {0x66,0x9a,0x0c,0x20,0x00,0x08,0x81,0x98,0xeb,0x11,0x8b,0x7d,0x22,0xd1,0x69,0x86};

Osal_MemCpy(&service_uuid.Service_UUID_128, uuid, 16);
status = aci_gatt_ add_service(UUID_TYPE_128 ,&service_uuid ,PRIMARY_SERVICE , 0x04 ,&ServHandle);

* The one indicated in red, if 0x04 is used, Bluetooth has no reception, but transmission and service are normal. If 0x06 is used, all three are wrong.


if (status != BLE_STATUS_SUCCESS) {
PRINTF("aci_gatt_add_service() failed:0x%02x\r\n", status);
APP_FLAG_SET(APP_ERROR);
}else{
PRINTF("aci_gatt_add_service --> SUCCESS\r\n") ;
}

Osal_MemCpy(&char_uuid.Char_UUID_128, charUuidTX, 16);
status = aci_gatt_add_char(ServHandle ,UUID_TYPE_128 , &char_uuid ,20 ,CHAR_PROP_NOTIFY ,ATTR_PERMISSION_NONE ,0 ,16 ,1 ,&TXCharHandle);

if (status != BLE_STATUS_SUCCESS) {
PRINTF("aci_gatt_add_TXchar() failed:0x%02x\r\n", status);
APP_FLAG_SET(APP_ERROR);
}else{
PRINTF("aci_gatt_add_TXchar --> SUCCESS);
}

Osal_MemCpy(&char_uuid .Char_UUID_128, charUuidRX, 16);
status = aci_gatt_add_char(ServHandle ,UUID_TYPE_128 ,&char_uuid ,20 ,CHAR_PROP_WRITE|CHAR_PROP_WRITE_WITHOUT_RESP ,ATTR_PERMISSION_NONE ,GATT_NOTIFY_ATTRIBUTE_WRITE ,16 , 1 ,&RXCharHandle);

if (status != BLE_STATUS_SUCCESS) {
PRINTF("aci_gatt_add_RXchar() failed:0x%02x\r\n", status);
APP_FLAG_SET(APP_ERROR);
}else{
PRINTF("aci_gatt_add_RXchar --> SUCCESS);
}
}

This post is from ST - Low Power RF

Latest reply

The service database is static memory in the protocol stack, rather than dynamically allocated when add_service is called. Therefore, before add_service, when initializing the protocol stack (BlueNRG_Stack_Initialization), you need to clearly indicate the size of the entire database - just configure the following macros correctly according to your needs: NUM_GATT_ATTRIBUTES   Details Published on 2021-3-15 15:27
 
 

9702

Posts

24

Resources
2
 

https://community.st.com/s/question/0D50X00009XkYAvSAN/sensortile-bluenrgms-custom-service-aci

This post is from ST - Low Power RF

Comments

Shouldn't this number be a bit larger? I changed it to 7 and it reported an error of 0x48 when adding a server. Is this related to the GATT initialization function in the example?  Details Published on 2021-3-9 17:30
Shouldn't this number be a bit larger? I changed it to 7 and it reported an error of 0x48 when adding a server. Is this related to the GATT initialization function in the example?  Details Published on 2021-3-9 16:10
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

43

Posts

0

Resources
3
 
littleshrimp published on 2021-3-8 21:02 https://community.st.com/s/question/0D50X00009XkYAvSAN/sensortile-bluenrgms-custom-service-aci ...

Shouldn't this number be a bit larger? I changed it to 7 and it reported an error of 0x48 when adding a server. Is this related to the GATT initialization function in the example?

This post is from ST - Low Power RF

Comments

The error 0x48 corresponds to insufficient memory. Please check if there are any other problems. To rule out the Max_Attribute_Records problem, you can try to change Max_Attribute_Records in the official example to see if the same error is reported.  Details Published on 2021-3-9 20:02
 
 
 

43

Posts

0

Resources
4
 
littleshrimp published on 2021-3-8 21:02 https://community.st.com/s/question/0D50X00009XkYAvSAN/sensortile-bluenrgms-custom-service-aci ...

I modified the Project\BLE_Examples\BLE_MS_Formula routine because this routine originally did not have a receiving characteristic.

This post is from ST - Low Power RF
 
 
 

9702

Posts

24

Resources
5
 
Senbenzakura Dabai posted on 2021-3-9 16:10 Shouldn't this number be a little bigger? I changed it to 7 and the error 0x48 was reported when adding a server. This is different from the GATT initialization function that comes with the routine...

The error 0x48 corresponds to insufficient memory. Check if there are any other problems. To rule out the Max_Attribute_Records problem, you can try to change Max_Attribute_Records in the official example to see if the same error is reported.

This post is from ST - Low Power RF

Comments

Look at my last reply, the picture names are different, one is 0x04 and the other is 0x06   Details Published on 2021-3-10 00:54
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

43

Posts

0

Resources
6
 
This post was last edited by Senbonzakura Dabai on 2021-3-10 00:52
littleshrimp posted on 2021-3-9 20:02 The error corresponding to 0x48 is insufficient memory. Please check if there are any problems elsewhere. If Max_Attribute_Records is the problem, you can try...

0x06.bmp (1.35 MB, downloads: 0)

0x06.bmp

0x04.bmp (1.22 MB, downloads: 0)

0x04.bmp

0x06.bmp (1.35 MB, downloads: 0)

0x06.bmp
This post is from ST - Low Power RF
 
 
 

43

Posts

0

Resources
7
 
littleshrimp posted on 2021-3-9 20:02 The error corresponding to 0x48 is insufficient memory. Please check if there are any problems elsewhere. To eliminate the Max_Attribute_Records problem, you can try...

Look at my last reply, the picture names are different, one is 0x04 and the other is 0x06

This post is from ST - Low Power RF

Comments

I don't quite understand your 4 pictures. Is there no service 0a001 at 0x06? How about you send this part of the code and I can help you try it?  Details Published on 2021-3-12 14:52
 
 
 

9702

Posts

24

Resources
8
 
Senbenzakura Dabai posted on 2021-3-10 00:54 You can see from my last reply that the image names are different, one is 0x04 and the other is 0x06

I don't quite understand your 4 pictures. Is there no 0a001 service at 0x06?

Why don't you send me this code and I'll try it for you?

This post is from ST - Low Power RF

Comments

Well, I just want to express that there is no service 0a001 at 0x06, and I can't add another UUID. The code is the set_database function of the \BlueNRG-1_2 DK 3.2.1\Project\BLE_Examples\BLE_MS_Formula routine, because this routine is used as mater——sl  Details Published on 2021-3-12 17:31
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

43

Posts

0

Resources
9
 
littleshrimp posted on 2021-3-12 14:52 I don't quite understand your 4 pictures. Is there no 0a001 service at 0x06? Why don't you send this part of the code and I'll help you try it

Yes, I just want to express that there is no service 0a001 at 0x06, and I can't add another UUID

The code is the set_database function of the \BlueNRG-1_2 DK 3.2.1\Project\BLE_Examples\BLE_MS_Formula routine. Because this routine does not have a received UUID when used as a master-slave, I have not been able to get an additional RX UUID.

This post is from ST - Low Power RF

Comments

The service database is a static memory in the protocol stack, not dynamically allocated when add_service is called. Therefore, before add_service, when the protocol stack is initialized (BlueNRG_Stack_Initialization),  Details Published on 2021-3-15 15:27
 
 
 

15

Posts

0

Resources
10
 
Posted by Senbenzakura Dabai on 2021-3-12 17:31 Yes, I just want to express that there is no service 0a001 at 0x06, and I can't add another UUID code. It is \BlueNRG-1_2 DK 3.2. ...

The service database is static memory in the protocol stack, rather than dynamically allocated when add_service is called.

Therefore, before add_service, when initializing the protocol stack (BlueNRG_Stack_Initialization), you need to clearly indicate the size of the entire database - just configure the following macros correctly according to your needs:

NUM_GATT_ATTRIBUTES

This post is from ST - Low Power RF
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list