QN9030 notification problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

QN9030 notification problem

895 Views
Minh_Thien
Contributor I

Hi,

I'm working on QN9030 chipset and using QN9090 proximity_bm example but I facing a problem: the board can't notification after connecting to my phone.

I tried to debug a see the cccd is written, the code I printed debug below:

Minh_Thien_0-1625542360748.png

 

static void BleApp_GattServerCallback (deviceId_t deviceId, gattServerEvent_t* pServerEvent)
{
    switch (pServerEvent->eventType)
    {
        case gEvtAttributeWrittenWithoutResponse_c:
        {
        }
        break;
#if defined CPU_JN518X
        case gEvtAttributeWritten_c:
        {
        }
        break;
#endif
        case gEvtCharacteristicCccdWritten_c:
            APP_DEBUG_TRACE("-->Event.handle: %d\r\n", pServerEvent->eventData.charCccdWrittenEvent.handle);
            switch(pServerEvent->eventData.charCccdWrittenEvent.handle)
            {
                case cccd_battery_level:
                    APP_DEBUG_TRACE("-->new_cccd_battery: %d\r\n", pServerEvent->eventData.charCccdWrittenEvent.newCccd);
            }

            break;
        default:
            ; /* For MISRA compliance */
            break;
    }
}

 

 

I think cccd is 1 means the notification is enabled but in the function Bas_SendNotifications I print out the Gap_CheckNotificationStatus result: 1 (fail) and isNotifActive.

 

static void Bas_SendNotifications
(
    basConfig_t *pServiceConfig,
    uint16_t     handle
)
{
    uint16_t  handleCccd;
    bool_t    isNotifActive;
    uint8_t   mClientId = 0;

    bleResult_t ret = gBleSuccess_c;

    /* Get handle of CCCD */
    if (GattDb_FindCccdHandleForCharValueHandle(handle, &handleCccd) == gBleSuccess_c)
    {
        for (mClientId = 0; mClientId < pServiceConfig->validSubscriberListSize; mClientId++)
        {
            if (pServiceConfig->aValidSubscriberList[mClientId])
            {
                ret = Gap_CheckNotificationStatus(mClientId, handleCccd, &isNotifActive);
                PRINTF("mClientId = %d,handleCccd = %d, ret = %d, isNotifActive =  %d\r\n",mClientId, handleCccd, ret, isNotifActive);
//                if (ret == gBleSuccess_c && TRUE == isNotifActive)
//                {
//                    (void)GattServer_SendNotification(mClientId, handle);
//                }
//                PRINTF("notify_result: %d\r\n", GattServer_SendInstantValueIndication(mClientId, handle, 1, value++));
                PRINTF("notify_result: %d\r\n",GattServer_SendNotification(mClientId, handle));
            }
        }
    }
}

 

Minh_Thien_0-1625542678790.png

 

I don't understand why. Can you help me explain and how to resolve this problem?

thank you.

0 Kudos
Reply
3 Replies

877 Views
nxf56274
NXP Employee
NXP Employee

Hi,

Gap_CheckNotificationStatus's result means that you phone doesn't enable the ccd function. What's the app do your phone use?

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

875 Views
Minh_Thien
Contributor I

Hi,

thanks for your feedback.

I'm using NRFconnect to test. I think the app is ok because when I press the notification in the app then the gEvtCharacteristicCccdWritten_c event is triggered you can see the picture I posted.

0 Kudos
Reply

870 Views
nxf56274
NXP Employee
NXP Employee

Hi,

Please use our app 'IOT toolbox' to test the example.

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply