Sample code from M5 Github does not work on AtomS3 in Arudino IDE



  • I am unable to get the LED Show example for the AtomS3 to compile, well any of the examples for that use the serial port. I followed these instructions. I am running Arduino IDE 2.2.1 on windows 11 with the M5 Stack library and the M5AtomS3 board selected in the IDE. Looks like it cannot find the definition of USBSerial as the error states "Compilation error: 'USBSerial' was not declared in this scope"

    In file included from c:\Users\Luke\OneDrive - Luke\Documents\Arduino\libraries\FastLED\src/FastLED.h:75,
                     from c:\Users\Luke\OneDrive - Luke\Documents\Arduino\libraries\M5AtomS3\src/M5AtomS3.h:8,
                     from C:\Users\Luke\AppData\Local\Temp\.arduinoIDE-unsaved2023109-47808-1drqtel.cea6\sketch_nov9a\sketch_nov9a.ino:15:
    c:\Users\Luke\OneDrive - Luke\Documents\Arduino\libraries\FastLED\src/fastspi.h:157:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output
     #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:\Users\Luke\AppData\Local\Temp\.arduinoIDE-unsaved2023109-47808-1drqtel.cea6\sketch_nov9a\sketch_nov9a.ino: In function 'void setup()':
    C:\Users\Luke\AppData\Local\Temp\.arduinoIDE-unsaved2023109-47808-1drqtel.cea6\sketch_nov9a\sketch_nov9a.ino:23:5: error: 'USBSerial' was not declared in this scope
         USBSerial.println("Pls Press Btn change color");
         ^~~~~~~~~
    C:\Users\Luke\AppData\Local\Temp\.arduinoIDE-unsaved2023109-47808-1drqtel.cea6\sketch_nov9a\sketch_nov9a.ino:23:5: note: suggested alternative: 'Serial'
         USBSerial.println("Pls Press Btn change color");
         ^~~~~~~~~
         Serial
    
    exit status 1
    
    Compilation error: 'USBSerial' was not declared in this scope
    


  • I'm having the same problem. I've tried a number of the examples and get various error messages. I recently updated my libraries, I have a feeling the problem is in there.



  • @lukes maybe try and set the tool config to
    0_1701024686893_Screenshot 2023-11-22 at 7.15.41 PM.png
    USB CDC on boot "disabled".
    -Terry

    https://community.m5stack.com/topic/5838/usbserial-was-not-declared-in-this-scope/3



  • Thank you for your reply. My tool config was set to USB CDC On Boot: "Disabled" so I changed it and then changed it back and restarted Arduino and go the same message. I did find this...https://github.com/m5stack/M5AtomS3/issues/23

    I changed the .cpp file but it didn't work and I got a new error when I tried to compile the "button" example. I think I was supposed to compile the .cpp file, but I don't know how to do that. Anyway, my new error..

                     from /Users/dianehallinen/Documents/Arduino/libraries/M5AtomS3/src/M5AtomS3.h:8,
                     from /private/var/folders/tc/p1d_fw296cb18b8wnf6rdm280000gn/T/.arduinoIDE-unsaved20231026-41153-fswrn6.re979/Button/Button.ino:15:
    /Users/dianehallinen/Documents/Arduino/libraries/FastLED/src/fastspi.h:157:23: note: #pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output
     #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /private/var/folders/tc/p1d_fw296cb18b8wnf6rdm280000gn/T/.arduinoIDE-unsaved20231026-41153-fswrn6.re979/Button/Button2.ino:20:6: error: redefinition of 'void setup()'
     void setup() {
          ^~~~~
    /private/var/folders/tc/p1d_fw296cb18b8wnf6rdm280000gn/T/.arduinoIDE-unsaved20231026-41153-fswrn6.re979/Button/Button.ino:20:6: note: 'void setup()' previously defined here
     void setup() {
          ^~~~~
    /private/var/folders/tc/p1d_fw296cb18b8wnf6rdm280000gn/T/.arduinoIDE-unsaved20231026-41153-fswrn6.re979/Button/Button2.ino:29:6: error: redefinition of 'void loop()'
     void loop() {
          ^~~~
    /private/var/folders/tc/p1d_fw296cb18b8wnf6rdm280000gn/T/.arduinoIDE-unsaved20231026-41153-fswrn6.re979/Button/Button.ino:29:6: note: 'void loop()' previously defined here
     void loop() {
          ^~~~
    
    exit status 1
    
    Compilation error: redefinition of 'void setup()'


  • @hallinen > dianehallinen
    Do you have an AtomS3 Lite or AtomS3 with LCD display?

    I can compile with no problems with a fully up-to-date Arduino IDE 2.2.1.

    I had this problem back in January and made this Issue:
    https://github.com/m5stack/M5AtomS3/issues/14

    -Terry



  • @teastain Thank you for the reply. I have the AtomS3 Lite. I'll give that solution a try. I told M5 stack help people about the issue. My Ardunio IDE is 2.1.0. I'll update it.



  • @hallinen Yes, I saw your comment over on https://github.com/m5stack/M5AtomS3/issues/23
    The solution to my identical issue/14 was to burn-back (erase all) to 'Arduino15/staging/packages' and re-install the M5 latest board definition.
    Tinyu-Zhao's solution was:
    "Perhaps there is a local cache package that is not downloading the latest M5Stack version definition
    Please delete the following path, uninstall the M5Stack 2.0.6 definition and try again
    /Users//Library/Arduino15/staging/packages"