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,

    I'm glad to hear that you were able to find the problem with the BLE example. I'm not sure what the problem was though - Make should only invoke the toolchain specified in Makefile.Windows. It does not look for toolchains in PATH env. variable. 

    NutNick said:
    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:

    The USBD example does not include the softdevice/ble stack so the application must be linked to start on top of the MBR at 0x1000 instead. Please try with this memory layout instead:

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x1000, LENGTH = 0xff000
      RAM (rwx) :  ORIGIN = 0x20000008, LENGTH = 0x3fff8
    }
    

    Flash layout with bootloader and MBR

  • Hi Vidar,

    There is a possibility that my strange setup caused the problem. I'm using mingw and I've installed make manually. I'm not sure! All I know is that bluetooth is working properly now after changing my PATH environment variable :/

    As for the USB project, I modified the linker script but am still unable to successfully run the example (windows does not show the USB composite device). I'll try to see if I can look more into the sdk_config.h to see if there is anything that this board doesn't support... and I'll try other USB examples in the meantime.

    Thank you,

    Nick

  • Hi Nick,

    I guess the most important thing is that it works now. With regards HID over USB, could you please try the 'usbd_hid_generic' example with the same linker script to see if that works? 

  • Hi Vidar,

    I tried that example too but still nothing showed up for me in Windows.

    The CDC COM port for USB did show up when I ran the "usbd_ble_uart" example though. At least USB shows up in some form. HID seems to be an issue.

    Thanks,

    Nick

  • Hi Nick,

    Please try the attached hex file and see if it works. I built it from the usbd_hid_generic project.

    3034.nrf52840_xxaa.hex

    Best regards,

    Vidar

Reply Children
No Data
Related