HOW DO I SET UP BLE WITH NRF XIAO BLE SENSE zephyr?

Hi!

I’m developing an application using nRF SDK 2.9.0 with the Xiao BLE Sense. I created a new project based on Zephyr’s UART peripheral example.

The application runs perfectly on the nRF52840 DK. It also builds successfully for the Xiao BLE Sense. However, when I deploy it to the Xiao BLE Sense, BLE does not work.

debugging it gets tuck to uart_callback_Set():

	err = uart_callback_set(uart, uart_cb, NULL);
	if (err) {
		k_free(rx);
		LOG_ERR("Cannot initialize UART callback");
		return err;
	}

I suspect I might be missing some configuration steps. Could this be related to the device tree (DTS) or some board-specific settings?

What additional steps should I take to get BLE working properly on the Xiao BLE Sense?

Thanks in advance!

Parents
  • Hello,

    Have you tried an SDK version earlier than V2.7.0, and was it working fine? I'm asking because I have read about some issues with Xiao boards and Sysbuild.

    Could you try building without Sysbuild to see if it works? You can do this by selecting "No Sysbuild" under Build Configuration in VS Code. Let me know the result.

    Kind Regards,
    Abhijith

  • Hi, i will try it right now, however, i think it is due to the lack of some definitions inside the device tree. I am not by means an expert, and i would like to have a more robust answer that I own have. 
    additionally, I tested the LOG BLE example and it worked with the XIAO SEEED BLE SENSE.

    here I attache the device tree that it currently has:

    /dts-v1/;
    #include "xiao_ble_common.dtsi"
    #include <zephyr/dt-bindings/i2c/i2c.h>
    #include <zephyr/dt-bindings/gpio/nordic-nrf-gpio.h>
    
    / {
    	model = "Seeed XIAO BLE Sense";
    	compatible = "seeed,xiao-ble", "seeed,xiao-ble-sense";
    
    	msm261d3526hicpm-c-en {
    		compatible = "regulator-fixed";
    		enable-gpios = <&gpio1 10 (NRF_GPIO_DRIVE_S0H1 | GPIO_ACTIVE_HIGH)>;
    		regulator-name = "MSM261D3526HICPM-C-EN";
    	};
    
    	lsm6ds3tr-c-en {
    		compatible = "regulator-fixed-sync", "regulator-fixed";
    		enable-gpios = <&gpio1 8 (NRF_GPIO_DRIVE_S0H1 | GPIO_ACTIVE_HIGH)>;
    		regulator-name = "LSM6DS3TR_C_EN";
    		regulator-boot-on;
    		startup-delay-us = <3000>;
    	};
    };
    
    &i2c0 {
    	compatible = "nordic,nrf-twim";
    	/* Cannot be used together with spi0. */
    	status = "okay";
    	pinctrl-0 = <&i2c0_default>;
    	pinctrl-1 = <&i2c0_sleep>;
    	pinctrl-names = "default", "sleep";
    	clock-frequency = <I2C_BITRATE_FAST>;
    
    	lsm6ds3tr_c: lsm6ds3tr-c@6a {
    		compatible = "st,lsm6dsl";
    		reg = <0x6a>;
    		irq-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
    		status = "okay";
    	};
    };
    
    &pdm0 {
    	pinctrl-0 = <&pdm0_default>;
    	pinctrl-1 = <&pdm0_sleep>;
    	pinctrl-names = "default", "sleep";
    	clock-source = "PCLK32M";
    };

    as you can see, i do not have the UART activation. Do I have to although I am not using the physical lanes? (i am doing UART over BLE)

  • Hello,

    massimoklk said:
    Do I have to although I am not using the physical lanes?

    You don't need to, since you are using UART over BLE. By "LOG BLE sample," I assume you mean the Bluetooth logging backend sample from Zephyr. If that is the case, then the issue might be with your application. I recommend including the log inside the application, as this will help identify where the application is failing. You can refer to the same sample, as it does the same thing. See LOG_INFO and LOG_ERR.

    Kind Regards,

    Abhijith

  • yes! you are right, i meant the BLE logging backend sample.

    The problem i have is that the program fails because the UART cannot be initialised.

    This is the message it returns:

    00:00:02.313,049] \033[1;33m<wrn> usb_device: USB device support already enabled\033[0m
    [00:00:02.313,110] \033[1;31m<err> peripheral_uart: Cannot initialize UART callback\033[0m
    

    specifically, it returns -ENOSYS, when checking if the api->callback_set is NULL (meaning it is NULL).

    static inline int uart_callback_set(const struct device *dev,
                uart_callback_t callback,
                void *user_data)
    {
    #ifdef CONFIG_UART_ASYNC_API
      const struct uart_driver_api *api =
          (const struct uart_driver_api *)dev->api;
    
      if (api->callback_set == NULL) {
        return -ENOSYS;
      }
    
      return api->callback_set(dev, callback, user_data);
    #else
      ARG_UNUSED(dev);
      ARG_UNUSED(callback);
      ARG_UNUSED(user_data);
      return -ENOTSUP;
    #endif
    }

    do you know what may be happening?

Reply
  • yes! you are right, i meant the BLE logging backend sample.

    The problem i have is that the program fails because the UART cannot be initialised.

    This is the message it returns:

    00:00:02.313,049] \033[1;33m<wrn> usb_device: USB device support already enabled\033[0m
    [00:00:02.313,110] \033[1;31m<err> peripheral_uart: Cannot initialize UART callback\033[0m
    

    specifically, it returns -ENOSYS, when checking if the api->callback_set is NULL (meaning it is NULL).

    static inline int uart_callback_set(const struct device *dev,
                uart_callback_t callback,
                void *user_data)
    {
    #ifdef CONFIG_UART_ASYNC_API
      const struct uart_driver_api *api =
          (const struct uart_driver_api *)dev->api;
    
      if (api->callback_set == NULL) {
        return -ENOSYS;
      }
    
      return api->callback_set(dev, callback, user_data);
    #else
      ARG_UNUSED(dev);
      ARG_UNUSED(callback);
      ARG_UNUSED(user_data);
      return -ENOTSUP;
    #endif
    }

    do you know what may be happening?

Children
No Data
Related