This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc2540 development kit notifications activation

Other Parts Discussed in Thread: CC2540

Hi, I am working with the cc2540 development kit and I modified the simpleBLEPeripheral and simpleBLECentral, so depending on how I press the joystick in the peripheral it will save a new value on the characteristic4 and when this value change, it will notify the central. When the central get the notification, depending on which value it has received, it will write something different on the screen. However it is not writting anything on the screen. I checked it with the packet Sniffer and the problem is that the peripheral is not sending any notification. What do I have to do to activate the notifications?

Thanks for your help!

  • Hi Elvira,

    Usually you write 1 to the characteristic configuration for the specific characteristic you want enable notifications for. In simpleBLEPeripheral I believe that this would be performed by perform write 01:00 to the handle 0x2C from the simpleBLECentral. Now this is of course depended on the changes you've made. Try it out and see if that is performed as expected.

    BR

  • The keyfobdemodoc is full of examples like this.

  • Hi Nick,

    the client is the one who has to change this value, right? So where and what should I add to the program of the simpleBLECentral, that always that it connects to the peripheral(server) the notifications are enabled? Because I tryed using the GATT_WriteCharValue to change the value of the handle 0x2C, but notifications are still not working.

    Thanks!

  • Hi Elvira,

    the GATT server is the keyfob and you use the BTool attached to the USB dongle to set notifications to the keyfob :)

  • Hi kazola,

    thanks for your answer, but I´m not using the mini development kit, I´m using the development kit. So I have two devices, which are the same and one is the client(central) and the other is the server(peripheral). I want to work with them without connecting them to the computer. Therefore I want to know what do I have to write in the simpleBLECentral.c, so notifications will start automatically as soon as both devices are connected. Do you know how to do that? 

  • Hi,

    It's really hard to know the problem without any significant information, we need to narrow down the possibilities to either simpleBLECentral or simpleBLEPeripheral since it could be either one of them that's responsible (or if we are unlucky, both). But we need to start somewhere. 

    Elvira said:
    Because I tryed using the GATT_WriteCharValue to change the value of the handle 0x2C, but notifications are still not working.

    Can you use the sniffer (Running on CC2540USB) to verify that the command is sent, alternative debug the simpleBLEPeripheral to see if the command is received?

    BR

  • Hi Nick,

    what I wrote in the simpleBLECentral.c to change the value of the handle 2C to 1 is:

        attWriteReq_t reqw;
        reqw.handle=0x2C;
        reqw.len=2;
        reqw.value[0]=0x01;
        reqw.sig=0;
        reqw.cmd=0;
        GATT_WriteCharValue( simpleBLEConnHandle, &reqw, simpleBLETaskId );

    Then I checked it with the Packet Sniffer to see if it was sending the request. It sends the ATT_Write_Req, but the value that is sending in the field AttValue is 01 64 instead of 00 01. Therefore the server sends back an ATT_Error_Response with the ErrorCode: Application Error(0x80). I read that it means that the attribute value is invalid for the operation. Does that happen because with GATT_WriteCharValue I just can write one byte or can I change a two bytes value using this function?

    Thanks for your help!

  • Hi,

    I would guess thats because you specify that two bytes should be sent but you set one of the bytes (Meaning that the next byte in the memory could be anything). Try adding  reqw.value[1]=0x00;

    I hope this solves your issue.

    BR

     

  • Hi Nick,

    it has worked. Thanks very much for your help!