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

Bluetooth Beacon Setup on Thingy 91

Hello,

I am working on an IoT project using the Thingy 91 to send sensor data via Bluetooth to a remote device. Currently, I am trying to set up a simple beacon as shown in the Zephyr samples. I would like to set up the NRF9160 as the host and the NRF52 as the controller.
Therefore, I used the LTE/BLE example in the NRF samples and flashed the NRF52 with the patched HCI/UART sample provided in this post.
However, the system keeps crashing during HCI setup (in bt_enable). The error is due to a failing k_sem_take call (return value -11) in Zephyr's hci_core.c.

Is there some issue with the driver setup?


Best regards

Nils Ruf

Parents
  • Hello Nils, 

    What tag version of NCS are you working on? Please make sure you are on tag v1.1.0 for the provided sample in the post to work. Have you applied both patches provided in the .zip file? Can you please provide some more logs showing the error?

    Kind regards,
    Øyvind

  • Hello Øyvind,

    I have verified that I have added each patch and I also ran 'west update' (which I forgot). The samples are compiling properly now however, HCI still does not work. During the BLE initialization I get the error "k_sem_take failed with err -11". After that the system hangs. The corresponding stack trace is shown below.

    Kind regards

    Nils

  • Hi Nils, 

    Can you please provide full output from your debug/application? 

    Error -11 is according to errno.h:

    #define EAGAIN 11       /* No more contexts */

    For k_sem_take this means "Waiting period timed out"

    Have you edited anything in the code? What are you trying to connect? 

    -Øyvind

  • Hi Øyvind,

    Unfortunately, since I have flashed the HCI-UART bridge example onto the NRF52, I have not been able to connect to the serial interface any more so I do not get any application output. Is there another way to obtain this information?

    I did one change to simplify debugging as shown below:

    void ble_init(void)
    {
    	int err;
    
    	printk("Initializing Bluetooth..\n");
    	err = bt_enable(NULL);
    	if (err) {
    		printk("Bluetooth init failed (err %d)\n", err);
    		return;
    	}
    	ble_ready(err);
    }

    Previously, the ble_ready function was passed as a callback to bt_enable. The ble_ready function should be called asynchronously after BLE initialization. This is however, not the case, so I tried it this way which leads to the error.

    If I pass the ble_ready function as a callback to bt_enable no error is thrown in the main thread but the device cannot be seen by a BLE scanner (I am trying to use the Thingy as a beacon).

    -Nils

Reply
  • Hi Øyvind,

    Unfortunately, since I have flashed the HCI-UART bridge example onto the NRF52, I have not been able to connect to the serial interface any more so I do not get any application output. Is there another way to obtain this information?

    I did one change to simplify debugging as shown below:

    void ble_init(void)
    {
    	int err;
    
    	printk("Initializing Bluetooth..\n");
    	err = bt_enable(NULL);
    	if (err) {
    		printk("Bluetooth init failed (err %d)\n", err);
    		return;
    	}
    	ble_ready(err);
    }

    Previously, the ble_ready function was passed as a callback to bt_enable. The ble_ready function should be called asynchronously after BLE initialization. This is however, not the case, so I tried it this way which leads to the error.

    If I pass the ble_ready function as a callback to bt_enable no error is thrown in the main thread but the device cannot be seen by a BLE scanner (I am trying to use the Thingy as a beacon).

    -Nils

Children
No Data
Related