This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Testing of Current time service

Hi,

I am unable to test current time service example.I followed all the steps mentioned to test CTS Example.But, below are the log messages:

Again if I try to reset and try to connect to the device.The log messages are as below:

Please suggest me to rectify the errors and also the right way to test CTS example with 1SDK and mobile application.

Thanks & Regards,

Swathi P.

Parents
  • Hello Swathi P,

    Did you follow the Setup and Testing section of the CTS Example Documentation?
    From your error logs, it seems that the Current Time Service is not found on the central device, which causes the peripheral to auto-disconnect.
    You need to make sure that the central is providing this service.
    Which smartphone application and OS are you using?
    If you are using the nRF Connect application, you will need to configure your GATT server to include the Current Time Service, with the Current Time characteristic. The initial value of the characteristic should be C2 07 0B 0F 0D 25 2A 06 FE 08, as detailed in the CTS Example documentation referenced above.

    Please let me know if this resolves your issue,

    Best regards,
    Karl

  • Hi,

    Thank you for the reply.

    In example provided it has already advertising current time service,I think this means central is provided with service.

    I am using Oppo A71,it is android.

    I have configured Server on the mobile.

    To write the initial value the service is not getting discovered.

    Can you also please let me know,what content the initial value of characteristic "C2 07 0B 0F 0D 25 2A 06 FE 08" is holding?

    Thanks & Regards,

    Swathi P

     

  • your reply is not that helpfull to progress our project.Let us know the exact connection procedure.

    The below are the consequences I am going through while testing

    • I compile and download the program on nRF Chip and scan from nRF Connect then try to connect to nRF Chip from nRF Connect by clicking on connect button.Unable to connect to the device.
    • Then tried erasing the Chip and then programmed with softdevice and application.Now I tried connecting from nRF Connect to nRF Chip,I was able to connect and asked for pair up,accepted to pair up.After some noticable delay I was able to Discover services.Can you please let me know the reason for the delay?
    • If I try to disconnect device it is not getting disconnected,even if I turn off the bluetooth it is not getting disconnected.
    • After pressing reset button it is automatically being in connected state.

    Thanks,

    Swathi P

  • Hi Swathi, 

    swathi p said:
    I compile and download the program on nRF Chip and scan from nRF Connect then try to connect to nRF Chip from nRF Connect by clicking on connect button.Unable to connect to the device.

    Did you erase the chip before downloading the image? The good habit is Erasing the kit every time before downloading the image. 

    swathi p said:
    Then tried erasing the Chip and then programmed with softdevice and application.Now I tried connecting from nRF Connect to nRF Chip,I was able to connect and asked for pair up,accepted to pair up.After some noticable delay I was able to Discover services.Can you please let me know the reason for the delay?

    Please provide the debug log and sniff log to help know the detail. 

    swathi p said:
    If I try to disconnect device it is not getting disconnected,even if I turn off the bluetooth it is not getting disconnected.

      Did you set with "Use autoConnect"? Also, I need the debug log and sniff log to help know what happened.   

    swathi p said:
    After pressing reset button it is automatically being in connected state.

     Did you set with "Use autoConnect"?

    -Amanda H.

  • Hi,

    Yes, I have erased the kit every time I have downloading the application.Below is the log info while testing on android.

    The below is the log info while testing on iOS:

     Did you set with "Use autoConnect"?

    No.I didn't set with "Use autoConnect"

    Thanks & Regards,

    Swathi P.

  • Hi Swathi, 

    The disconnection reason is the service is not found on the server. You can use the nRF Connect mobile to configure GATT server as the following to test with the example. 

    -Amanda H.

  • Hi,

    Thank you.Your reply has helped me in testing CTS example.I was success  to connect,bond and discover service and print data on UART.But,If I try to delete bond information and try to scan and connect it is showing below log info and unable to discover service.

    If I erase the kit and then download after deleting bond information then it is working fine.Is CTS service always looking for whitelisted devices?Can you please explain me what exactly it does when we delete bond information on nRF Connect for mobile.

    In my project I cannot frequently erase and download.so please let me know if there is other way to Connect,pair and bond  and discover service after deleting bond information.

    Thanks & Regards,

    Swathi P

Reply
  • Hi,

    Thank you.Your reply has helped me in testing CTS example.I was success  to connect,bond and discover service and print data on UART.But,If I try to delete bond information and try to scan and connect it is showing below log info and unable to discover service.

    If I erase the kit and then download after deleting bond information then it is working fine.Is CTS service always looking for whitelisted devices?Can you please explain me what exactly it does when we delete bond information on nRF Connect for mobile.

    In my project I cannot frequently erase and download.so please let me know if there is other way to Connect,pair and bond  and discover service after deleting bond information.

    Thanks & Regards,

    Swathi P

Children
  • Hi Swathi, 

    You can do Button 2 long push: Turn off whitelist during advertising or scanning. Please see the BSP BLE Button Assignments. Or You may add the following event handling to the PM callback in peer_manager_handler.c if you want to allow repairing like this:

            case PM_EVT_CONN_SEC_CONFIG_REQ:
                   {
                        pm_conn_sec_config_t config = {.allow_repairing = true};
                        pm_conn_sec_config_reply(p_pm_evt->conn_handle, &config);
                    }
                break;

    and have a loop to go through m_whitelist_peers[] array to check if there is an element inside that array is equal to m_peer_id. If not then you add it as a new node into the array like this: 

            case PM_EVT_PEER_DATA_UPDATE_SUCCEEDED:
            {
                // Note: You should check on what kind of white list policy your application should use.
                if (     p_evt->params.peer_data_update_succeeded.flash_changed
                     && (p_evt->params.peer_data_update_succeeded.data_id == PM_PEER_DATA_ID_BONDING))
                {
                    NRF_LOG_DEBUG("New Bond, add the peer to the whitelist if possible");
                    NRF_LOG_DEBUG("\tm_whitelist_peer_cnt %d, MAX_PEERS_WLIST %d",
                                   m_whitelist_peer_cnt + 1,
                                   BLE_GAP_WHITELIST_ADDR_MAX_COUNT);
    
                    if (m_whitelist_peer_cnt < BLE_GAP_WHITELIST_ADDR_MAX_COUNT)
                    {
    
                        //check if there is any element inside that array is equal to m_peer_id
                        bool already_added= false;
    
                    for (uint8_t i = 0; i<m_whitelist_peer_cnt;i++)
                    
                    {
                    
                        if (m_whitelist_peers[i] == m_peer_id)
                        {
                            already_added= true;
                            break;
                        }
                    }
                            
                    if (!already_added)
                    {
    
                    //End of adding
                    
                        // Bonded to a new peer, add it to the whitelist.
                        m_whitelist_peers[m_whitelist_peer_cnt++] = m_peer_id;
    
                        // The whitelist has been modified, update it in the Peer Manager.
                        err_code = pm_device_identities_list_set(m_whitelist_peers, m_whitelist_peer_cnt);
                        if (err_code != NRF_ERROR_NOT_SUPPORTED)
                        {
                            APP_ERROR_CHECK(err_code);
                        }
    
                        err_code = pm_whitelist_set(m_whitelist_peers, m_whitelist_peer_cnt);
                        APP_ERROR_CHECK(err_code);
                    } 
                    }//End of adding
                }
            } break;
    

    -Amanda H.

  • Hi,

    Thank you for your suggestion.I have tried adding the below statements in main.c pm_evt_handler()

    I just replaced both the cases in pm_evt_handler.Even after deleting bond information I am able to connect by pairing.

    Is it not that pm_evt_handler in main.c you were talking about?

    I didn't find any PM callback  in peer_manager_handler.c.Can you give me the function name?

    Thanks & Regards,

    Swathi P.

  • Hi Swathi, 

    case PM_EVT_PEER_DATA_UPDATE_SUCCEEDED is in main.c.

    case PM_EVT_CONN_SEC_CONFIG_REQ is in peer_manager_handler.c Line 370. You can press Ctrl+Shift+f in Segger to search "PM_EVT_CONN_SEC_CONFIG_REQ".  

    -Amanda H.

  • Are you refering Line370 of peer_manager_handler.c ,which is in the function pm_handler_flash_clean()  ?

Related