Hi there,
So You have bought a Xiao Expansion Board…
Where do You begin?
Read the Wiki it’s loaded with Hints and Tips… Examples that may or may NOT run unless you prepare your environment exactly like the demo? WOW that’s a gamble IMO. Two alike development systems in the same room, let alone across the Globe.
I propose to make this thread an area you can get a Drag & Drop Flash file to test your hardware and give you confidence that the hardware and Basic code works!
With so many IDE choices ,BSP files, Component Libraries and Wiki’s that are not maintained even Software support that has gone by the way of the Dodo-Bird… The Xiao Nrf52840 MCU in either (BLE or Sense)* Variants is a part of this Salad.
To start THIS: Basic SD Card Reading. uf2 flash file, it outputs to the Serial port the type of SD and verifies the hardware works. Simple Drag & Drop ,basic easy to incorporate, follow and understand.
Here is what you need.
(picture) Xiao Expansion Board, a Xiao Nrf52840 * and an SD card also pictured are PINS and battery optional.
(SEEED is penny wise and pound foolish ) **Soapbox ON!!**The pins do NOT come with the Xiao anymore. Can you imagine? You order the Xiao MCU, the Board and an SD card, Only to be disappointed when it arrives that you must now wait and order the M’F’N Pins… Blows the whole experience(Note1), C’mon MAN! Even a Third Grader’s HATE this!!
But I digress…
SD Card is (32Gig Max.- Fat32 formatted with 32K Allocation Unit size.)
-
- Install the Xiao on the Board.
-
- Install the SD card (bottom Up & Pushed IN)
-
- Put in Bootloader mode
-
- Drag & Drop the uf2 flash file onto the Xiao.
Open a serial monitor, 9600 Baud 8N1. You should see the same serial output as Above with similar SD info contained if everything is working correctly.
Be sure to push it all the way in, it clicks and let go.
This is code from the Examples compiled using both BSP for Xiao 1.1.8 and 2.9.2 just for clarity.
This is the serial output…My SD was used in the Gif demo so there are files present.
Hello Seeed Studio SD card Checker for Xiao Expansion Board....
Initializing SD card...Wiring is correct and a card is present.
Card type: SDHC
Clusters: 954095
Blocks x Cluster: 64
Total Blocks: 61062080
Volume type is: FAT32
Volume size (Kb): 30531040
Volume size (Mb): 29815
Volume size (Gb): 29.12
Files found on the card (name, date and size in bytes):
SYSTEM~1/ 2024-03-13 00:03:24
WPSETT~1.DAT 2024-03-13 00:03:24 12
INDEXE~1 2024-03-13 00:03:28 76
TEST.TXT 1980-01-01 00:00:06 1048576
FOO.TXT 1980-01-01 00:00:02 13
This is the compiler output…so you can build your own and compare.
FQBN: Seeeduino:nrf52:xiaonRF52840Sense
Using board 'xiaonRF52840Sense' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8
Using core 'nRF5' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8
Detecting libraries used...
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\9-2019q4/bin/arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -c -g -Werror=return-type -mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=64000000 -DARDUINO=10607 -DARDUINO_Seeed_XIAO_nRF52840_Sense -DARDUINO_ARCH_NRF52 -DARDUINO_BSP_VERSION="1.1.8" -DNRF52840_XXAA -DUSBCON -DUSE_TINYUSB -DUSB_VID=0x2886 -DUSB_PID=0x8045 -DUSB_MANUFACTURER="Seeed" -DUSB_PRODUCT="XIAO nRF52840 Sense" -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 -Ofast -DCFG_DEBUG=0 -DCFG_LOGGER=0 -DCFG_SYSVIEW=0 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/Core/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/DSP/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/hal -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/mdk -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/soc -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/drivers/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/drivers/src -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/Source/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/portable/GCC/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/portable/CMSIS/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/sysview/SEGGER -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/sysview/Config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8/libraries/Adafruit_TinyUSB_Arduino/src/arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\variants\Seeed_XIAO_nRF52840_Sense C:\Users\Dude\AppData\Local\Temp\arduino\sketches\9E36D697D862A1D186AAD026CAA03BFF\sketch\SD_basic_Test.ino.cpp -o nul
Alternatives for SPI.h: [[email protected]]
ResolveLibrary(SPI.h)
-> candidates: [[email protected]]
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\9-2019q4/bin/arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -c -g -Werror=return-type -mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=64000000 -DARDUINO=10607 -DARDUINO_Seeed_XIAO_nRF52840_Sense -DARDUINO_ARCH_NRF52 -DARDUINO_BSP_VERSION="1.1.8" -DNRF52840_XXAA -DUSBCON -DUSE_TINYUSB -DUSB_VID=0x2886 -DUSB_PID=0x8045 -DUSB_MANUFACTURER="Seeed" -DUSB_PRODUCT="XIAO nRF52840 Sense" -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 -Ofast -DCFG_DEBUG=0 -DCFG_LOGGER=0 -DCFG_SYSVIEW=0 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/Core/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/DSP/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/hal -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/mdk -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/soc -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/drivers/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/drivers/src -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/Source/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/portable/GCC/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/portable/CMSIS/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/sysview/SEGGER -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/sysview/Config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8/libraries/Adafruit_TinyUSB_Arduino/src/arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\variants\Seeed_XIAO_nRF52840_Sense -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\libraries\SPI C:\Users\Dude\AppData\Local\Temp\arduino\sketches\9E36D697D862A1D186AAD026CAA03BFF\sketch\SD_basic_Test.ino.cpp -o nul
Alternatives for SD.h: [[email protected] [email protected]]
ResolveLibrary(SD.h)
-> candidates: [[email protected] [email protected]]
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\9-2019q4/bin/arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -c -g -Werror=return-type -mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=64000000 -DARDUINO=10607 -DARDUINO_Seeed_XIAO_nRF52840_Sense -DARDUINO_ARCH_NRF52 -DARDUINO_BSP_VERSION="1.1.8" -DNRF52840_XXAA -DUSBCON -DUSE_TINYUSB -DUSB_VID=0x2886 -DUSB_PID=0x8045 -DUSB_MANUFACTURER="Seeed" -DUSB_PRODUCT="XIAO nRF52840 Sense" -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 -Ofast -DCFG_DEBUG=0 -DCFG_LOGGER=0 -DCFG_SYSVIEW=0 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/Core/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/DSP/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/hal -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/mdk -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/soc -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/drivers/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/drivers/src -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/Source/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/portable/GCC/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/portable/CMSIS/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/sysview/SEGGER -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/sysview/Config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8/libraries/Adafruit_TinyUSB_Arduino/src/arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\variants\Seeed_XIAO_nRF52840_Sense -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\libraries\SPI -Id:\Arduino_projects\libraries\SD\src C:\Users\Dude\AppData\Local\Temp\arduino\sketches\9E36D697D862A1D186AAD026CAA03BFF\sketch\SD_basic_Test.ino.cpp -o nul
C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\arm-none-eabi-gcc\9-2019q4/bin/arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -c -g -Werror=return-type -mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=64000000 -DARDUINO=10607 -DARDUINO_Seeed_XIAO_nRF52840_Sense -DARDUINO_ARCH_NRF52 -DARDUINO_BSP_VERSION="1.1.8" -DNRF52840_XXAA -DUSBCON -DUSE_TINYUSB -DUSB_VID=0x2886 -DUSB_PID=0x8045 -DUSB_MANUFACTURER="Seeed" -DUSB_PRODUCT="XIAO nRF52840 Sense" -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 -Ofast -DCFG_DEBUG=0 -DCFG_LOGGER=0 -DCFG_SYSVIEW=0 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/Core/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\tools\CMSIS\5.7.0/CMSIS/DSP/Include/ -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/hal -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/mdk -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/soc -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/drivers/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/nrfx/drivers/src -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/nordic/softdevice/s140_nrf52_7.3.0_API/include/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/Source/include -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/portable/GCC/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/freertos/portable/CMSIS/nrf52 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/sysview/SEGGER -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5/sysview/Config -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8/libraries/Adafruit_TinyUSB_Arduino/src/arduino -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\cores\nRF5 -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\variants\Seeed_XIAO_nRF52840_Sense -IC:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\libraries\SPI -Id:\Arduino_projects\libraries\SD\src C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\libraries\SPI\SPI.cpp -o nul
Alternatives for Adafruit_TinyUSB.h: [Adafruit TinyUSB [email protected]]
ResolveLibrary(Adafruit_TinyUSB.h)
-> candidates: [Adafruit TinyUSB [email protected]]
***Brevity Edit***
Zip created at C:\Users\Dude\AppData\Local\Temp\arduino\sketches\9E36D697D862A1D186AAD026CAA03BFF/SD_basic_Test.ino.zip
Multiple libraries were found for "SD.h"
Used: D:\Arduino_projects\libraries\SD
Not used: C:\Users\Dude\AppData\Local\Arduino15\libraries\SD
Using library SPI at version 1.0 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\libraries\SPI
Using library SD at version 1.2.4 in folder: D:\Arduino_projects\libraries\SD
Using library Adafruit TinyUSB Library at version 1.7.0 in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8\libraries\Adafruit_TinyUSB_Arduino
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\9-2019q4/bin/arm-none-eabi-size" -A "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\9E36D697D862A1D186AAD026CAA03BFF/SD_basic_Test.ino.elf"
Sketch uses 53776 bytes (6%) of program storage space. Maximum is 811008 bytes.
Global variables use 8012 bytes (3%) of dynamic memory, leaving 229556 bytes for local variables. Maximum is 237568 bytes.
Performing 1200-bps touch reset on serial port COM20
Waiting for upload port...
Upload port found on COM21
"C:\Users\Dude\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.8/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe" --verbose dfu serial -pkg "C:\Users\Dude\AppData\Local\Temp\arduino\sketches\9E36D697D862A1D186AAD026CAA03BFF/SD_basic_Test.ino.zip" -p COM21 -b 115200 --singlebank
Upgrading target on COM21 with DFU package C:\Users\Dude\AppData\Local\Temp\arduino\sketches\9E36D697D862A1D186AAD026CAA03BFF\SD_basic_Test.ino.zip. Flow control is disabled, Single bank, Touch disabled
Opened serial port COM21
Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 53784
Sending DFU start packet
Sending DFU init packet
Sending firmware file
########################################
########################################
##########################
Activating new firmware
DFU upgrade took 3.8244261741638184s
Device programmed.
here is the Code contained in the uf2 files( drag and drop to test your SD card & drive)…
//----------------------------------------------------------------------------------------------
//BSP : Seeed nRF52 Borads 1.1.1 or 2.9.2 both work.
//Board : Seeed nRF52 Borads / Seeed XIAO nRF52840 Sense
// 03/24/2024
// built by PJG for a standalone uf2 flash file.
//----------------------------------------------------------------------------------------------
/*
SD card test
This example shows how use the utility libraries on which the'
SD library is based in order to get info about your SD card.
Very useful for testing a card when you're not sure whether its working or not.
The circuit:
SD card attached to SPI bus as follows:
** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila
** MISO - pin 12 on Arduino Uno/Duemilanove/Diecimila
** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila
** CS - depends on your SD card shield or module.
Pin 4 used here for consistency with other Arduino examples
created 28 Mar 2011
by Limor Fried
modified 9 Apr 2012
by Tom Igoe
*/
// include the SD library:
#include <SPI.h>
#include <SD.h>
//#include <pins_arduino.h>
// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;
// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
// MKRZero SD: SDCARD_SS_PIN
//const int chipSelect = PA4;
// SEEED Xiao Expansion Brd = 2
//***********************************************************************************
// SCK : D8, MISO : D9, MOSI : D10, GND : GND, VCC : 3V3
const int chipSelect = 2;
//***********************************************************************************
#define SD_CS 2 // SD card chip select
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// LED intialization
pinMode(LED_RED, OUTPUT);
pinMode(LED_GREEN, OUTPUT);
pinMode(LED_BLUE, OUTPUT);
digitalWrite(LED_RED, HIGH);
digitalWrite(LED_GREEN, HIGH);
digitalWrite(LED_BLUE, HIGH);
Serial.println("Hello Seeed Studio SD card Checker for Xiao Expansion Board....");
Serial.print("\nInitializing SD card...");
// we'll use the initialization code from the utility libraries
// since we're just testing if the card is working!
// if (!card.init(SPI_HALF_SPEED, chipSelect)) {
if (!card.init(SPI_FULL_SPEED, chipSelect)) {
Serial.println("initialization failed. Things to check:");
Serial.println("* is a card inserted?");
Serial.println("* is your wiring correct?");
Serial.println("* did you change the chipSelect pin to match your shield or module?");
while (1);
} else {
Serial.println("Wiring is correct and a card is present.");
}
// print the type of card
Serial.println();
Serial.print("Card type: ");
switch (card.type()) {
case SD_CARD_TYPE_SD1:
Serial.println("SD1");
break;
case SD_CARD_TYPE_SD2:
Serial.println("SD2");
break;
case SD_CARD_TYPE_SDHC:
Serial.println("SDHC");
break;
default:
Serial.println("Unknown");
}
// Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
if (!volume.init(card)) {
Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
while (1);
}
Serial.print("Clusters: ");
Serial.println(volume.clusterCount());
Serial.print("Blocks x Cluster: ");
Serial.println(volume.blocksPerCluster());
Serial.print("Total Blocks: ");
Serial.println(volume.blocksPerCluster() * volume.clusterCount());
Serial.println();
// print the type and size of the first FAT-type volume
uint32_t volumesize;
Serial.print("Volume type is: FAT");
Serial.println(volume.fatType(), DEC);
volumesize = volume.blocksPerCluster(); // clusters are collections of blocks
volumesize *= volume.clusterCount(); // we'll have a lot of clusters
volumesize /= 2; // SD card blocks are always 512 bytes (2 blocks are 1KB)
Serial.print("Volume size (Kb): ");
Serial.println(volumesize);
Serial.print("Volume size (Mb): ");
volumesize /= 1024;
Serial.println(volumesize);
Serial.print("Volume size (Gb): ");
Serial.println((float)volumesize / 1024.0);
Serial.println("\nFiles found on the card (name, date and size in bytes): ");
root.openRoot(volume);
// list all files in the card with date and size
root.ls(LS_R | LS_DATE | LS_SIZE);
}
void loop(void) {
}
SD_basic_Test.zip (101.5 KB)
Insert Video (here)dragging and dropping…LOL
How it’s made,
I compiled, downloaded & programmed the Xiao. the Code Runs and works.
I saved the File as SD_basic_Test.ino
I selected Export Compiled Binary from IDE sketch menu.
I ran the python Script in Terminal window (like this guide) From the HEX file generated.
I drag the generated firmware.uf2 file to a fresh Xiao open in Boot mode. After a short windows copy progress box PopUp closes it resets and Bob’s Your uncle.
YMMV
HTH
GL PJ
The Next one will have Display and RTC as well as some BLE action. coming Up!
in the meantime if you want an LED blinker Here it is, Drag and Drop.
Xiao_RGB_test.zip (153.4 KB)
This ONLY cycles through the RGB LED on the Xiao outputs the color to the Serial port. Enjoy…(this runs on a Xiao not mounted on expansion base too, or on Battery)
Note1, I like seeed products. but I don’t get the pins thing? seems like a cheap out.
I deal with it my way. I made a socket and it’s a WIP (work in progress) I don’t need the pins then. I know of 3 cases where newbies, a student and a professor who all where impressed by seeed studio demo’s.
They ordered the parts only to be disappointed, I had to show the student how to solder. (this is a Barrier to entry for new people) I can open the package and put it in the socket and turn it on… YOU FEEL ME? either the Expansion board gets a socket or the pins should come with the MCU.
but that’s just me… they are up on thingiverse btw too. Free!
Some tools I like too.