Hello,
I have a trouble about limited number of Characteristic per service, when i create enum type ex:
enum {
// Service ADC1 CONTROL
CUST1_IDX_SVC_ADC1_CONTROL = 0, // Service ADC1
CUST1_IDX_SVC_ADC2_CONTROL, // Service ADC2
CUST1_IDX_SVC_ADC3_CONTROL, // Service ADC3
CUST1_IDX_SVC_ADC4_CONTROL, // Service ADC4
CUST1_IDX_SVC_THERMISTOR_CONTROL , // Service THERMISTOR
// Characteristic for ADC1 sensor
/***************************/
CHAR_ADC1_CONT_NOTIF_TYPE_CHAR,
CHAR_ADC1_CONT_NOTIF_TYPE_VAL ,
CHAR_ADC1_CONT_NOTIF_TYPE_USER_DESC,
.......................
.......................
CUST1_IDX_NB,
}
So, max of the CUST1_IDX_NB is 46, why limited of CUST1_IDX_NB is 46. When i create more Characteristic build program ok but when run debug code this stop at "void wrap_platform_reset(uint32_t error)". What i did wrong?
I change code in the ble_app_peripheral example version SDK 5.0.4.
Hi manhviking,
The amount of characteristics you can have in a service is limited by the amount of the heap allocated for the database, the platform reset that you get is because you cannot allocate any more space (seems that your characteristics surpass the default value defined for the DB_HEAP_SZ which is 1024), you should get an error 0xF2F2F2F2 RESET_MEM_ALLOC_FAIL. You can try to increase the size of the db_heap and try to advertise again. In order to increase the size of your database heap, go to the da1458x_config_advanced.h and add under the #define USE_MEMORY_MAP a #define DB_HEAP_SZ with the desirable size that you would like 2048 for example.
Thanks MT_dialog
Hi MT_dialog,
I has flow instructed but has added another problem:
/ /服务曹ADC1控制
enum
{
CUST1_IDX_SVC_ADC1_CONTROL = 0,
// Charectic cho ADC1 sensor
/***************************/
CHAR_ADC1_CONT_NOTIF_TYPE_CHAR,
CHAR_ADC1_CONT_NOTIF_TYPE_VAL ,
CHAR_ADC1_CONT_NOTIF_TYPE_USER_DESC,
/************************/
CHAR_ADC1_NOTIF_VALUE_CHAR ,
CHAR_ADC1_NOTIF_VALUE_VAL,
CHAR_ADC1_NOTIF_VALUE_NTF_CFG,
CHAR_ADC1_NOTIF_VALUE_USER_DESC,
/****************************/
CHAR_ADC1_CONT_NOTIF_INTVL_CHAR,
CHAR_ADC1_CONT_NOTIF_INTVL_VAL,
// CHAR_ADC1_CONT_NOTIF_INTVL_CFG ,
CHAR_ADC1_CONT_NOTIF_INTVL_DESC,
/****************************/
CHAR_ADC1_CHANGE_NOTIF_STEP_CHAR,
CHAR_ADC1_CHANGE_NOTIF_STEP_VAL,
CHAR_ADC1_CHANGE_NOTIF_STEP_CFG,
CHAR_ADC1_CHANGE_NOTIF_STEP_DESC,
/******************************/
CHAR_ADC1_CROSS_NOTIF_THESH_CHAR,
CHAR_ADC1_CROSS_NOTIF_THESH_VAL,
CHAR_ADC1_CROSS_NOTIF_THESH_CFG,
CHAR_ADC1_CROSS_NOTIF_THESH_DESC,
/*********************************/
CHAR_ADC1_NUM_CMDS_PROC_CHAR ,
CHAR_ADC1_NUM_CMDS_PROC_VAL,
CHAR_ADC1_NUM_CMDS_PROC_CFG ,
CHAR_ADC1_NUM_CMDS_PROC_DESC,
CUST1_IDX_NB
}
and
{
/*
* CHAR_ADC1_CONT_NOTIF_TYPE W
*/
[CHAR_ADC1_CONT_NOTIF_TYPE_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE),
sizeof(custs1_adc1_control_char), sizeof(custs1_adc1_control_char), (uint8_t*)&custs1_adc1_control_char},
// Control Point Characteristic Value
[CHAR_ADC1_CONT_NOTIF_TYPE_VAL] = {CUST1_ADC1_CONT_NOTIF_TYPE_UUID_128, ATT_UUID_128_LEN, PERM(WR, ENABLE),
DEF_CUST1_CTRLADC_POINT_CHAR_LEN, 0, NULL},
// Control Point Characteristic User Description
[CHAR_ADC1_CONT_NOTIF_TYPE_USER_DESC] = {(uint8_t*)&att_decl_user_desc, ATT_UUID_16_LEN, PERM(RD, ENABLE),
sizeof(CUST1_ADC1_CONT_NOTIF_TYPE_USER_DESC) - 1, sizeof(CUST1_ADC1_CONT_NOTIF_TYPE_USER_DESC) - 1, CUST1_ADC1_CONT_NOTIF_TYPE_USER_DESC},
}
{
static struct att_char128_desc custs1_adc1_control_char = {ATT_CHAR_PROP_WR_NO_RESP,
{0, 0},
DEF_CUST1_ADC1_CONT_NOTIF_TYPE_UUID_128};
}
When i send '1' from app "BLE Scaner" to BLE device Characteristic "CHAR_ADC1_CONT_NOTIF_TYPE_VAL " receive = '1' so "CHAR_ADC1_CROSS_NOTIF_THESH_VAL" send back phones is "index++" but Characteristic "CHAR_ADC1_CONT_NOTIF_TYPE" receive index++ it does not receive data? because Characteristic has "ATT_CHAR_PROP_WR_NO_RESP" Why ?????
Hi manhviking,
I dont quite understand the problem, can you please rephrase the question and what is that you are experincing ? Please dont just paste code, describe your setup and what you would like to do, as far as could understand you send a a write command to your device from the BLE scanner application to a characteristics value and you expect some index value (whatever that value represents) to be send back to your phone and this value appears on your phone but at a wrong characteristic ?
Thanks MT_dialog
Sorry MT_Dialog,
My problem: ex:
当我创建第一个characteristic has property is "WR" and second has property is "RD+NTF". From app "BLE Scaner" i send data '1' to BLE device, Characteristic second reicever '1' is true and this show in app, but in the first characteristic show in app "BLE Scaner" is HEX :'0x31'=>wrong Why?? because first characteristic is "WR" not "RD or NTF". I create 30 charectic and 5 service and i define in file "da1458x_config_advanced.h":
#define DB_HEAP_SZ 4096
#定义ENV_HEAP_SZ 2296
#define MSG_HEAP_SZ 6240
#define NON_RET_HEAP_SZ 4096
And #define DB_HEAP_SIZE (4096 + 12) and BLE_CONNECTION_MAX_USER = 1 at file "da1458x_scatter_config.h".
Hi manhviking
I am still not able to understand what you are trying to say, but if you send "1" and the other side interprets it as 0x31 is because you send an ascii character and "1" in hexadecimal is 0x31. Check how BLE scanner interprets the data that receives.
Thanks MT_dialog
Hi Dialog
Example : i send '1' from app "BLE Scaner" to BLE device use characteristic 1, at BLE device when recieve '1' will increase index++ so "BLE Scaner" characteristic 2 will recieve 'index++ : 1,2,3,4...' ok true because characteristic 2 has property is "RD+NTF" but characteristic 1 has only "WR" even recieve 'index++ : 1,2,3,4...' same characteristic 2 and show that in "BLE Scaner".
Hi manhaviking,
So you are writing on a writable characteritic and when the handler hits you store the value in a variable in the write handler and increase by one, and with the result value you update the value of an other characteristic which is readable and you are able to see that on your phone. After increasing the value if you expect to read 2 in the writable characteristic (suppose that you have send 1 previously) you wont be able to do so, since the index variable has been increased but that wont update the writable characteristic and even more if a characteristic is only writable you wont be able to read it.
Thanks MT_dialog
Hi dialog,
Exactly, the problem at only writable characteristic, it had displayed index increase in app "BLE Scanner". I don't know why? Remember that I created 30 characterized as above
Hi manhviking,
So you 've changed the index by one and you could read from a writable characteristic that the value was 2 ?
Thanks MT_dialog
Hi dialog,
When i send '1' from Writable characteristic in app after that it had displayed 'index++'. It should be display is '0x31'
Hi manhviking,
Still not able to understand what is that you are doing exactly, i mean i understand that you are increasing the value that you ve written to your characteritsic from the 580, what i dont get is how when you read it back you see a different number (i mean its a writable characteristic, you wont be able to read it back from the BLE Scanner even if the 580 alters the value in the database, the value that is indicated on the BLE scanner its latest value that the application has sent to the peripheral). So, are you able to replicate what you see on the peripheral example with the allready implemented characteristics ?
Thanks MT_dialog