Xiao nrf52840 Sense - Platformio.ini file for BLE and IMU usage

  1. I uploaded my previously working PLIO wrongly, apologies. This is it:

    [env:xiaoblesense]
    platform = https://github.com/maxgerhardt/platform-nordicnrf52
    framework = arduino
    board = xiaoblesense
    
    ; Ensure we use the Nordic SDK-based core (not Mbed)
    board_build.core = arduino
    
    ; Include necessary libraries
    lib_deps =
        arduino-libraries/ArduinoBLE@^1.3.7
        seeed-studio/Seeed Arduino LSM6DS3@^2.0.4
    
    ; Enable serial monitor at 9600 baud
    monitor_speed = 9600
    
    ; Disable compiler optimizations for debugging (optional)
    build_flags = -O0
    
    ; Ensure correct upload method
    upload_protocol = nrfutil
    
  2. I was able to get the IMU detected by Windows File Manager using the steps below:

    1. Plug the board into my computer
    2. Double-click the reset button
    3. (NOTE): this only worked on my laptop, which a specific port, and with only some cables. IDK why.
  3. To reset the firmware, I followed this link and uploaded the .u2 file to the Xiao sense: XIAO nRF52840 (and Sense) | MicroBlocks Wiki.

  4. Step 3 allows the IMU to be detected again. But uploading any code (such as the blinky example in ArduinoIDE) causes the issue to come back.

  5. (NOTE): This started when I uploaded BLE code using the updated PLIO.

(For anyone else) I decided to update it because I was receiving this error:
.pio\libdeps\xiaoblesense\Seeed Arduino LSM6DS3\LSM6DS3.cpp: In member function ‘status_t LSM6DS3Core::beginCore()’:
.pio\libdeps\xiaoblesense\Seeed Arduino LSM6DS3\LSM6DS3.cpp:108:17: error: ‘class arduino::MbedSPI’ has no member named ‘setBitOrder’
SPI.setBitOrder(MSBFIRST);
^~~~~~~~~~~
.pio\libdeps\xiaoblesense\Seeed Arduino LSM6DS3\LSM6DS3.cpp: In member function ‘void LSM6DS3::fifoBegin()’:
.pio\libdeps\xiaoblesense\Seeed Arduino LSM6DS3\LSM6DS3.cpp:766:13: warning: unused variable ‘thresholdHByte’ [-Wunused-variable]
uint8_t thresholdHByte = (settings.fifoThreshold & 0x0F00) >> 8;
^~~~~~~~~~~~~~
*** [.pio\build\xiaoblesense\lib1b4\Seeed Arduino LSM6DS3\LSM6DS3.cpp.o] Error 1

This solves the issue: https://github.com/Seeed-Studio/Seeed_Arduino_LSM6DS3/issues/28