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

Thingy 52: Advertising and Scanning

Hi, I am programming on Thingy 52 to try to get it work like one of my nRF 52840 DK. Basically, I want Thingy to send beacons with data periodically and another Thingy to scan the data.

Here are some problems I have come into.

1. I am currently looking into the codebase of Thingy, and I have to say it does not like the SDK13. In the m_ble.c(), I found that the ble_evt_dispatch() is registered at the softdevice as the callback function for ble event.  And inside ble_evt_dispatch(), it called on_ble_evt() which will truly handle the event. Therefore I added my code at the on_ble_evt() function.  

static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    uint32_t                       err_code;
    m_ble_evt_t                    evt;
    NRF_LOG_INFO("on_ble_evt: Event id = %d",p_ble_evt->header.evt_id);
    switch (p_ble_evt->header.evt_id)
        {
    		case BLE_GAP_EVT_ADV_REPORT:
    				NRF_LOG_INFO("on_ble_evt: BLE_GAP_EVT_ADV_REPORT\r\n");
    				//m_evt_handler(&evt);
    				break;
    	....

  As you can see, I only changed this much about the code. The problem I am having now is that. The two NRF_LOG_INFO at both the head of this callback function and the switch section are never called. I checked the logging using RRT viewer and other loggings are correct.

So I don't understand why this event callback function is never called. When I was using 52DK, this BLE_GAP_EVT_ADV_REPORT event happened all the time due to the environment with all kinds of bluetooth signal. 

My question is that will the configuration of softdevice cause that such event cannot be handled? And can change the configuration of Thingy's softdevice to the same as 52DK or such that it can receive beacons properly.

2. Another problem I have come into is that the source files from Thingy SDK components/Softdevice/s132/headers are different from the ones from nRF5_SDK_13.0.0-1.alpha_055eef3\components\softdevice\s132\headers. I don't understand that why the softdevice could be different with the same version name. Plus, Thingy SDK do not provide softdevice hex file. And I was forced to flash the HEX file from SDK13. Does this mean that the softdevice hex files should also be different? And if so, where can I get the hex file for Thingy?

3. I have more questions on how to send beacons with Thingy, I had an answer suggesting me trying eddystone. But I don't find it easy to use. I still want to use normal advertising like the 52DK. But this is only a future problem.

Parents Reply Children
No Data
Related