"An Error Occurred" with no extra information

Status
Not open for further replies.
Hi all,

Strange issue here –*uploading from teensyduino to either 3.6 or 4.1, programs compile fine and (I think) mostly upload fine, but every upload finishes with the cryptic "An error occurred while uploading the sketch".

here's the verbose output (both compile and upload), uploading blink. (the LED does, in fact, blink):

Code:
Arduino: 1.8.15 (Mac OS X), TD: 1.54, Board: "Teensy 3.6, Serial, 180 MHz, Faster, US English"

/Applications/Teensyduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Teensyduino.app/Contents/Java/hardware -tools /Applications/Teensyduino.app/Contents/Java/tools-builder -tools /Applications/Teensyduino.app/Contents/Java/hardware/tools/avr -built-in-libraries /Applications/Teensyduino.app/Contents/Java/libraries -libraries /Users/sam/Documents/Arduino/libraries -fqbn=teensy:avr:teensy36:usb=serial,speed=180,opt=o2std,keys=en-us -ide-version=10815 -build-path /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214 -warnings=none -build-cache /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_cache_160304 -verbose /Applications/Teensyduino.app/Contents/Java/examples/01.Basics/Blink/Blink.ino
/Applications/Teensyduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Teensyduino.app/Contents/Java/hardware -tools /Applications/Teensyduino.app/Contents/Java/tools-builder -tools /Applications/Teensyduino.app/Contents/Java/hardware/tools/avr -built-in-libraries /Applications/Teensyduino.app/Contents/Java/libraries -libraries /Users/sam/Documents/Arduino/libraries -fqbn=teensy:avr:teensy36:usb=serial,speed=180,opt=o2std,keys=en-us -ide-version=10815 -build-path /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214 -warnings=none -build-cache /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_cache_160304 -verbose /Applications/Teensyduino.app/Contents/Java/examples/01.Basics/Blink/Blink.ino
Using board 'teensy36' from platform in folder: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr
Using core 'teensy3' from platform in folder: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr
Detecting libraries used...
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -mno-unaligned-access -fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -D__MK66FX1M0__ -DTEENSYDUINO=154 -DARDUINO=10815 -DARDUINO_TEENSY36 -DF_CPU=180000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3 /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/sketch/Blink.ino.cpp -o /dev/null
Generating function prototypes...
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -mno-unaligned-access -fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -D__MK66FX1M0__ -DTEENSYDUINO=154 -DARDUINO=10815 -DARDUINO_TEENSY36 -DF_CPU=180000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3 /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/sketch/Blink.ino.cpp -o /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/preproc/ctags_target_for_gcc_minus_e.cpp
/Applications/Teensyduino.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/precompile_helper /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3 /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214 /Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -x c++-header -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -mno-unaligned-access -MMD -fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -D__MK66FX1M0__ -DTEENSYDUINO=154 -DARDUINO=10815 -DARDUINO_TEENSY36 -DF_CPU=180000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3 /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/pch/Arduino.h -o /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/pch/Arduino.h.gch
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -mno-unaligned-access -MMD -fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -D__MK66FX1M0__ -DTEENSYDUINO=154 -DARDUINO=10815 -DARDUINO_TEENSY36 -DF_CPU=180000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/pch -I/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3 /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/sketch/Blink.ino.cpp -o /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/sketch/Blink.ino.cpp.o
Compiling libraries...
Compiling core...
Using precompiled core: /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_cache_160304/core/core_6a8e06dec8be36068a20aa0373a23a9d.a
Linking everything together...
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-gcc -O2 -Wl,--gc-sections,--relax,--defsym=__rtc_localtime=1632219068 -T/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/mk66fx1m0.ld -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -o /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/Blink.ino.elf /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/sketch/Blink.ino.cpp.o /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/../arduino_cache_160304/core/core_6a8e06dec8be36068a20aa0373a23a9d.a -L/var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214 -larm_cortexM4lf_math -lm -lstdc++
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/Blink.ino.elf /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/Blink.ino.eep
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-objcopy -O ihex -R .eeprom /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/Blink.ino.elf /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/Blink.ino.hex
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/stdout_redirect /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/Blink.ino.lst /Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-objdump -d -S -C /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/Blink.ino.elf
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/stdout_redirect /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/Blink.ino.sym /Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-objdump -t -C /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/Blink.ino.elf
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/teensy_post_compile -file=Blink.ino -path=/var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214 -tools=/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/ -board=TEENSY36
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/teensy_size /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/Blink.ino.elf
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-size -A /var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214/Blink.ino.elf
Sketch uses 7996 bytes (0%) of program storage space. Maximum is 1048576 bytes.
Global variables use 3076 bytes (1%) of dynamic memory, leaving 259068 bytes for local variables. Maximum is 262144 bytes.
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools/teensy_post_compile -file=Blink.ino -path=/var/folders/w7/h4832m4j00j3ml2f0k0761s80000gn/T/arduino_build_288214 -tools=/Applications/Teensyduino.app/Contents/Java/hardware/teensy/../tools -board=TEENSY36 -reboot -port=usb:14320000 -portlabel=/dev/cu.usbmodem102538701 Serial -portprotocol=Teensy 
[B]An error occurred while uploading the sketch[/B]

I wouldn't post (or care) if I wasn't also seeing some strangeness with the serial monitor – sometimes it works, sometimes it's blank forever. One clue, perhaps, is that I downloaded TyCommander also, and if I have a delay(1000); Serial.println("hello");after Serial.begin(9600);, I see the serial output in TyCommander but not in the IDE serial monitor.

So I'm wondering if the two are related...
 
Maybe if you have TyCommander and the Serial enabled and you try to do a build, the loader won't be able to get the Serial port and will fail. And likewise if TyCommander is running the Serial Monitor won't be able to get the Serial...
 
<edit> :Crosspost ... and perhaps what @KurtE said. IDE will disable SerMon by default, unless TyCommander is 'Integrated' it won't know to release the hold on the "serial' port for upload unless manually set OFF before upload attempt.

Indeed, If everything works as expected that wouldn't normally show that error

If Teensy Loader doing the upload? If so open the help /Verbose and confirm if it is uploading or showing issues.
Or : if TyCommander has been 'Integrated' to perform the uploads do View / Show Application Log

Also to verify a new upload is in place after rebuilding this will show an updated Time/Date in the Serial Monitor:
Code:
  while (!Serial && millis() < 4000 );
  Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);

It may be that TyCommander connects faster to show that "hello" output { after the delay(1000) } than the IDE SerMon, so the longer 4 second wait above may change the results.
 
Interesting. And yes, seems like that's it. I get no errors with TyCommander fully quit. I had been trying with it open but not with the monitor open (just now dawning on me that's what SerMon is an abbreviation for :eek:).

And defragster that's a cool trick, I didn't know that data was stored anywhere on the board. Always more to learn!
 
Interesting. And yes, seems like that's it. I get no errors with TyCommander fully quit. I had been trying with it open but not with the monitor open (just now dawning on me that's what SerMon is an abbreviation for :eek:).

And defragster that's a cool trick, I didn't know that data was stored anywhere on the board. Always more to learn!

Glad to hear it is resolved.

Those __????__ things are known to the compiler to store and filled in for use at run time as strings.
 
Status
Not open for further replies.
Back
Top