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

Current Time Service not found on server

Hi,

In y project, I want to implement CTS. Until now it's been working, but I don't know why, I now have this problem: Current Time Service not found on server, which means the event calls the current time service is BLE_CTS_C_EVT_DISCOVERY_FAILED. why is the current time service not found by the server? 
To solve this, I saw that I have to forget the device on the Bluetooth parameters of my phone, but I can't. When I'm not connected, the device name doesn't appear and when I'm connected, I can't forget the device, I have this: 

Normally, I click on the button "i" and after I can't click on forget the device.

So I tried to add this line: 

memset(&m_ble_db_discovery,0,sizeof(m_ble_db_discovery));
in the case BLE_GAP_EVT_CONNECTED of the function ble_evt_handler(). It works at first but now I have the same problem.

Is it my code which has a problem or a bug of the device?

Parents
  • Hi Lydie, 

    Could you let me know: 

    - Which phone you are using to test ? 

    - Which SDK you firmware based on ? Which nRF52 chip ? 

    - Have you tried to turn off an on the phone ? 

    - You can also try to flash other example to the board, for example ble_app_hrs, and then try delete the board inside Bluetooth setting. 

  • Hi,

    I'm using an iPhone to test, but I tried with an Asus and it is the same problem. I use sdk15.3 and my chip is nrf52832, and when I turn off my phone nothing changes. 

    I tried with another example te delete the board onside Bluetooth setting, but it's the same problem. 

    First time on_cts_c_evt() is called, the server is found, but the second it is not. Do you know why this function is called twice? So it means my code has a problem, but I don't see where.

  • Hi Lydie, 

    I assume you are testing with unmodified cts example ? 

    Could you try to follow the documentation here and test with nRF Connect on PC ? I did a quick test here and don't see the same issue that you had. 

    You may want to print out some log inside ble_cts_c_on_db_disc_evt() and check which even you receive on the second time you receive the event. In the code the log ble_cts_c: Current Time Service discovered at peer. is only printed when there is BLE_DB_DISCOVERY_COMPLETE, we need to see what happened on the second time it get called. 

    Please also take a sniffer trace when you connect to the phone. 

Reply
  • Hi Lydie, 

    I assume you are testing with unmodified cts example ? 

    Could you try to follow the documentation here and test with nRF Connect on PC ? I did a quick test here and don't see the same issue that you had. 

    You may want to print out some log inside ble_cts_c_on_db_disc_evt() and check which even you receive on the second time you receive the event. In the code the log ble_cts_c: Current Time Service discovered at peer. is only printed when there is BLE_DB_DISCOVERY_COMPLETE, we need to see what happened on the second time it get called. 

    Please also take a sniffer trace when you connect to the phone. 

Children
  • Hi, 

    When I program with cts example, it works, thanks. But I don't understand why sometimes the server is not found. But now I have another problem. My device sleeps after 30 seconds. But when it's sleeping, the time is wrong, it is not updated. Do you know how can time be updated when the device is sleeping?

  • Hi Lydie, 

    You are saying that using the cts example it worked but when using your application it still didn't work ? You may want to check the difference between your application and the example. 

    Regarding your new question, if you want to keep the time when it's not connected you would need to have a timer on the application to keep the time. You can keep an application timer that occur every one second and then increase the current time by 1 second. I don't think we have an example for this. There is some discussion about it here.

Related