ARMmbed / ble-x-nucleo-idb0xa1

port of BLE_API to ST BLE shield
14 stars 5 forks source link

BlueNRG aci_att_find_information_req #6

Closed iwasz closed 8 years ago

iwasz commented 8 years ago

Hi

If this is wrong place for my bug-report, please delete it.

I think I found a bug in aci_att_find_information_req which always returns BLE_STATUS_TIMEOUT for me. This function creates a hci_request variable, fills it with zeros, and then sets all fields except "event". Then in hci_send_req function, case EVT_CMD_STATUS: gets asserted, and if (r->event != EVT_CMD_STATUS) condition is checked and met (since event == 0). Then, in the next iteration of while loop, I get BLE_STATUS_TIMEOUT.

If I initialize hci_request::event field to EVT_CMD_STATUS, function works, and I successfully got an UUID of handle 0x01. Please note, that every (?) other function with "acigatt" prefix located in "bluenrg_gatt_aci.c" file has this "event" field initialized just like I mentioned, and at the other hand, every function prefixed "aciatt" has not.

Please help me verify if this is something wrong with my code, or it's a bug. How do I proceed in the latter case?

PS. My code is a somewhat modified example named "SensorDemo" from "STM32CubeExpansion_BLE1_V2.5.2", and I run the function on question like this:

void GAP_ConnectionComplete_CB (uint8_t addr[6], uint16_t handle)
{
        connected = TRUE;
        connection_handle = handle;

        printf ("Connected to device:");
        for (int i = 5; i > 0; i--) {
                printf ("%02X-", addr[i]);
        }
        printf ("%02X\n", addr[0]);

        tBleStatus stat = aci_att_find_information_req (connection_handle, 0x01, 0x01);

        if (stat != BLE_STATUS_SUCCESS) {
                printf ("stat != BLE_STATUS_SUCCESS (%d)\n", stat);
                while (1)
                        ;
        }
}

All the code is here : https://github.com/iwasz/blue-nrg-test , and it runs on STM32F7-DISCO + BlueNRG shield Regs

betzw commented 8 years ago

cc @apalmieriGH

apalmieriGH commented 8 years ago

Hi, sorry for pointing out but this is not the right place for this bug report concerning the STM32 Cube package. I see you also posted the question on the ST forum. Please, move there for comments and follows up.

Kind regards

iwasz commented 8 years ago

Hi, thanks for reply. This bug is in _bluenrg_gattaci.c not in STM32 Cube.

apalmieriGH commented 8 years ago

Yes, this is true. But the ble-x-nucleo-idb0xa1 is just a port to mbed SDK of the Cube solution by ST. Anyway, it is not clear to me the use case you want to reproduce. The aci_att_find_information_req() is an API allowing a client to discover the list of attributes and their types on a server. The "SensorDemo" is the implementation of the server side from the GATT perspective.

iwasz commented 8 years ago

Ok, I see so indeed I must inform the mbed ST guys. The sensor-demo is only a stub for me. I needed some working (and verified) piece of code to inject my tests. Thanks.