SEEEDUINO XIAO compile error

Hi all
I've been succssfully using Nanos & Unos for some years but I wanted a very small board so I acquired a couple of Seeeduino Xiaos.
I have installed the software for managing the board in the IDE but I get a compile error:

arm-none-eabi-g++: error: DCC: No such file or directory
arm-none-eabi-g++: error: signal: No such file or directory
arm-none-eabi-g++: error: decoder.ino""": Invalid argument
Compilation error: exit status 1}

I did as suggested on another forum and removed the board libraries and re-installed them but to no avail.
The code works fine on a Nano using the exact same sketch with just the board details changed.
I'm using IDE2rc3

Any suggestions?

Cheers
Keith

Hi @melmerby. I'm going to ask you to post some additional information that might help us to identify the problem.

Please do this:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Check the box next to "Show verbose output during: ☐ compilation".
  3. Click the OK button.
  4. Select Sketch > Verify/Compile from the Arduino IDE menus.
  5. Wait for the compilation to end.
  6. Right click on the black "Output" pane at the bottom of the Arduino IDE 2.x window.
  7. From the context menu, click Copy All.
  8. Open a forum reply here by clicking the Reply button.
  9. Click the </> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block
  10. Press Ctrl+V.
    This will paste the compilation output into the code block.
  11. Move the cursor outside of the code tags before you add any additional text to your reply.
  12. Click the Reply button to post the output.

I own 3 of those boards, no problem with latest IDE on Linux Mint.

Remember it is 2 steps:

  • Add JSON to IDE Preferences
  • Add the core-board via board manager

I may or may not have restarted the IDE.

Should not be necessary, but unfortunately it is currently necessary to do a restart between those two steps at the moment when using Arduino IDE 2.x (not needed at all with 1.x):

AhHa,
Linux is all 1.x and Windows 11 is my 2.x playground.

As we used to say about MS-DOS, ... just reboot it before saying it does not work.

Sadly, my wonderful 4K TV needs to sometimes be "unplugged" to correct issues; I miss Alt+Ctrl+Del.

I have updated to IDE2 rc4 now and re-installed the DCC Decoder library from the GitHub zip (the one I am including)
I hope this is the correct format:

```cpp
Using board 'seeed_XIAO_m0' from platform in folder: C:\Users\Keith.DESKTOP-55532Q9\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.8.2
Using core 'arduino' from platform in folder: C:\Users\Keith.DESKTOP-55532Q9\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.8.2
Detecting libraries used...
"C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++14 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions "-D__SKETCH_NAME__=\"\"\"Dapol" DCC signal "decoder.ino\"\"\"" -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SEEED_XIAO_M0 -DARDUINO_ARCH_SAMD -DARDUINO_SAMD_ZERO -D__SAMD21__ -D__SAMD21G18A__ -DARM_MATH_CM0PLUS -DSEEED_XIAO_M0 -DUSB_VID=0x2886 -DUSB_PID=0x802F -DUSBCON -DUSB_CONFIG_POWER=100 "-DUSB_MANUFACTURER=\"Seeed\"" "-DUSB_PRODUCT=\"Seeed XIAO M0\"" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src" -DARDUINO_SAMD_ZERO -D__SAMD21__ -D__SAMD21G18A__ -DARM_MATH_CM0PLUS -DSEEED_XIAO_M0 -DUSB_VID=0x2886 -DUSB_PID=0x802F -DUSBCON -DUSB_CONFIG_POWER=100 "-DUSB_MANUFACTURER=\"Seeed\"" "-DUSB_PRODUCT=\"Seeed XIAO M0\"" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\CMSIS\\5.7.0/CMSIS/Core/Include/" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\CMSIS\\5.7.0/CMSIS/DSP/Include/" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\CMSIS-Atmel\\1.2.1/CMSIS-Atmel/CMSIS/Device/ATMEL/" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\variants\\XIAO_m0" "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\sketch\\Dapol DCC signal decoder.ino.cpp" -o nul
Error while detecting libraries included by C:\Users\Keith.DESKTOP-55532Q9\AppData\Local\Temp\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\sketch\Dapol DCC signal decoder.ino.cpp
Generating function prototypes...
"C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++14 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions "-D__SKETCH_NAME__=\"\"\"Dapol" DCC signal "decoder.ino\"\"\"" -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SEEED_XIAO_M0 -DARDUINO_ARCH_SAMD -DARDUINO_SAMD_ZERO -D__SAMD21__ -D__SAMD21G18A__ -DARM_MATH_CM0PLUS -DSEEED_XIAO_M0 -DUSB_VID=0x2886 -DUSB_PID=0x802F -DUSBCON -DUSB_CONFIG_POWER=100 "-DUSB_MANUFACTURER=\"Seeed\"" "-DUSB_PRODUCT=\"Seeed XIAO M0\"" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src" -DARDUINO_SAMD_ZERO -D__SAMD21__ -D__SAMD21G18A__ -DARM_MATH_CM0PLUS -DSEEED_XIAO_M0 -DUSB_VID=0x2886 -DUSB_PID=0x802F -DUSBCON -DUSB_CONFIG_POWER=100 "-DUSB_MANUFACTURER=\"Seeed\"" "-DUSB_PRODUCT=\"Seeed XIAO M0\"" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\CMSIS\\5.7.0/CMSIS/Core/Include/" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\CMSIS\\5.7.0/CMSIS/DSP/Include/" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\CMSIS-Atmel\\1.2.1/CMSIS-Atmel/CMSIS/Device/ATMEL/" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\cores\\arduino" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\Seeeduino\\hardware\\samd\\1.8.2\\variants\\XIAO_m0" "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\sketch\\Dapol DCC signal decoder.ino.cpp" -o "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\preproc\\ctags_target_for_gcc_minus_e.cpp"
arm-none-eabi-g++: error: DCC: No such file or directory
arm-none-eabi-g++: error: signal: No such file or directory
arm-none-eabi-g++: error: decoder.ino""": Invalid argument

Compilation error: exit status 1

Keith

The problem is your sketch file name "Dapol DCC signal decoder.ino". Spaces are not allowed in sketch files. It is actually a bug in the Arduino IDE 2.x that it allows you to create or open sketches with prohibited file names.

So you need to do two things:

  1. Close the Arduino IDE.
  2. Rename the sketch folder name from Dapol DCC signal decoder to something without spaces
    (e.g., DapolDCCSignalDecoder)
  3. Rename the sketch file from Dapol DCC signal decoder.ino to the same name as the folder
    (e.g., DapolDCCSignalDecoder.ino)
  4. Open the sketch in the Arduino IDE again.
1 Like

Hi
If the file name is incorrect, why does it work fine with a Nano?
(I've just tried it again, see below
I haven't changed anything but the board.

```cpp
Using board 'nano' from platform in folder: C:\Users\Keith.DESKTOP-55532Q9\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5
Using core 'arduino' from platform in folder: C:\Users\Keith.DESKTOP-55532Q9\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5
Detecting libraries used...
"C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\eightanaloginputs" "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\sketch\\Dapol DCC signal decoder.ino.cpp" -o nul
Alternatives for DCC_Decoder.h: [DCC_Decoder-master@1.6]
ResolveLibrary(DCC_Decoder.h)
  -> candidates: [DCC_Decoder-master@1.6]
"C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\eightanaloginputs" "-Ic:\\Users\\Keith.DESKTOP-55532Q9\\Documents\\Arduino\\libraries\\DCC_Decoder-master" "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\sketch\\Dapol DCC signal decoder.ino.cpp" -o nul
Using cached library dependencies for file: c:\Users\Keith.DESKTOP-55532Q9\Documents\Arduino\libraries\DCC_Decoder-master\DCC_Decoder.cpp
Generating function prototypes...
"C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\eightanaloginputs" "-Ic:\\Users\\Keith.DESKTOP-55532Q9\\Documents\\Arduino\\libraries\\DCC_Decoder-master" "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\sketch\\Dapol DCC signal decoder.ino.cpp" -o "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\builtin\\tools\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\eightanaloginputs" "-Ic:\\Users\\Keith.DESKTOP-55532Q9\\Documents\\Arduino\\libraries\\DCC_Decoder-master" "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\sketch\\Dapol DCC signal decoder.ino.cpp" -o "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\sketch\\Dapol DCC signal decoder.ino.cpp.o"
C:\Users\Keith.DESKTOP-55532Q9\Documents\Arduino\Dapol DCC signal decoder\Dapol DCC signal decoder.ino:12:3: warning: 'typedef' was ignored in this declaration
   typedef struct DCCAccessoryData {
   ^~~~~~~
Compiling libraries...
Compiling library "DCC_Decoder-master"
Using previously compiled file: C:\Users\Keith.DESKTOP-55532Q9\AppData\Local\Temp\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\libraries\DCC_Decoder-master\DCC_Decoder.cpp.o
Compiling core...
Using precompiled core: C:\Users\Keith.DESKTOP-55532Q9\AppData\Local\Temp\arduino-core-cache\core_arduino_avr_nano_cpu_atmega328_640ba1f6880b6617d2a8cef5b6a5ca38.a
Linking everything together...
"C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A/Dapol DCC signal decoder.ino.elf" "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\sketch\\Dapol DCC signal decoder.ino.cpp.o" "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A\\libraries\\DCC_Decoder-master\\DCC_Decoder.cpp.o" "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A/..\\arduino-core-cache\\core_arduino_avr_nano_cpu_atmega328_640ba1f6880b6617d2a8cef5b6a5ca38.a" "-LC:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A" -lm
"C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A/Dapol DCC signal decoder.ino.elf" "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A/Dapol DCC signal decoder.ino.eep"
"C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A/Dapol DCC signal decoder.ino.elf" "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A/Dapol DCC signal decoder.ino.hex"

Using library DCC_Decoder-master at version 1.6 in folder: C:\Users\Keith.DESKTOP-55532Q9\Documents\Arduino\libraries\DCC_Decoder-master 
"C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\Keith.DESKTOP-55532Q9\\AppData\\Local\\Temp\\arduino-sketch-59EE9D39C977C4C676AD6139B9C9256A/Dapol DCC signal decoder.ino.elf"
Sketch uses 2842 bytes (9%) of program storage space. Maximum is 30720 bytes.
Global variables use 326 bytes (15%) of dynamic memory, leaving 1722 bytes for local variables. Maximum is 2048 bytes.

--------------------------
Compilation complete.


Keith

Because the compilation recipe in the "Arduino AVR Boards" platform of the Nano does not contain this thing that was added to the compilation recipe in the "Seeed SAMD (32-bits ARM Cortex-M0+ and Cortex-M4) Boards" platform of the XIAO:

-D__SKETCH_NAME__="""{build.project_name}"""

With the spaces in your sketch name, that is expanded to this nonsensical monstrosity of a -D compiler flag:

Ah. I see now.
You learn something every day.

I have renamed the file and it works fine now.
Thank you for your help.

Keith

1 Like

Having got the project compiling and uploading correctly, I now find it wont run on the Xiao.
The Xiao (2 of them) have both been checked for correct operation with simple input/output sketches to prove the pins being used actually work.
The project sketch works 'as is' on a Nano.

The project is thus:
A DCC input from a DCC command station goes to Pin 2 on the board via a 6N137 opto coupler (this is a standard input for DCC decoder projects. The open collector load is returned to the 3.3v line so as to suit the 3.3v Xiao.
The DCC signal is available at this pin, see 'scope waveform:

The problem is that although the signal is apparently reaching Pin2 correctly, the program is not operating.
Pins 3,4,5,6 should switch between Vcc and 0v when a switching command is received from the DCC command station. The data into Pin2 changes but the pins do not switch.

This is the sketch:

#include <DCC_Decoder.h>


#define NUMACCESSORIES 2 // Enter the number of accessories here

// GO TO setup() TO CONFIGURE DCC ADDRESSES AND PIN NUMBERS

  typedef struct DCCAccessoryData {
  int   address;   // User Configurable DCC address
  byte  outputpin1; // User Configurable Arduino pin
  byte  outputpin2; // User Configurable Arduino pin
  byte  dccstate;  // Internal use DCC state of accessory, 1=on, 0=off
};
DCCAccessoryData accessory[NUMACCESSORIES];

// The DCC library calls this function to set / reset accessories
void BasicAccDecoderPacket_Handler(int address, boolean activate, byte data) {
  address -= 1;
  address *= 4;
  address += 1;
  address += (data & 0x06) >> 1;
  // address = address - 4; // uncomment this line for Roco Maus or z21
  boolean enable = (data & 0x01) ? 1 : 0;
  for (byte i=0; i<NUMACCESSORIES; i++) {
    if (address == accessory[i].address) {
      if (enable) accessory[i].dccstate = 1;
      else accessory[i].dccstate = 0;
    }
  }
}

void setup() { 


// CONFIGURATION OF ACCESSORIES
// Copy & Paste as many times as you have accessories 
// The amount must be same as NUMACCESSORIES
// Don't forget to increment the array index
  accessory[0].address   = 505; // DCC address
  accessory[0].outputpin1 = 3; // Arduino pin
  accessory[0].outputpin2 = 4; // Arduino pin
  
  accessory[1].address   = 506; // DCC address
  accessory[1].outputpin1 = 5; // Arduino pin
  accessory[1].outputpin2 = 6; // Arduino pin
   
// END OF CONFIGURATION OF ACCESSORIES

  DCC.SetBasicAccessoryDecoderPacketHandler(BasicAccDecoderPacket_Handler, true);
  DCC.SetupDecoder( 0x00, 0x00, 0 );

  for(byte i=0; i<NUMACCESSORIES; i++) {
    pinMode     (accessory[i].outputpin1, OUTPUT);
    digitalWrite(accessory[i].outputpin1, LOW);
    pinMode     (accessory[i].outputpin2, OUTPUT);
    digitalWrite(accessory[i].outputpin2, HIGH);
  }
}

void loop() {
  DCC.loop(); // Call to library function that reads the DCC data

  for(byte i=0; i<NUMACCESSORIES; i++) {
    if (accessory[i].dccstate)
      (digitalWrite(accessory[i].outputpin2, LOW), digitalWrite(accessory[i].outputpin1, HIGH));
      
    else
      (digitalWrite(accessory[i].outputpin1, LOW), digitalWrite(accessory[i].outputpin2, HIGH));
  }
}

Any suggestions?
Is the Xiao compatible with normal Arduino sketches?

Cheers
Keith

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.