2024-10-10 05:09 AM - edited 2024-10-11 12:46 AM
Hi all,
I'm trying to test STEVAL-IDB008V2 board with wise studio and BLE_SensorDemo project I can compile and flash with RF-Flasher.
So for now I'd like to add my own service, the basic example privde 2 services
- Acc service
- Env service
I'm trying to add my own service without succes I always got error 0x48, I can't add more than 2 services ?
my code
#define COPY_TEST_SERVICE_UUID(uuid_struct) COPY_UUID_128(uuid_struct, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00)
#define COPY_TEST_CHAR_UUID(uuid_struct) COPY_UUID_128(uuid_struct, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00)
....
tBleStatus Add_Test_Service(void){
tBleStatus ret;
uint8_t uuid[16];
COPY_TEST_SERVICE_UUID(uuid);
Osal_MemCpy(&service_uuid.Service_UUID_128, uuid, 16);
ret = aci_gatt_add_service(UUID_TYPE_128, &service_uuid, PRIMARY_SERVICE, 7, &testServHandle);
PRINTF("Service 0x%02x\n", ret); //always eror here 0x48
if (ret != BLE_STATUS_SUCCESS) goto fail;
COPY_TEST_CHAR_UUID(uuid);
Osal_MemCpy(&char_uuid.Char_UUID_128, uuid, 16);
ret = aci_gatt_add_char(testServHandle, UUID_TYPE_128, &char_uuid, 1, CHAR_PROP_READ | CHAR_PROP_NOTIFY, ATTR_PERMISSION_NONE, 0,
16, 1, &testCharHandle);
if (ret != BLE_STATUS_SUCCESS) goto fail;
PRINTF("Service TEST added\n");
return BLE_STATUS_SUCCESS;
fail:
PRINTF("Error while adding TESTservice.\n");
return BLE_STATUS_ERROR ;
}
what I'm doing wrong ?
In `SensorDemo_config.h` I have
const BlueNRG_Stack_Initialization_t BlueNRG_Stack_Init_params = {
(uint8_t*)stacklib_flash_data,
FLASH_SEC_DB_SIZE,
FLASH_SERVER_DB_SIZE,
(uint8_t*)stacklib_stored_device_id_data,
(uint8_t*)dyn_alloc_a,
TOTAL_BUFFER_SIZE(NUM_LINKS,NUM_GATT_ATTRIBUTES,NUM_GATT_SERVICES,ATT_VALUE_ARRAY_SIZE,MBLOCKS_COUNT,CONTROLLER_DATA_LENGTH_EXTENSION_ENABLED),
NUM_GATT_ATTRIBUTES, ---> = 9 + 12
NUM_GATT_SERVICES, ---> = 3 + 3
ATT_VALUE_ARRAY_SIZE,
NUM_LINKS,
0, /* reserved for future use */
PREPARE_WRITE_LIST_SIZE,
MBLOCKS_COUNT,
MAX_ATT_MTU,
CONFIG_TABLE,
};
EDIT: ok got it I have to change line in _config.h
#define ATT_VALUE_ARRAY_SIZE (43 + 106 + 100 + OTA_ATT_VALUE_ARRAY_SIZE) //(GATT + GAP) = 43 (Device Name: BlueNRG) + Acceleration (Acceleration (27) + Free Fall (21) characteristics) + Environmental Sensor (Temperature (28), Pressure (29) characteristics) Services
I have to add value (100) but I don't understand how value are calculated, how 27 is found for Acceleration for example. How 43 is find for GATT?
BONUS question : is it possible to flash chip on Linux? Is there a version somewhere of RF flasher for unix ?