XIAO NRF52840 BLE - USB and BLE Issues

Hello,

I have the xiao ble/seeed studio nrf52840 and I'm trying to run the following SDK projects using armgcc:

- usbd_hid_composite

- ble_app_hids_keyboard

No matter what I do, I can't see the device show up in Windows 11 via bluetooth or USB. The ble hids keyboard does show up on my phone via the nordic connect app though and blinky does work just fine; so the board is operating.

  • I have done the following:
    • modified the make file to support the xiao ble board setup
    • I've modified the linker script so that the bootloader does not get overwritten: 

MEMORY
{
FLASH (rx) : ORIGIN = 0x00027000, LENGTH = 0x100000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x40000
}

  • I convert the hex file to the corresponding UF2 format using the following command (this device uses the adafruit easy uf2 bootloader):

UF2 Bootloader 0.6.2-12-g459adc9-dirty lib/nrfx (v2.0.0) lib/tinyusb (0.10.1-293-gaf8e5a90) lib/uf2 (remotes/origin/configupdate-9-gadbb8c7)
Model: Seeed XIAO nRF52840
Board-ID: Seeed_XIAO_nRF52840_Sense
Date: Nov 30 2021
SoftDevice: S140 7.3.0

Also, the nordic sdk version is: "nRF5_SDK_17.1.0_ddde560"

Please let me know if other information is needed. I just need some guidance to understand why Windows Bluetooth and USB HIDS will not detect the device. And no the device doesn't even show up as an undefined device...

Thank you,

Nick

Parents
  • Hello Nick,

    Please try changing the low-frequency clock source from the default 32 kHz crystal oscillator (which is the default for all nRF5 SDK BLE projects) to the internal 32 kHz RC oscillator. Then, see if you get the same result. The 32 kHz crystal is optional, and I'm not sure if it is included in your BT module. If you select the crystal oscillator and run the code on a board that doesn't have the crystal mounted, the startup code will enter an infinite loop, waiting for the crystal to ramp up.

    sdk_config.h settings to select the internal RC oscillator:

    // </h> 
    //==========================================================
    
    // <h> Clock - SoftDevice clock configuration
    
    //==========================================================
    // <o> NRF_SDH_CLOCK_LF_SRC  - SoftDevice clock source.
     
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC 0
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval. 
    #ifndef NRF_SDH_CLOCK_LF_RC_CTIV
    #define NRF_SDH_CLOCK_LF_RC_CTIV 8
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature. 
    // <i> How often (in number of calibration intervals) the RC oscillator shall be calibrated
    // <i>  if the temperature has not changed.
    
    #ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_ACCURACY  - External clock accuracy used in the LL to compute timing.
     
    // <0=> NRF_CLOCK_LF_ACCURACY_250_PPM 
    // <1=> NRF_CLOCK_LF_ACCURACY_500_PPM 
    // <2=> NRF_CLOCK_LF_ACCURACY_150_PPM 
    // <3=> NRF_CLOCK_LF_ACCURACY_100_PPM 
    // <4=> NRF_CLOCK_LF_ACCURACY_75_PPM 
    // <5=> NRF_CLOCK_LF_ACCURACY_50_PPM 
    // <6=> NRF_CLOCK_LF_ACCURACY_30_PPM 
    // <7=> NRF_CLOCK_LF_ACCURACY_20_PPM 
    // <8=> NRF_CLOCK_LF_ACCURACY_10_PPM 
    // <9=> NRF_CLOCK_LF_ACCURACY_5_PPM 
    // <10=> NRF_CLOCK_LF_ACCURACY_2_PPM 
    // <11=> NRF_CLOCK_LF_ACCURACY_1_PPM 
    
    #ifndef NRF_SDH_CLOCK_LF_ACCURACY
    #define NRF_SDH_CLOCK_LF_ACCURACY 1
    #endif

    Regarding the linker scripts, the Softdevice/App will fail to boot when you set the RAM base address to 0x20000000 as you did (see Memory resource map and usage). But you should be able to use the original one provided by the ble_app_hids_keyboard example. 

    Best regards,

    Vidar

  • Hi Vidar, thank you for your response.

    I changed the clock from external to internal and nothing changed for both the BLE keyboard and USB HID composite projects. I can still see the device via the nrf connect app on my phone when running the BLE keyboard project but not windows.

    That makes sense, and I checked just in case. This xiao ble/seeed studio nrf52840 has a 32 KHz crystal and a 32 MHz crystal. I'll double check the sdk_config.h settings to see if the settings are incorrect (thank you, I forgot about this file).

    I'm unsure if you can use this link, but this is the board schematic:

    https://files.seeedstudio.com/wiki/XIAO-BLE/Seeed-Studio-XIAO-nRF52840-Sense-v1.1.pdf

    Also, thank you for the tip about the linker script; I used the original setup.

    MEMORY
    {
    FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xd9000
    RAM (rwx) : ORIGIN = 0x20002260, LENGTH = 0x3dda0
    }

    Two questions:

    • do you know of anything else I can do in the meantime while I review the sdk_config.h file for issues?
    • do you know why windows 11 wont detect the device via bluetooth?

    Thank you,

    Nick

  • Hi Nick,

    Sorry, I somehow overlooked the fact that you were able to connect the HID BLE example with your phone, even though you highlighted it in your initial post. This suggests that the BLE firmware was built and programmed correctly, ruling out a configuration issue. I will find a Windows 11 PC here and see if I can reproduce the problem on my side.

  • Hi Nick,

    When you try to add the BLE keyboard, is the problem that you are not able to discover it, or that it fails to connect?

    I tried the example without any modifications on a 52840 DK and a Windows 11 PC:

  • Hi Vidar,

    I found the problem. I had "arm-none-eabi-gcc --version" pointing to a bin folder that contained version 10.3.1 but my SDK ($(sdk_location)/components/toolchain/gcc/makefile.windows) was pointing to a local bin of version 9.3.1. Changing my "path" in windows environment variables to my local bin of version 9.3.1 fixed the issues with bluetooth. I can now see the "Nordic_Keyboard" in the bluetooth digest after installing the "ble_app_hids_keyboard" example to my board.

    Still, I cannot get the "usbd_hid_composite" example to work on my board though. It seems as though every time I run the example... it overwrites my soft device in flash.

    I've modified the linker script to have the same components as the "ble_app_hids_keyboard" project but it doesn't seem to work:

    FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xd9000
    RAM (rwx) : ORIGIN = 0x20002260, LENGTH = 0x3dda0

    Thank you,

    Nick

Reply
  • Hi Vidar,

    I found the problem. I had "arm-none-eabi-gcc --version" pointing to a bin folder that contained version 10.3.1 but my SDK ($(sdk_location)/components/toolchain/gcc/makefile.windows) was pointing to a local bin of version 9.3.1. Changing my "path" in windows environment variables to my local bin of version 9.3.1 fixed the issues with bluetooth. I can now see the "Nordic_Keyboard" in the bluetooth digest after installing the "ble_app_hids_keyboard" example to my board.

    Still, I cannot get the "usbd_hid_composite" example to work on my board though. It seems as though every time I run the example... it overwrites my soft device in flash.

    I've modified the linker script to have the same components as the "ble_app_hids_keyboard" project but it doesn't seem to work:

    FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xd9000
    RAM (rwx) : ORIGIN = 0x20002260, LENGTH = 0x3dda0

    Thank you,

    Nick

Children
Related