Teensyduino Loader with "Download ERROR"

Bob Larkin

Well-known member
I have a Loader problem that that results in a red "Download ERROR" error box. To start off, I regret that I cannot isolate the problem to simple code that creates the problem. It seems to be associated with big program memory.

OK, this is with Linux Mint 20.2, Teensy 4.0 with only an audio board, using the common Arduino IDE 1.8.19 and Teensyduino 1.56. The program (PocketFT8_0) compiles without error. The loader then runs for a while and stops with red "Download ERROR." This leaves the USB type as "Bootloader (Teensy 4.0)" that requires an annoying reset of the T4. I obviously can't execute the T4 program, so the only error information is from the Loader. Here is the log:
Code:
16:24:38.995 (loader): remote connection 10 closed
16:24:40.705 (post_compile 53): Begin, version=1.56
16:24:40.705 (loader): remote connection 10 opened
16:24:40.705 (post_compile 53): Sending command: comment: Teensyduino 1.56 - LINUX64 (teensy_post_compile)
16:24:40.705 (loader): remote cmd from 10: "comment: Teensyduino 1.56 - LINUX64 (teensy_post_compile)"
16:24:40.705 (loader): remote cmd from 10: "status"
16:24:40.705 (loader): file changed
16:24:40.730 (loader): File "/tmp/arduino_build_353806/PocketFT8_0.ino.hex", 154624 bytes
16:24:40.730 (loader): File "PocketFT8_0.ino.hex". 154624 bytes
16:24:40.731 (post_compile 53): Status: 1, 1, 0, 10, 3, 0, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:40.731 (post_compile 53): Disconnect
16:24:40.741 (loader): remote connection 10 closed
16:24:40.954 (post_compile 54): Begin, version=1.56
16:24:40.955 (loader): remote connection 10 opened
16:24:40.955 (post_compile 54): Sending command: comment: Teensyduino 1.56 - LINUX64 (teensy_post_compile)
16:24:40.955 (loader): remote cmd from 10: "comment: Teensyduino 1.56 - LINUX64 (teensy_post_compile)"
16:24:40.955 (loader): remote cmd from 10: "status"
16:24:40.956 (post_compile 54): Status: 1, 1, 0, 10, 3, 0, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:40.956 (post_compile 54): Disconnect
16:24:40.966 (post_compile 55): Running teensy_reboot: /home/bob/Documents/arduino-1.8.19/hardware/teensy/../tools/teensy_reboot
16:24:40.966 (loader): remote connection 10 closed
16:24:40.966 (loader): remote connection 10 opened
16:24:40.966 (loader): remote connection 10 closed
16:24:40.966 (reboot 56): Begin, version=1.56
16:24:40.966 (reboot 56): location = /sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:40.966 (reboot 56): portlabel = /dev/bus/usb/003/058 Bootloader
16:24:40.966 (reboot 56): portprotocol = Teensy
16:24:40.966 (reboot 56): Only location /sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3 will be tried
16:24:40.984 (loader): remote connection 10 opened
16:24:40.985 (reboot 56): add device: subsys=usb, type=usb_device, location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:40.985 (reboot 56):   devnode=/dev/bus/usb/003/059, subsystem=usb, ifacenum=-1
16:24:40.985 (reboot 56): add child:  subsys=usb, type=usb_interface, location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.0
16:24:40.985 (reboot 56):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:40.985 (reboot 56):   model=36 (Teensy 4.0)
16:24:40.985 (reboot 56): add child:  subsys=hid, type=(null), location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.0/0003:16C0:0486.0025
16:24:40.985 (reboot 56):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:40.985 (reboot 56): add child:  subsys=hidraw, type=(null), location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.0/0003:16C0:0486.0025/hidraw/hidraw0
16:24:40.985 (reboot 56):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:40.985 (reboot 56): add child:  subsys=usb, type=usb_interface, location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.1
16:24:40.985 (reboot 56):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:40.985 (reboot 56): add child:  subsys=hid, type=(null), location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.1/0003:16C0:0486.0026
16:24:40.985 (reboot 56):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:40.986 (reboot 56): add child:  subsys=hidraw, type=(null), location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.1/0003:16C0:0486.0026/hidraw/hidraw1
16:24:40.986 (reboot 56):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:40.986 (reboot 56):   devnode=/dev/hidraw1, subsystem=hidraw, ifacenum=1
16:24:41.002 (reboot 56): usb scan found 1 devices
16:24:41.002 (reboot 56): found Teensy Loader, version 1.56
16:24:41.002 (reboot 56): Sending command: show:arduino_attempt_reboot
16:24:41.027 (loader): remote cmd from 10: "show:arduino_attempt_reboot"
16:24:41.027 (loader): got request to show arduino rebooting message
16:24:41.029 (reboot 56): Sending command: comment: Teensyduino 1.56 - LINUX64 (teensy_reboot)
16:24:41.030 (loader): remote cmd from 10: "comment: Teensyduino 1.56 - LINUX64 (teensy_reboot)"
16:24:41.030 (loader): remote cmd from 10: "status"
16:24:41.030 (reboot 56): Status: 1, 1, 0, 10, 3, 0, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:41.087 (reboot 56): hid_send_feature, opened /dev/hidraw1
16:24:41.088 (loader): remote cmd from 10: "status"
16:24:41.088 (reboot 56): Status: 1, 1, 0, 10, 3, 0, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:41.088 (reboot 56): status read, retry 0
16:24:41.189 (loader): remote cmd from 10: "status"
16:24:41.189 (reboot 56): Status: 1, 1, 0, 10, 3, 0, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:41.189 (reboot 56): status read, retry 1
16:24:41.272 (ports 16): del child: location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.0/0003:16C0:0486.0025/hidraw/hidraw0
16:24:41.273 (ports 16): del child: location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.1/0003:16C0:0486.0026/hidraw/hidraw1
16:24:41.273 (ports 16):   devnode=/dev/bus/usb/003/059, subsystem=usb, ifacenum=-1
16:24:41.274 (ports 16): unknown action: unbind
16:24:41.276 (ports 16): unknown action: unbind
16:24:41.278 (ports 16): del child: location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.0/0003:16C0:0486.0025
16:24:41.279 (ports 16): del child: location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.1/0003:16C0:0486.0026
16:24:41.281 (ports 16): unknown action: unbind
16:24:41.281 (ports 16): unknown action: unbind
16:24:41.282 (ports 16): del child: location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.0
16:24:41.282 (ports 16): del child: location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.1
16:24:41.284 (ports 16): unknown action: unbind
16:24:41.286 (ports 16): del device: location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:41.289 (loader): remote cmd from 10: "status"
16:24:41.289 (loader): action remove: /dev/hidraw0
16:24:41.289 (loader): USB remove /dev/hidraw0
16:24:41.289 (loader): action remove: /dev/hidraw1
16:24:41.289 (loader): USB remove /dev/hidraw1
16:24:41.289 (reboot 56): Status: 1, 1, 0, 10, 3, 0, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:41.289 (reboot 56): status read, retry 2
16:24:41.390 (loader): remote cmd from 10: "status"
16:24:41.390 (reboot 56): Status: 1, 1, 0, 10, 3, 0, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:41.390 (reboot 56): status read, retry 3
16:24:41.490 (loader): remote cmd from 10: "status"
16:24:41.491 (reboot 56): Status: 1, 1, 0, 10, 3, 0, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:41.491 (reboot 56): status read, retry 4
16:24:41.591 (loader): remote cmd from 10: "status"
16:24:41.592 (reboot 56): Status: 1, 1, 0, 10, 3, 0, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:41.592 (reboot 56): status read, retry 5
16:24:41.604 (ports 16): add device: subsys=usb, type=usb_device, location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:41.604 (ports 16):   devnode=/dev/bus/usb/003/060, subsystem=usb, ifacenum=-1
16:24:41.604 (ports 16): usb_add: /dev/bus/usb/003/060 (Teensy 4.0) Bootloader
16:24:41.688 (loader): action add: /dev/hidraw0
16:24:41.689 (loader): USB add /dev/hidraw0, vid=16C0, pid=0478, ver=0107, serial=00097D96, location=usb3/3-1/3-1.3/
16:24:41.747 (loader): read feature report
16:24:41.747 (loader): opening /dev/hidraw0, usage: 0024: Teensy 4.0 (IMXRT1062)
16:24:41.747 (loader): secure mode can not be locked: this is Standard Teensy
16:24:41.747 (loader): encryption is possible on this Teensy, but not yet configured
16:24:41.747 (loader): but without secure mode locked, encryption will NOT be secure!
16:24:41.747 (loader): Device came online, code_size = 2031616
16:24:41.747 (loader): Board is: Teensy 4.0 (IMXRT1062), version 1.07
16:24:41.775 (loader): File "/tmp/arduino_build_353806/PocketFT8_0.ino.hex", 154624 bytes
16:24:41.775 (loader): File "PocketFT8_0.ino.hex". 154624 bytes, 8% used
16:24:41.812 (loader): set background IMG_ONLINE
16:24:41.833 (loader): File "/tmp/arduino_build_353806/PocketFT8_0.ino.hex", 154624 bytes
16:24:41.833 (loader): File "PocketFT8_0.ino.hex". 154624 bytes, 8% used
16:24:41.871 (loader): elf appears to be for Teensy 4.0 (IMXRT1062) (2031616 bytes)
16:24:41.871 (loader): elf binary data matches hex file
16:24:41.871 (loader): elf file is for Teensy 4.0 (IMXRT1062)
16:24:41.871 (loader): using hex file
16:24:41.907 (loader): begin operation
16:24:41.920 (loader): remote cmd from 10: "status"
16:24:41.920 (reboot 56): Status: 1, 1, 1, 11, 3, 1, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:41.920 (loader): flash, block=0, bs=1024, auto=1
16:24:41.920 (loader): flash, block=1, bs=1024, auto=1
16:24:41.920 (loader): flash, block=2, bs=1024, auto=1
16:24:42.351 (loader): remote cmd from 10: "status"
16:24:42.352 (reboot 56): Status: 1, 1, 1, 11, 3, 1, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:42.352 (loader): flash, block=3, bs=1024, auto=1
16:24:42.352 (loader): flash, block=4, bs=1024, auto=1
16:24:42.353 (loader): flash, block=5, bs=1024, auto=1
16:24:42.354 (loader): flash, block=6, bs=1024, auto=1
16:24:42.355 (loader): flash, block=7, bs=1024, auto=1
16:24:42.356 (loader): flash, block=8, bs=1024, auto=1
16:24:42.357 (loader): flash, block=9, bs=1024, auto=1
16:24:42.373 (loader): flash, block=10, bs=1024, auto=1
16:24:42.374 (loader): flash, block=11, bs=1024, auto=1
16:24:42.389 (loader): flash, block=12, bs=1024, auto=1
16:24:42.390 (loader): flash, block=13, bs=1024, auto=1
16:24:42.405 (loader): remote cmd from 10: "status"
16:24:42.405 (loader): flash, block=14, bs=1024, auto=1
16:24:42.405 (reboot 56): Status: 1, 1, 1, 11, 3, 1, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:42.406 (loader): flash, block=15, bs=1024, auto=1
16:24:42.421 (loader): flash, block=16, bs=1024, auto=1
16:24:42.422 (loader): flash, block=17, bs=1024, auto=1
16:24:42.437 (loader): flash, block=18, bs=1024, auto=1
16:24:42.438 (loader): flash, block=19, bs=1024, auto=1
16:24:42.454 (loader): flash, block=20, bs=1024, auto=1
16:24:42.454 (loader): flash, block=21, bs=1024, auto=1
16:24:42.470 (loader): remote cmd from 10: "status"
16:24:42.470 (loader): flash, block=22, bs=1024, auto=1
16:24:42.470 (reboot 56): Status: 1, 1, 1, 11, 3, 1, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:42.470 (loader): flash, block=23, bs=1024, auto=1
16:24:42.486 (loader): flash, block=24, bs=1024, auto=1
16:24:42.486 (loader): flash, block=25, bs=1024, auto=1
16:24:42.502 (loader): flash, block=26, bs=1024, auto=1
16:24:42.502 (loader): flash, block=27, bs=1024, auto=1
16:24:42.518 (loader): flash, block=28, bs=1024, auto=1
16:24:42.518 (loader): flash, block=29, bs=1024, auto=1
16:24:42.534 (loader): remote cmd from 10: "status"
16:24:42.534 (loader): flash, block=30, bs=1024, auto=1
16:24:42.534 (reboot 56): Status: 1, 1, 1, 11, 3, 1, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:42.535 (loader): flash, block=31, bs=1024, auto=1
16:24:42.550 (loader): flash, block=32, bs=1024, auto=1
16:24:42.551 (loader): flash, block=33, bs=1024, auto=1
16:24:42.566 (loader): flash, block=34, bs=1024, auto=1
16:24:42.567 (loader): flash, block=35, bs=1024, auto=1
16:24:42.582 (loader): flash, block=36, bs=1024, auto=1
16:24:42.583 (loader): flash, block=37, bs=1024, auto=1
16:24:42.599 (loader): remote cmd from 10: "status"
16:24:42.599 (loader): flash, block=38, bs=1024, auto=1
16:24:42.599 (reboot 56): Status: 1, 1, 1, 11, 3, 1, /tmp/arduino_build_353806/, PocketFT8_0.ino.hex
16:24:42.599 (loader): flash, block=39, bs=1024, auto=1
16:24:42.615 (loader): flash, block=40, bs=1024, auto=1
16:24:42.615 (loader): flash, block=41, bs=1024, auto=1
16:24:42.631 (loader): flash, block=42, bs=1024, auto=1
16:24:42.631 (loader): flash, block=43, bs=1024, auto=1
16:24:42.647 (loader): flash, block=44, bs=1024, auto=1
16:24:42.647 (loader): flash, block=45, bs=1024, auto=1
16:24:42.649 (reboot 56): status read, retry 6
16:24:42.649 (reboot 56): Success
16:24:42.649 (reboot 56): Disconnect
16:24:42.664 (loader): flash, block=46, bs=1024, auto=1
16:24:42.664 (loader): remote connection 10 closed
16:24:42.664 (loader): flash, block=47, bs=1024, auto=1
16:24:42.665 (serialmon 57): Begin, version=1.56
16:24:42.665 (serialmon 57): listening for location: /sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:42.680 (loader): flash, block=48, bs=1024, auto=1
16:24:42.680 (loader): remote connection 10 opened
16:24:42.681 (loader): flash, block=49, bs=1024, auto=1
16:24:42.682 (serialmon 57): add device: subsys=usb, type=usb_device, location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:42.682 (serialmon 57):   devnode=/dev/bus/usb/003/060, subsystem=usb, ifacenum=-1
16:24:42.682 (serialmon 57): add child:  subsys=usb, type=usb_interface, location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.0
16:24:42.682 (serialmon 57):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:42.682 (serialmon 57): add child:  subsys=hid, type=(null), location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.0/0003:16C0:0478.0027
16:24:42.682 (serialmon 57):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:42.682 (serialmon 57):   model=36 (Teensy 4.0)
16:24:42.682 (serialmon 57): add child:  subsys=hidraw, type=(null), location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3/3-1.3:1.0/0003:16C0:0478.0027/hidraw/hidraw0
16:24:42.682 (serialmon 57):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb3/3-1/3-1.3
16:24:42.697 (loader): flash, block=50, bs=1024, auto=1
16:24:42.697 (loader): flash, block=51, bs=1024, auto=1
16:24:42.713 (loader): flash, block=52, bs=1024, auto=1
16:24:42.713 (loader): flash, block=53, bs=1024, auto=1
16:24:42.729 (loader): flash, block=54, bs=1024, auto=1
16:24:42.729 (loader): flash, block=55, bs=1024, auto=1
16:24:42.745 (loader): flash, block=56, bs=1024, auto=1
16:24:42.746 (loader): flash, block=57, bs=1024, auto=1
16:24:42.761 (loader): flash, block=58, bs=1024, auto=1
16:24:42.762 (loader): flash, block=59, bs=1024, auto=1
16:24:42.778 (loader): flash, block=60, bs=1024, auto=1
16:24:42.778 (loader): flash, block=61, bs=1024, auto=1
16:24:42.794 (loader): flash, block=62, bs=1024, auto=1
16:24:42.795 (loader): flash, block=63, bs=1024, auto=1
16:24:42.811 (loader): flash, block=64, bs=1024, auto=1
16:24:42.811 (loader): flash, block=65, bs=1024, auto=1
16:24:42.827 (loader): flash, block=66, bs=1024, auto=1
16:24:42.828 (loader): flash, block=67, bs=1024, auto=1
16:24:42.843 (loader): flash, block=68, bs=1024, auto=1
16:24:42.844 (loader): flash, block=69, bs=1024, auto=1
16:24:42.860 (loader): flash, block=70, bs=1024, auto=1
16:24:42.861 (loader): flash, block=71, bs=1024, auto=1
16:24:42.876 (loader): flash, block=72, bs=1024, auto=1
16:24:42.877 (loader): flash, block=73, bs=1024, auto=1
16:24:42.893 (loader): flash, block=74, bs=1024, auto=1
16:24:42.893 (loader): flash, block=75, bs=1024, auto=1
16:24:42.909 (loader): flash, block=76, bs=1024, auto=1
16:24:42.910 (loader): flash, block=77, bs=1024, auto=1
16:24:42.926 (loader): flash, block=78, bs=1024, auto=1
16:24:42.926 (loader): flash, block=79, bs=1024, auto=1
16:24:42.942 (loader): flash, block=80, bs=1024, auto=1
16:24:42.943 (loader): flash, block=81, bs=1024, auto=1
16:24:42.959 (loader): flash, block=82, bs=1024, auto=1
16:24:42.959 (loader): flash, block=83, bs=1024, auto=1
16:24:42.975 (loader): flash, block=84, bs=1024, auto=1
16:24:42.975 (loader): flash, block=85, bs=1024, auto=1
16:24:42.991 (loader): flash, block=86, bs=1024, auto=1
16:24:42.991 (loader): flash, block=87, bs=1024, auto=1
16:24:43.007 (loader): flash, block=88, bs=1024, auto=1
16:24:43.008 (loader): flash, block=89, bs=1024, auto=1
16:24:43.023 (loader): flash, block=90, bs=1024, auto=1
16:24:43.024 (loader): flash, block=91, bs=1024, auto=1
16:24:58.359 (loader): program: write error
16:24:58.359 (loader): end operation, total time = 16.453 seconds
16:24:58.360 (loader): set background IMG_DOWNLOAD_ERROR
16:24:58.362 (loader): redraw timer set, image 11 to show for 4000 ms
16:25:02.363 (loader): redraw, image 10
16:25:02.363 (loader): set background IMG_ONLINE
16:26:20.338 (loader): Verbose Info event

The question: What does "program: write error" mean?

BTW, I have seen this same problem for a while using other INO programs.

I searched for others with this same issue, thinking it must be around, but no success. Thanks, in advance, for the help!! Bob
 
I have a Loader problem that that results in a red "Download ERROR" error box. To start off, I regret that I cannot isolate the problem to simple code that creates the problem. It seems to be associated with big program memory.

OK, this is with Linux Mint 20.2, Teensy 4.0 with only an audio board, using the common Arduino IDE 1.8.19 and Teensyduino 1.56. The program (PocketFT8_0) compiles without error. The loader then runs for a while and stops with red "Download ERROR." This leaves the USB type as "Bootloader (Teensy 4.0)" that requires an annoying reset of the T4. I obviously can't execute the T4 program, so the only error information is from the Loader. Here is the

The question: What does "program: write error" mean?

BTW, I have seen this same problem for a while using other INO programs.

I searched for others with this same issue, thinking it must be around, but no success. Thanks, in advance, for the help!! Bob

Sounds and looks like the bootloader is unable to write to flash block 91 on that particular T4.0. If it always fails on the same flash block, that would be further confirmation of a bad flash. Do you have another T4.0 you can try?
 
Sounds and looks like the bootloader is unable to write to flash block 91 on that particular T4.0. If it always fails on the same flash block, that would be further confirmation of a bad flash. Do you have another T4.0 you can try?

I put in a different T4.0 and it has the same failure. But, interestingly, for either T4.0, the last block number (as "(loader): flash, block=91, bs=1024, auto=1") changes from try to try. I have seen 91, 121, 95, 115 and 117. Each new try involved the 15 second blink reset and a USB replug. It doesn't seem like bad Flash. Is there a separate Flash test?
 
I put in a different T4.0 and it has the same failure. But, interestingly, for either T4.0, the last block number (as "(loader): flash, block=91, bs=1024, auto=1") changes from try to try. I have seen 91, 121, 95, 115 and 117. Each new try involved the 15 second blink reset and a USB replug. It doesn't seem like bad Flash. Is there a separate Flash test?

Strange. Does a simple Blink program load okay? You haven’t said much about your sketch, so it might be something very odd there.
 
I use Blink as a check of general health. I have never seen any loading issues with Blink.

The program is the Pocket FT8 that I have gone through and removed hardware references in preparation to use it as library classes. Most likely the program won't run, as I have never been able to get it loaded to debug it. Note that it compiles with the current Arduino IDE, current Teensyduino but won't load. I imagine that the loader only sees the program as hex data and doesn't know the meaning of that data. If that is true, program bugs shouldn't stop the loader.

For completeness, tomorrow I will post the source files at janbob.com.
 
@Bob Larkin:
I made this arbitrarily large program to run from FLASH to test encrypted code running on T_4.x : github.com/Defragster/T4LockBeta/tree/main/Code4Code

If you grabbed a copy of that and it fails at the same spot it would seem to indicate bad flash. If that works, then perhaps there is some problem with the HEX for the code at hand that the loader is choking on.

The code takes some time to compile as the code wrote code to include as code when running as DUAL SERIAL. If run as normal single Serial, it won't run that code to 2nd Serial. The code written code is in one of the LARGE files [CodeMade.ino] that builds into the HEX.

If this uploads and runs, as it has for me some too many dozen times, then posting the code and HEX as created for the sketch there might show the same as the two T_4.0's there have shown.
 
I put in a different T4.0 and it has the same failure. But, interestingly, for either T4.0, the last block number (as "(loader): flash, block=91, bs=1024, auto=1") changes from try to try. I have seen 91, 121, 95, 115 and 117.

My guess is a flaky USB cable or hub between Teensy and your PC.

Marginal cables which work with Arduino boards and older Teensy models that run at only 12 Mbit/sec speed can have trouble with 480 Mbit/sec speed used by Teensy 4.

Especially this sort of cable can be problematic.

screenshot.jpg
 
Last edited:
An update. The USB cables that I have tried are both 1-m USB2, one by Trip-Lite and the other marked "Amazon Basics," that could be anything. Both behave the same.

What I did discover is that the problem seems to relate to my PC (a Lenovo S30 Think Station). When I moved to an assembled-from-pieces I7 PC, the problem seemed to go away. At least I could not get it to not load. For simplicity, this was only doing a load of a compiled HEX file, and this all needs more testing. Using the Lenovo with the HEX file produced consistent errors.

I have gotten as far as trying various Lenovo USB sockets: USB2 front, USB2 back, USB3 back, USB2 through 4x expander. All produced the error. I checked the USB voltage as 5.01 with less than a mV of ripple per the DVM.

I have an internal USB2 card that I can move over to the Lenovo that would use completely different hardware. I will try that this evening.

Question: Does any of this ring a bell as far as past problems for others?

Here is a good Loader Log:
Code:
10:39:00.504 (loader): File "/home/bob/Desktop/PocketFT8_0.ino.hex", 154624 bytes
10:39:00.504 (loader): File "PocketFT8_0.ino.hex". 154624 bytes
10:39:10.583 (ports 5): del child: location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10:1.0/tty/ttyACM0
10:39:10.583 (ports 5):   devnode=/dev/bus/usb/003/097, subsystem=usb, ifacenum=-1
10:39:10.584 (ports 5): unknown action: unbind
10:39:10.585 (ports 5): unknown action: unbind
10:39:10.586 (ports 5): del child: location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10:1.1
10:39:10.587 (ports 5): del child: location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10:1.0
10:39:10.589 (ports 5): unknown action: unbind
10:39:10.590 (ports 5): del device: location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10
10:39:11.293 (ports 5): add device: subsys=usb, type=usb_device, location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10
10:39:11.294 (ports 5):   devnode=/dev/bus/usb/003/098, subsystem=usb, ifacenum=-1
10:39:11.294 (ports 5): usb_add: /dev/bus/usb/003/098 (Teensy 4.0) Bootloader
10:39:11.296 (ports 5): add child:  subsys=usb, type=usb_interface, location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10:1.0
10:39:11.296 (ports 5):   parent location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10
10:39:11.296 (ports 5): usb_add: /dev/bus/usb/003/098 (Teensy 4.0) Bootloader
10:39:11.299 (ports 5): add child:  subsys=hid, type=(null), location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10:1.0/0003:16C0:0478.0010
10:39:11.299 (ports 5):   parent location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10
10:39:11.299 (ports 5):   model=36 (Teensy 4.0)
10:39:11.299 (ports 5): usb_add: /dev/bus/usb/003/098 (Teensy 4.0) Bootloader
10:39:11.301 (ports 5): add child:  subsys=hidraw, type=(null), location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10:1.0/0003:16C0:0478.0010/hidraw/hidraw1
10:39:11.301 (ports 5):   parent location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10
10:39:11.301 (ports 5): usb_add: /dev/bus/usb/003/098 (Teensy 4.0) Bootloader
10:39:11.302 (ports 5): unknown action: bind
10:39:11.303 (ports 5): unknown action: bind
10:39:11.304 (ports 5): unknown action: bind
10:39:11.386 (loader): action add: /dev/hidraw1
10:39:11.387 (loader): USB add /dev/hidraw1, vid=16C0, pid=0478, ver=0107, serial=00097D96, location=usb3/3-10/
10:39:11.445 (loader): read feature report
10:39:11.445 (loader): opening /dev/hidraw1, usage: 0024: Teensy 4.0 (IMXRT1062)
10:39:11.445 (loader): secure mode can not be locked: this is Standard Teensy
10:39:11.445 (loader): encryption is possible on this Teensy, but not yet configured
10:39:11.445 (loader): but without secure mode locked, encryption will NOT be secure!
10:39:11.445 (loader): Device came online, code_size = 2031616
10:39:11.445 (loader): Board is: Teensy 4.0 (IMXRT1062), version 1.07
10:39:11.466 (loader): File "/home/bob/Desktop/PocketFT8_0.ino.hex", 154624 bytes
10:39:11.466 (loader): File "PocketFT8_0.ino.hex". 154624 bytes, 8% used
10:39:11.493 (loader): set background IMG_ONLINE
10:39:11.510 (loader): File "/home/bob/Desktop/PocketFT8_0.ino.hex", 154624 bytes
10:39:11.510 (loader): File "PocketFT8_0.ino.hex". 154624 bytes, 8% used
10:39:11.536 (loader): can't open file '/home/bob/Desktop/PocketFT8_0.ino.elf' (error 2: No such file or directory)
10:39:11.536 (loader): elf file is for Unknown Board
10:39:11.536 (loader): using hex file
10:39:11.562 (loader): begin operation
10:39:11.569 (loader): flash, block=0, bs=1024, auto=1
10:39:11.569 (loader): flash, block=1, bs=1024, auto=1
10:39:11.569 (loader): flash, block=2, bs=1024, auto=1
10:39:11.815 (loader): flash, block=3, bs=1024, auto=1
10:39:11.815 (loader): flash, block=4, bs=1024, auto=1
10:39:11.817 (loader): flash, block=5, bs=1024, auto=1
10:39:11.819 (loader): flash, block=6, bs=1024, auto=1
10:39:11.821 (loader): flash, block=7, bs=1024, auto=1
10:39:11.823 (loader): flash, block=8, bs=1024, auto=1
10:39:11.824 (loader): flash, block=9, bs=1024, auto=1
10:39:11.826 (loader): flash, block=10, bs=1024, auto=1
10:39:11.827 (loader): flash, block=11, bs=1024, auto=1
10:39:11.828 (loader): flash, block=12, bs=1024, auto=1
10:39:11.829 (loader): flash, block=13, bs=1024, auto=1
10:39:11.846 (loader): flash, block=14, bs=1024, auto=1
10:39:11.848 (loader): flash, block=15, bs=1024, auto=1
10:39:11.849 (loader): flash, block=16, bs=1024, auto=1
10:39:11.851 (loader): flash, block=17, bs=1024, auto=1
10:39:11.852 (loader): flash, block=18, bs=1024, auto=1
10:39:11.854 (loader): flash, block=19, bs=1024, auto=1
10:39:11.855 (loader): flash, block=20, bs=1024, auto=1
10:39:11.857 (loader): flash, block=21, bs=1024, auto=1
10:39:11.858 (loader): flash, block=22, bs=1024, auto=1
10:39:11.859 (loader): flash, block=23, bs=1024, auto=1
10:39:11.860 (loader): flash, block=24, bs=1024, auto=1
10:39:11.861 (loader): flash, block=25, bs=1024, auto=1
10:39:11.877 (loader): flash, block=26, bs=1024, auto=1
10:39:11.879 (loader): flash, block=27, bs=1024, auto=1
10:39:11.881 (loader): flash, block=28, bs=1024, auto=1
10:39:11.883 (loader): flash, block=29, bs=1024, auto=1
10:39:11.884 (loader): flash, block=30, bs=1024, auto=1
10:39:11.886 (loader): flash, block=31, bs=1024, auto=1
10:39:11.887 (loader): flash, block=32, bs=1024, auto=1
10:39:11.889 (loader): flash, block=33, bs=1024, auto=1
10:39:11.890 (loader): flash, block=34, bs=1024, auto=1
10:39:11.891 (loader): flash, block=35, bs=1024, auto=1
10:39:11.892 (loader): flash, block=36, bs=1024, auto=1
10:39:11.893 (loader): flash, block=37, bs=1024, auto=1
10:39:11.894 (loader): flash, block=38, bs=1024, auto=1
10:39:11.911 (loader): flash, block=39, bs=1024, auto=1
10:39:11.912 (loader): flash, block=40, bs=1024, auto=1
10:39:11.914 (loader): flash, block=41, bs=1024, auto=1
10:39:11.915 (loader): flash, block=42, bs=1024, auto=1
10:39:11.917 (loader): flash, block=43, bs=1024, auto=1
10:39:11.918 (loader): flash, block=44, bs=1024, auto=1
10:39:11.919 (loader): flash, block=45, bs=1024, auto=1
10:39:11.920 (loader): flash, block=46, bs=1024, auto=1
10:39:11.922 (loader): flash, block=47, bs=1024, auto=1
10:39:11.923 (loader): flash, block=48, bs=1024, auto=1
10:39:11.924 (loader): flash, block=49, bs=1024, auto=1
10:39:11.925 (loader): flash, block=50, bs=1024, auto=1
10:39:11.927 (loader): flash, block=51, bs=1024, auto=1
10:39:11.943 (loader): flash, block=52, bs=1024, auto=1
10:39:11.945 (loader): flash, block=53, bs=1024, auto=1
10:39:11.946 (loader): flash, block=54, bs=1024, auto=1
10:39:11.948 (loader): flash, block=55, bs=1024, auto=1
10:39:11.949 (loader): flash, block=56, bs=1024, auto=1
10:39:11.950 (loader): flash, block=57, bs=1024, auto=1
10:39:11.952 (loader): flash, block=58, bs=1024, auto=1
10:39:11.953 (loader): flash, block=59, bs=1024, auto=1
10:39:11.954 (loader): flash, block=60, bs=1024, auto=1
10:39:11.954 (loader): flash, block=61, bs=1024, auto=1
10:39:11.971 (loader): flash, block=62, bs=1024, auto=1
10:39:11.973 (loader): flash, block=63, bs=1024, auto=1
10:39:11.974 (loader): flash, block=64, bs=1024, auto=1
10:39:11.976 (loader): flash, block=65, bs=1024, auto=1
10:39:11.977 (loader): flash, block=66, bs=1024, auto=1
10:39:11.978 (loader): flash, block=67, bs=1024, auto=1
10:39:11.980 (loader): flash, block=68, bs=1024, auto=1
10:39:11.981 (loader): flash, block=69, bs=1024, auto=1
10:39:11.982 (loader): flash, block=70, bs=1024, auto=1
10:39:11.984 (loader): flash, block=71, bs=1024, auto=1
10:39:11.985 (loader): flash, block=72, bs=1024, auto=1
10:39:11.986 (loader): flash, block=73, bs=1024, auto=1
10:39:11.987 (loader): flash, block=74, bs=1024, auto=1
10:39:12.003 (loader): flash, block=75, bs=1024, auto=1
10:39:12.005 (loader): flash, block=76, bs=1024, auto=1
10:39:12.007 (loader): flash, block=77, bs=1024, auto=1
10:39:12.008 (loader): flash, block=78, bs=1024, auto=1
10:39:12.009 (loader): flash, block=79, bs=1024, auto=1
10:39:12.011 (loader): flash, block=80, bs=1024, auto=1
10:39:12.012 (loader): flash, block=81, bs=1024, auto=1
10:39:12.014 (loader): flash, block=82, bs=1024, auto=1
10:39:12.015 (loader): flash, block=83, bs=1024, auto=1
10:39:12.016 (loader): flash, block=84, bs=1024, auto=1
10:39:12.018 (loader): flash, block=85, bs=1024, auto=1
10:39:12.019 (loader): flash, block=86, bs=1024, auto=1
10:39:12.020 (loader): flash, block=87, bs=1024, auto=1
10:39:12.020 (loader): flash, block=88, bs=1024, auto=1
10:39:12.037 (loader): flash, block=89, bs=1024, auto=1
10:39:12.039 (loader): flash, block=90, bs=1024, auto=1
10:39:12.040 (loader): flash, block=91, bs=1024, auto=1
10:39:12.042 (loader): flash, block=92, bs=1024, auto=1
10:39:12.044 (loader): flash, block=93, bs=1024, auto=1
10:39:12.046 (loader): flash, block=94, bs=1024, auto=1
10:39:12.047 (loader): flash, block=95, bs=1024, auto=1
10:39:12.049 (loader): flash, block=96, bs=1024, auto=1
10:39:12.050 (loader): flash, block=97, bs=1024, auto=1
10:39:12.051 (loader): flash, block=98, bs=1024, auto=1
10:39:12.052 (loader): flash, block=99, bs=1024, auto=1
10:39:12.053 (loader): flash, block=100, bs=1024, auto=1
10:39:12.054 (loader): flash, block=101, bs=1024, auto=1
10:39:12.071 (loader): flash, block=102, bs=1024, auto=1
10:39:12.073 (loader): flash, block=103, bs=1024, auto=1
10:39:12.074 (loader): flash, block=104, bs=1024, auto=1
10:39:12.076 (loader): flash, block=105, bs=1024, auto=1
10:39:12.077 (loader): flash, block=106, bs=1024, auto=1
10:39:12.079 (loader): flash, block=107, bs=1024, auto=1
10:39:12.080 (loader): flash, block=108, bs=1024, auto=1
10:39:12.082 (loader): flash, block=109, bs=1024, auto=1
10:39:12.083 (loader): flash, block=110, bs=1024, auto=1
10:39:12.084 (loader): flash, block=111, bs=1024, auto=1
10:39:12.086 (loader): flash, block=112, bs=1024, auto=1
10:39:12.087 (loader): flash, block=113, bs=1024, auto=1
10:39:12.088 (loader): flash, block=114, bs=1024, auto=1
10:39:12.089 (loader): flash, block=115, bs=1024, auto=1
10:39:12.106 (loader): flash, block=116, bs=1024, auto=1
10:39:12.108 (loader): flash, block=117, bs=1024, auto=1
10:39:12.109 (loader): flash, block=118, bs=1024, auto=1
10:39:12.110 (loader): flash, block=119, bs=1024, auto=1
10:39:12.112 (loader): flash, block=120, bs=1024, auto=1
10:39:12.113 (loader): flash, block=121, bs=1024, auto=1
10:39:12.114 (loader): flash, block=122, bs=1024, auto=1
10:39:12.115 (loader): flash, block=123, bs=1024, auto=1
10:39:12.117 (loader): flash, block=124, bs=1024, auto=1
10:39:12.118 (loader): flash, block=125, bs=1024, auto=1
10:39:12.119 (loader): flash, block=126, bs=1024, auto=1
10:39:12.120 (loader): flash, block=127, bs=1024, auto=1
10:39:12.137 (loader): flash, block=128, bs=1024, auto=1
10:39:12.139 (loader): flash, block=129, bs=1024, auto=1
10:39:12.141 (loader): flash, block=130, bs=1024, auto=1
10:39:12.143 (loader): flash, block=131, bs=1024, auto=1
10:39:12.144 (loader): flash, block=132, bs=1024, auto=1
10:39:12.146 (loader): flash, block=133, bs=1024, auto=1
10:39:12.147 (loader): flash, block=134, bs=1024, auto=1
10:39:12.148 (loader): flash, block=135, bs=1024, auto=1
10:39:12.149 (loader): flash, block=136, bs=1024, auto=1
10:39:12.150 (loader): flash, block=137, bs=1024, auto=1
10:39:12.167 (loader): flash, block=138, bs=1024, auto=1
10:39:12.168 (loader): flash, block=139, bs=1024, auto=1
10:39:12.170 (loader): flash, block=140, bs=1024, auto=1
10:39:12.172 (loader): flash, block=141, bs=1024, auto=1
10:39:12.173 (loader): flash, block=142, bs=1024, auto=1
10:39:12.175 (loader): flash, block=143, bs=1024, auto=1
10:39:12.176 (loader): flash, block=144, bs=1024, auto=1
10:39:12.178 (loader): flash, block=145, bs=1024, auto=1
10:39:12.179 (loader): flash, block=146, bs=1024, auto=1
10:39:12.180 (loader): flash, block=147, bs=1024, auto=1
10:39:12.181 (loader): flash, block=148, bs=1024, auto=1
10:39:12.197 (loader): flash, block=149, bs=1024, auto=1
10:39:12.199 (loader): flash, block=150, bs=1024, auto=1
10:39:12.208 (loader): sending reboot
10:39:12.209 (loader): begin wait_until_offline
10:39:12.211 (ports 5): del child: location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10:1.0/0003:16C0:0478.0010/hidraw/hidraw1
10:39:12.211 (ports 5): unknown action: unbind
10:39:12.212 (ports 5): del child: location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10:1.0/0003:16C0:0478.0010
10:39:12.212 (ports 5): unknown action: unbind
10:39:12.213 (ports 5): del child: location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10:1.0
10:39:12.213 (ports 5): unknown action: unbind
10:39:12.214 (ports 5): del device: location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10
10:39:12.259 (loader): action remove: /dev/hidraw1
10:39:12.259 (loader): USB remove /dev/hidraw1
10:39:12.259 (loader): HID/linux: device is disconnected(2)
10:39:12.259 (loader): offline, waited 1
10:39:12.259 (loader): end operation, total time = 0.697 seconds
10:39:12.259 (loader): set background IMG_REBOOT_OK
10:39:12.260 (loader): redraw timer set, image 14 to show for 1200 ms
10:39:12.779 (ports 5): add device: subsys=usb, type=usb_device, location=/sys/devices/pci0000:00/0000:00:14.0/usb3/3-10
10:39:12.779 (ports 5):   devnode=/dev/bus/usb/003/099, subsystem=usb, ifacenum=-1
10:39:12.779 (ports 5): usb_add: /dev/bus/usb/003/099 (Teensy 4.0) RawHID
10:39:12.822 (loader): action add: /dev/hidraw1
10:39:12.822 (loader): action add: /dev/hidraw2
10:39:13.461 (loader): redraw, image 9
10:39:20.314 (loader): Verbose Info event

Oh, a second question: The only reliable full reset from these errors seems to be the annoying 15-second button-push Blink load followed by unplugging/re-plugging the T4. Is there an easier way?

Also, I don't plan to post any files as the problem seems related to PC hardware. If anybody wants to play with either the hex, or the source, let me know and I will get them to you.
 
Another Update: I borrowed a "StarTech 2-Port PCIe USB3.0 " card and put it in the Lenovo. Presto, PROBLEM SOLVED. The Loader not only loads without errors, consistently, but it is much faster. I could not make this happen with the multitude of built-in USB ports.

My problem is solved and I can get back to useful stuff, but WHY is this working as it is? If nobody else has this issue, I suppose it is not important. If somebody else does, here is a starting spot.. A reminder, I have seen this issue off and on for a long time so it is not just one INO.

@defragster, I will compile and load your large-size example as an additional test.

And thanks to all for the ideas. This really helps. Bob
 
Hard to say, I know my 10 year old dell, had USB adapter with .9.. standard. Which gave me headaches. Replaced with newer usb board and things improved
 
Report on Code4Code. Using the USB on the new plug-in card, compile and load were without error. End of loader log:
Code:
18:05:57.825 (loader): flash, block=1296, bs=1024, auto=1
18:05:57.828 (loader): flash, block=1297, bs=1024, auto=1
18:05:57.831 (loader): flash, block=1298, bs=1024, auto=1
18:05:57.833 (loader): flash, block=1299, bs=1024, auto=1
18:05:57.836 (loader): flash, block=1300, bs=1024, auto=1
18:05:57.841 (loader): sending reboot
18:05:57.844 (loader): begin wait_until_offline
18:05:57.846 (serialmon 35): del child: location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1/3-1:1.0/0003:16C0:0478.0015/hidraw/hidraw0
18:05:57.846 (ports 5): del child: location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1/3-1:1.0/0003:16C0:0478.0015/hidraw/hidraw0
18:05:57.847 (ports 5): unknown action: unbind
18:05:57.847 (serialmon 35): unknown action: unbind
18:05:57.848 (ports 5): del child: location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1/3-1:1.0/0003:16C0:0478.0015
18:05:57.848 (serialmon 35): del child: location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1/3-1:1.0/0003:16C0:0478.0015
18:05:57.850 (ports 5): unknown action: unbind
18:05:57.850 (serialmon 35): unknown action: unbind
18:05:57.851 (serialmon 35): del child: location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1/3-1:1.0
18:05:57.851 (ports 5): del child: location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1/3-1:1.0
18:05:57.853 (ports 5): unknown action: unbind
18:05:57.853 (serialmon 35): unknown action: unbind
18:05:57.854 (ports 5): del device: location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1
18:05:57.854 (serialmon 35): del device: location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1
18:05:57.894 (loader): action remove: /dev/hidraw0
18:05:57.894 (loader): USB remove /dev/hidraw0
18:05:57.894 (loader): HID/linux: device is disconnected(2)
18:05:57.894 (loader): offline, waited 1
18:05:57.894 (loader): end operation, total time = 5.080 seconds
18:05:57.894 (loader): set background IMG_REBOOT_OK
18:05:57.895 (loader): redraw timer set, image 14 to show for 1200 ms
18:05:58.439 (ports 5): add device: subsys=usb, type=usb_device, location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1
18:05:58.439 (ports 5):   devnode=/dev/bus/usb/003/016, subsystem=usb, ifacenum=-1
18:05:58.439 (ports 5): usb_add: /dev/bus/usb/003/016 (Teensy 4.0) Serial
18:05:58.439 (serialmon 35): add device: subsys=usb, type=usb_device, location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1
18:05:58.439 (serialmon 35):   devnode=/dev/bus/usb/003/016, subsystem=usb, ifacenum=-1
18:05:58.442 (serialmon 35): add child:  subsys=usb, type=usb_interface, location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1/3-1:1.0
18:05:58.442 (serialmon 35):   parent location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1
18:05:58.442 (serialmon 35):   model=36 (Teensy 4.0)
18:05:58.443 (serialmon 35): add child:  subsys=usb, type=usb_interface, location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1/3-1:1.1
18:05:58.443 (serialmon 35):   parent location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1
18:05:58.446 (serialmon 35): unknown action: bind
18:05:58.477 (serialmon 35): add child:  subsys=tty, type=(null), location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1/3-1:1.0/tty/ttyACM0
18:05:58.477 (serialmon 35):   parent location=/sys/devices/pci0000:00/0000:00:1c.0/0000:06:00.0/usb3/3-1
18:05:58.478 (serialmon 35):   devnode=/dev/ttyACM0, subsystem=tty, ifacenum=0
18:05:58.478 (serialmon 35): open serial /dev/ttyACM0
18:05:59.097 (loader): redraw, image 9
18:06:08.526 (loader): Verbose Info event

Going back to using the built-in USB port, the Loader had a write error after 94 blocks. About like the other program.

In thinking about it, this likely is not a Teensy problem at all, but rather a Linux Driver/Lenovo problem. Beyond me!!

Again, thanks to all.
 
Update and Further Solution -
I have been using another Linux PC and the old problem was back. That is, large size, more than about 80K or 90K Hex bytes, will bomb out and the loader hangs. This is with T4.0.

Without going to other USB hardware in the Lenovo S30, I played with teensy_loader_cli.c. The first observation was that this was using libusb-0.1, so I removed that library and compiled/installed the libusb-compat-0.1compatibility layer that allows libusb-1.0 to work with 0.1 function calls. This did not solve the problem.

Thinking that there might be some timing issue, I modified main() of teensy_loader_cli.c adding a delay of 10 milliseconds after each block of 1024 bytes. Presto, everything now is fine with loading! The output of that loader is now
Code:
bob@bob-lenovo:~/Documents/ArduinoTeensyCLI$ ./teensy_loader_cli --mcu=TEENSY40 -r -v /tmp/arduino_build_528665/FT8Receive.ino.hex
Teensy Loader, Command Line, Version 2.2
Read "/tmp/arduino_build_528665/FT8Receive.ino.hex": 192512 bytes, 9.5% usage
Found HalfKay Bootloader
Programming.........................................................................................................................................................................................End Hex Load
Booting
Before it would print 82 or so periods and stop with the Teensy needing the 15-second reset.

Paul, might there be a path to getting such a delay added to the regular Teensy loader? I have not tried to minimize the delay time, as it is not an issue for me. If I can do experiments to establish this as a useful solution I should be happy to. But, I can also just use the teensy_loader_cli.c.

Bob
 
I'll try to do something with an upcoming beta. Hopefully you can keep that problematic Lenovo S30 around for testing? Since I have no way to reproduce the problem here, I'm going to be depending on you for feedback with testing betas.
 
That sounds fine. I will keep the 2 that have the problem, and also try to better define bounds of the problem, as that looks to be a useful effort.
 
Update info. The Linux loading failure problem is not solved by a delay of 1 millisecond per 1024 bytes. It is solved by 1.5 millisecond or more. I am currently using 2.5 milliseconds which is barely observable over no delay.

I had been running from a USB3 port on the PC. I switched to a USB2 and, in general, it fails also. But, not always. There has always been some randomness, perhaps associated with other USB activity. My only other USB connections are a keyboard and mouse.

If it is useful to anybody, here is my current load script:
Code:
#!/bin/bash
cd /tmp || return
echo -n "Get Hex File: "
hexFile="$(find arduino_build_??????/*.ino.hex)"
echo "Loading Hex File ":"$hexFile"
cmd1="./teensy_loader_cli --mcu=TEENSY40 -w -s -v /tmp/${hexFile}"
cd ~/Documents/ArduinoTeensyCLI
eval $cmd1
Be sure to have a current compile in place or the hex file will be missing. It is pretty obvious from the terminal output when this occurs, but there is no error checking. This script works with the compiles from the Arduino IDE.
 
Good News! Loading looks good with Teensyduino 1.58 Beta #3.

I used the USB3 port that has always failed loading of large hex files. I used Arduino 2.0.3 with TD1.57 along with a large hex file. Sure enough, it failed every time I tried, always in the same way, as in the past:11:13:56.024 (loader): flash, block=81, bs=1024, auto=1
Code:
11:13:56.024 (loader): flash, block=82, bs=1024, auto=1
11:13:56.040 (loader): flash, block=83, bs=1024, auto=1
11:13:56.041 (loader): flash, block=84, bs=1024, auto=1
11:14:11.511 (loader): program: write error
11:14:11.512 (loader): end operation, total time = 16.707 seconds
11:14:11.512 (loader): set background IMG_DOWNLOAD_ERROR
11:14:11.514 (loader): redraw timer set, image 11 to show for 4000 ms
11:14:15.515 (loader): redraw, image 10
11:14:15.515 (loader): set background IMG_ONLINE
11:14:21.233 (loader): Verbose Info event

Next I made one change, going to TD0.58.3:
Code:
Downloading packages
teensy:teensy-tools@0.58.3
teensy:teensy-compile@11.3.1-beta2
teensy:teensy-discovery@1.57.2
teensy:teensy-monitor@1.57.2
teensy:avr@0.58.3
Installing teensy:teensy-tools@0.58.3
teensy:teensy-tools@0.58.3 installed
Installing teensy:teensy-compile@11.3.1-beta2
teensy:teensy-compile@11.3.1-beta2 installed
Installing teensy:teensy-discovery@1.57.2
teensy:teensy-discovery@1.57.2 installed
Installing teensy:teensy-monitor@1.57.2
teensy:teensy-monitor@1.57.2 installed
Replacing platform teensy:avr@1.57.1 with teensy:avr@0.58.3
Uninstalling teensy:avr@1.57.1
Platform teensy:avr@1.57.1 uninstalled
Uninstalling teensy:teensy-compile@5.4.1, tool is no more required
Tool teensy:teensy-compile@5.4.1 uninstalled
Uninstalling teensy:teensy-tools@1.57.1, tool is no more required
Tool teensy:teensy-tools@1.57.1 uninstalled
Uninstalling teensy:teensy-discovery@1.57.2, tool is no more required
Uninstalling teensy:teensy-monitor@1.57.2, tool is no more required
Configuring platform.
Platform teensy:avr@0.58.3 installed

After that, I was able to load the program 8 or 10 times, different situations like powering off, with zero failures:
Code:
12:39:06.730 (post_compile 24): Begin, version=1.58-beta3
12:39:06.731 (loader): remote connection 12 opened
12:39:06.731 (post_compile 24): ARDUINO_USER_AGENT = "arduino-cli/0.29.0 arduino-ide/2.0.3 grpc-node-js/1.6.8"
12:39:06.731 (post_compile 24): Sending command: comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_post_compile)
12:39:06.731 (loader): remote cmd from 12: "comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_post_compile)"
12:39:06.732 (loader): remote cmd from 12: "status"
12:39:06.732 (loader): file changed
12:39:06.767 (loader): File "/tmp/arduino-sketch-245DB50C4DE65D048262E93EAA8A7FA0/FT8Receive.ino.hex", 198656 bytes
12:39:06.767 (loader): File "FT8Receive.ino.hex". 198656 bytes, 10% used
12:39:06.800 (post_compile 24): Status: 1, 0, 1, 4, 2, 0, /tmp/arduino-sketch-245DB50C4DE65D048262E93EAA8A7FA0/, FT8Receive.ino.hex
12:39:06.800 (post_compile 24): Disconnect
12:39:06.810 (loader): remote connection 12 closed
12:39:07.815 (post_compile 25): Begin, version=1.58-beta3
12:39:07.816 (loader): remote connection 12 opened
12:39:07.816 (post_compile 25): ARDUINO_USER_AGENT = "arduino-cli/0.29.0 arduino-ide/2.0.3 grpc-node-js/1.6.8"
12:39:07.816 (post_compile 25): port = "usb5/5-1/5-1.1"
12:39:07.816 (post_compile 25): Sending command: comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_post_compile)
12:39:07.820 (loader): remote cmd from 12: "comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_post_compile)"
12:39:07.821 (loader): remote cmd from 12: "status"
12:39:07.822 (post_compile 25): Status: 1, 0, 1, 4, 2, 0, /tmp/arduino-sketch-245DB50C4DE65D048262E93EAA8A7FA0/, FT8Receive.ino.hex
12:39:07.822 (post_compile 25): Disconnect
12:39:07.832 (post_compile 26): Running teensy_reboot: /home/bob/.arduino15/packages/teensy/tools/teensy-tools/0.58.3/teensy_reboot
12:39:07.973 (loader): remote connection 12 opened
12:39:07.973 (loader): remote connection 12 closed
12:39:07.973 (loader): remote connection 12 closed
12:39:07.974 (reboot 27): Begin, version=1.58-beta3
12:39:07.974 (reboot 27): location = usb5/5-1/5-1.1
12:39:07.974 (reboot 27): portlabel = {serial.port.label}
12:39:07.974 (reboot 27): portprotocol = {serial.port.protocol}
12:39:08.096 (loader): remote connection 12 opened
12:39:08.097 (reboot 27): add device: subsys=usb, type=usb_device, location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.1
12:39:08.097 (reboot 27):   devnode=/dev/bus/usb/005/029, subsystem=usb, ifacenum=-1
12:39:08.097 (reboot 27): add child:  subsys=usb, type=usb_interface, location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.1/5-1.1:1.0
12:39:08.097 (reboot 27):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.1
12:39:08.097 (reboot 27): add child:  subsys=hid, type=(null), location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.1/5-1.1:1.0/0003:16C0:0478.000C
12:39:08.097 (reboot 27):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.1
12:39:08.097 (reboot 27):   model=36 (Teensy 4.0)
12:39:08.098 (reboot 27): add child:  subsys=hidraw, type=(null), location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.1/5-1.1:1.0/0003:16C0:0478.000C/hidraw/hidraw6
12:39:08.098 (reboot 27):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.1
12:39:08.113 (reboot 27): usb scan found 1 devices
12:39:08.113 (reboot 27): found Teensy Loader, version 1.57
12:39:08.113 (reboot 27): Sending command: show:arduino_attempt_reboot
12:39:08.231 (loader): remote cmd from 12: "show:arduino_attempt_reboot"
12:39:08.231 (loader): got request to show arduino rebooting message
12:39:08.232 (reboot 27): Sending command: comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_reboot)
12:39:08.232 (loader): remote cmd from 12: "comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_reboot)"
12:39:08.233 (loader): remote cmd from 12: "status"
12:39:08.233 (reboot 27): Status: 1, 0, 1, 4, 2, 0, /tmp/arduino-sketch-245DB50C4DE65D048262E93EAA8A7FA0/, FT8Receive.ino.hex
12:39:08.233 (reboot 27): send: auto:on
12:39:08.233 (reboot 27): Sending command: auto:on
12:39:08.233 (loader): remote cmd from 12: "auto:on"
12:39:08.233 (reboot 27): Disconnect
12:39:08.261 (loader): File "/tmp/arduino-sketch-245DB50C4DE65D048262E93EAA8A7FA0/FT8Receive.ino.hex", 198656 bytes
12:39:08.261 (loader): File "FT8Receive.ino.hex". 198656 bytes, 10% used
12:39:08.295 (loader): elf appears to be for Teensy 4.0 (IMXRT1062) (2031616 bytes)
12:39:08.295 (loader): elf binary data matches hex file
12:39:08.295 (loader): elf file is for Teensy 4.0 (IMXRT1062)
12:39:08.295 (loader): using hex file
12:39:08.328 (loader): begin operation
12:39:08.333 (loader): flash, block=0, bs=1024, auto=1
12:39:23.575 (loader): program: write error
12:39:23.576 (loader): end operation, total time = 15.248 seconds
12:39:23.576 (loader): set background IMG_DOWNLOAD_ERROR
12:39:23.579 (loader): redraw timer set, image 11 to show for 4000 ms
12:39:23.610 (loader): remote connection 12 closed
12:39:27.580 (loader): redraw, image 10
12:39:27.581 (loader): set background IMG_ONLINE

I will check further, but it looks like you tagged it. Thanks for fixing things. Bob
 
I spoke too soon. I have loading problems that come and go with the mood of Linux USB. I am trying to isolate the situations that cause this. More later.

But, does anyone know where the hex load file, xxxx.ino.hex is under Arduino 2.0.3? Post #17 above needs it!
 
Depends on how you build...

But as I showed in the thread/post about arduino-cli: https://forum.pjrc.com/threads/5354...nsy-Supported!?p=185984&viewfull=1#post185984

Headless uploads, for example to Raspberry PI over SSH. I am ussing KiTTy (derived from PuTTy)
If you actually running on the RPI using a monitor, keyboard, mouse, you can use all of the same as above.

Currently when building for Teensy boards, headless uploads are not fully supported yet. That is the upload will try to launch the GUI teensy app.

So currently I am using teensly_loader_cli, or may also try TyTools.

To make it easier I thought I would use the --export-binaries
Code:
kurte@kurte-rpi4:~/github/mtp_tft_picture_view$ arduino-cli compile -b teensy:avr:teensyMM:usb=serialmtp --export-binaries
/home/kurte/github/mtp_tft_picture_view/mtp_tft_picture_view.ino:211:17: note: '#pragma message: Display: ST7735_t3 or ST7789_t3'
  211 | #pragma message "Display: ST7735_t3 or ST7789_t3"
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Memory Usage on Teensy MicroMod:
  FLASH: code:171352, data:36368, headers:8340   free for files:16299012
   RAM1: variables:106784, code:167544, padding:29064   free for local variables:220896
   RAM2: variables:28800  free for malloc/new:495488

Used library Version Path
SPI          1.0     /home/kurte/.arduino15/packages/teensy/hardware/avr/0.58.3/libraries/SPI
SD           2.0.0   /home/kurte/.arduino15/packages/teensy/hardware/avr/0.58.3/libraries/SD
SdFat        2.1.2   /home/kurte/.arduino15/packages/teensy/hardware/avr/0.58.3/libraries/SdFat
MTP_Teensy   1.0.0   /home/kurte/github/mtp_teensy
JPEGDEC      1.2.8   /home/kurte/Arduino/libraries/JPEGDEC
PNGdec       1.0.1   /home/kurte/Arduino/libraries/PNGdec
ST7735_t3    1.0.0   /home/kurte/.arduino15/packages/teensy/hardware/avr/0.58.3/libraries/ST7735_t3

Used platform Version Path
teensy:avr    0.58.3  /home/kurte/.arduino15/packages/teensy/hardware/avr/0.58.3

[COLOR="#FF0000"]kurte@kurte-rpi4:~/github/mtp_tft_picture_view$ ls build/teensy.avr.teensyMM/
mtp_tft_picture_view.ino.eep   mtp_tft_picture_view.ino.elf  mtp_tft_picture_view.ino.lst
mtp_tft_picture_view.ino.ehex  mtp_tft_picture_view.ino.hex  mtp_tft_picture_view.ino.sym[/COLOR]
As you can see it saves the output files into sub-directory build and subdirectory based off of the main FQBN string.
 
But, does anyone know where the hex load file, xxxx.ino.hex is under Arduino 2.0.3? Post #17 above needs it!

You can always find it by looking at Help > Verbose Info in Teensy Loader.

Just click Verify in Arduino. New messages will appear as Arduino IDE runs teensy_post_compile which tells Teensy Loader the filename and path.
 
Thanks for the info on the inner workings.

Currently, using 2.0.3 and TD0.58.3, under Linux Mint 20.04. The hex file needs to be more that 80K to 100K for failure. I have not been able to define a case that always works nor that always fails. It may depend on other USB activity, and I can't shut that down and still run the PC. Sometimes it will work fine, many times in a row, and then fail just as consistently. Here is the loader verbose output for a failure:
Code:
20:02:25.011 (loader): action add: /dev/hidraw6
20:02:25.011 (loader): USB add /dev/hidraw6, vid=16C0, pid=0478, ver=0107, serial=00097D96, location=usb5/5-1/5-1.2/
20:02:25.011 (loader): action remove: /dev/hidraw6
20:02:25.011 (loader): USB remove /dev/hidraw6
20:05:59.176 (post_compile 8): Begin, version=1.58-beta3
20:05:59.176 (loader): remote connection 10 opened
20:05:59.176 (post_compile 8): ARDUINO_USER_AGENT = "arduino-cli/0.29.0 arduino-ide/2.0.3 grpc-node-js/1.6.8"
20:05:59.176 (post_compile 8): Sending command: comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_post_compile)
20:05:59.176 (loader): remote cmd from 10: "comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_post_compile)"
20:05:59.176 (loader): remote cmd from 10: "status"
20:05:59.176 (loader): file changed
20:05:59.195 (loader): File "/tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/TestFFT4096iq.ino.hex", 120832 bytes
20:05:59.195 (loader): File "TestFFT4096iq.ino.hex". 120832 bytes
20:05:59.196 (post_compile 8): Status: 1, 0, 0, 2, 0, 0, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:05:59.196 (post_compile 8): Sending command: auto:on
20:05:59.196 (loader): remote cmd from 10: "auto:on"
20:05:59.196 (post_compile 8): Disconnect
20:05:59.207 (loader): remote connection 10 closed
20:05:59.960 (post_compile 9): Begin, version=1.58-beta3
20:05:59.960 (loader): remote connection 10 opened
20:05:59.960 (post_compile 9): ARDUINO_USER_AGENT = "arduino-cli/0.29.0 arduino-ide/2.0.3 grpc-node-js/1.6.8"
20:05:59.960 (post_compile 9): port = "usb5/5-1/5-1.2"
20:05:59.960 (post_compile 9): Sending command: comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_post_compile)
20:05:59.960 (loader): remote cmd from 10: "comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_post_compile)"
20:05:59.961 (loader): remote cmd from 10: "status"
20:05:59.961 (post_compile 9): Status: 1, 1, 0, 2, 0, 0, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:05:59.961 (post_compile 9): Disconnect
20:05:59.971 (post_compile 10): Running teensy_reboot: /home/bob/.arduino15/packages/teensy/tools/teensy-tools/0.58.3/teensy_reboot
20:05:59.971 (loader): remote connection 10 closed
20:05:59.971 (loader): remote connection 10 opened
20:05:59.972 (loader): remote connection 10 closed
20:05:59.972 (reboot 11): Begin, version=1.58-beta3
20:05:59.972 (reboot 11): location = usb5/5-1/5-1.2
20:05:59.972 (reboot 11): portlabel = {serial.port.label}
20:05:59.972 (reboot 11): portprotocol = {serial.port.protocol}
20:05:59.985 (loader): remote connection 10 opened
20:05:59.986 (reboot 11): add device: subsys=usb, type=usb_device, location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.2
20:05:59.986 (reboot 11):   devnode=/dev/bus/usb/005/075, subsystem=usb, ifacenum=-1
20:05:59.986 (reboot 11): add child:  subsys=usb, type=usb_interface, location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.2/5-1.2:1.0
20:05:59.986 (reboot 11):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.2
20:05:59.986 (reboot 11):   model=36 (Teensy 4.0)
20:05:59.986 (reboot 11): add child:  subsys=tty, type=(null), location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.2/5-1.2:1.0/tty/ttyACM0
20:05:59.986 (reboot 11):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.2
20:05:59.986 (reboot 11):   devnode=/dev/ttyACM0, subsystem=tty, ifacenum=0
20:05:59.987 (reboot 11): add child:  subsys=usb, type=usb_interface, location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.2/5-1.2:1.1
20:05:59.987 (reboot 11):   parent location=/sys/devices/pci0000:00/0000:00:1c.6/0000:07:00.0/usb5/5-1/5-1.2
20:06:00.002 (reboot 11): usb scan found 1 devices
20:06:00.002 (reboot 11): found Teensy Loader, version 1.58
20:06:00.002 (reboot 11): Sending command: show:arduino_attempt_reboot
20:06:00.002 (loader): remote cmd from 10: "show:arduino_attempt_reboot"
20:06:00.002 (loader): got request to show arduino rebooting message
20:06:00.002 (reboot 11): Sending command: comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_reboot)
20:06:00.003 (loader): remote cmd from 10: "comment: Teensyduino 1.58-beta3 - LINUX64 (teensy_reboot)"
20:06:00.003 (loader): remote cmd from 10: "status"
20:06:00.003 (reboot 11): Status: 1, 1, 0, 2, 0, 0, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:00.003 (reboot 11): do_reset (serial) /dev/ttyACM0
20:06:00.006 (loader): remote cmd from 10: "status"
20:06:00.006 (reboot 11): Status: 1, 1, 0, 2, 0, 0, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:00.006 (reboot 11): status read, retry 0
20:06:00.107 (loader): remote cmd from 10: "status"
20:06:00.107 (reboot 11): Status: 1, 1, 0, 2, 0, 0, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:00.107 (reboot 11): status read, retry 1
20:06:00.207 (loader): remote cmd from 10: "status"
20:06:00.207 (reboot 11): Status: 1, 1, 0, 2, 0, 0, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:00.207 (reboot 11): status read, retry 2
20:06:00.307 (loader): remote cmd from 10: "status"
20:06:00.308 (reboot 11): Status: 1, 1, 0, 2, 0, 0, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:00.308 (reboot 11): status read, retry 3
20:06:00.408 (loader): remote cmd from 10: "status"
20:06:00.408 (reboot 11): Status: 1, 1, 0, 2, 0, 0, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:00.408 (reboot 11): status read, retry 4
20:06:00.508 (loader): remote cmd from 10: "status"
20:06:00.508 (reboot 11): Status: 1, 1, 0, 2, 0, 0, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:00.508 (reboot 11): status read, retry 5
20:06:00.609 (loader): remote cmd from 10: "status"
20:06:00.609 (loader): action add: /dev/hidraw6
20:06:00.609 (loader): USB add /dev/hidraw6, vid=16C0, pid=0478, ver=0107, serial=00097D96, location=usb5/5-1/5-1.2/
20:06:00.667 (loader): read feature report
20:06:00.667 (loader): opening /dev/hidraw6, usage: 0024: Teensy 4.0 (IMXRT1062)
20:06:00.667 (loader): secure mode can not be locked: this is Standard Teensy
20:06:00.667 (loader): encryption is possible on this Teensy, but not yet configured
20:06:00.667 (loader): but without secure mode locked, encryption will NOT be secure!
20:06:00.667 (loader): Device came online, code_size = 2031616
20:06:00.667 (loader): Board is: Teensy 4.0 (IMXRT1062), version 1.07
20:06:00.684 (loader): File "/tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/TestFFT4096iq.ino.hex", 120832 bytes
20:06:00.684 (loader): File "TestFFT4096iq.ino.hex". 120832 bytes, 6% used
20:06:00.732 (loader): set background IMG_ONLINE
20:06:00.755 (loader): File "/tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/TestFFT4096iq.ino.hex", 120832 bytes
20:06:00.755 (loader): File "TestFFT4096iq.ino.hex". 120832 bytes, 6% used
20:06:00.790 (loader): elf appears to be for Teensy 4.0 (IMXRT1062) (2031616 bytes)
20:06:00.790 (loader): elf binary data matches hex file
20:06:00.790 (loader): elf file is for Teensy 4.0 (IMXRT1062)
20:06:00.790 (loader): using hex file
20:06:00.823 (loader): begin operation
20:06:00.829 (reboot 11): Status: 1, 1, 1, 3, 0, 1, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:00.829 (loader): flash, block=0, bs=1024, auto=1
20:06:00.839 (loader): flash, block=1, bs=1024, auto=1
20:06:00.839 (loader): flash, block=2, bs=1024, auto=1
20:06:01.275 (loader): remote cmd from 10: "status"
20:06:01.275 (reboot 11): Status: 1, 1, 1, 3, 0, 1, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:01.275 (loader): flash, block=3, bs=1024, auto=1
20:06:01.275 (loader): flash, block=4, bs=1024, auto=1
20:06:01.276 (loader): flash, block=5, bs=1024, auto=1
20:06:01.276 (loader): flash, block=6, bs=1024, auto=1
20:06:01.277 (loader): flash, block=7, bs=1024, auto=1
20:06:01.294 (loader): flash, block=8, bs=1024, auto=1
20:06:01.294 (loader): flash, block=9, bs=1024, auto=1
20:06:01.295 (loader): flash, block=10, bs=1024, auto=1
20:06:01.311 (loader): flash, block=11, bs=1024, auto=1
20:06:01.311 (loader): flash, block=12, bs=1024, auto=1
20:06:01.327 (loader): remote cmd from 10: "status"
20:06:01.327 (reboot 11): Status: 1, 1, 1, 3, 0, 1, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:01.327 (loader): flash, block=13, bs=1024, auto=1
20:06:01.328 (loader): flash, block=14, bs=1024, auto=1
20:06:01.344 (loader): flash, block=15, bs=1024, auto=1
20:06:01.344 (loader): flash, block=16, bs=1024, auto=1
20:06:01.345 (loader): flash, block=17, bs=1024, auto=1
20:06:01.361 (loader): flash, block=18, bs=1024, auto=1
20:06:01.361 (loader): flash, block=19, bs=1024, auto=1
20:06:01.377 (loader): flash, block=20, bs=1024, auto=1
20:06:01.378 (loader): remote cmd from 10: "status"
20:06:01.378 (reboot 11): Status: 1, 1, 1, 3, 0, 1, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:01.378 (loader): flash, block=21, bs=1024, auto=1
20:06:01.394 (loader): flash, block=22, bs=1024, auto=1
20:06:01.394 (loader): flash, block=23, bs=1024, auto=1
20:06:01.410 (loader): flash, block=24, bs=1024, auto=1
20:06:01.411 (loader): flash, block=25, bs=1024, auto=1
20:06:01.426 (loader): flash, block=26, bs=1024, auto=1
20:06:01.427 (loader): flash, block=27, bs=1024, auto=1
20:06:01.443 (loader): remote cmd from 10: "status"
20:06:01.443 (loader): flash, block=28, bs=1024, auto=1
20:06:01.443 (reboot 11): Status: 1, 1, 1, 3, 0, 1, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:01.444 (loader): flash, block=29, bs=1024, auto=1
20:06:01.459 (loader): flash, block=30, bs=1024, auto=1
20:06:01.460 (loader): flash, block=31, bs=1024, auto=1
20:06:01.476 (loader): flash, block=32, bs=1024, auto=1
20:06:01.476 (loader): flash, block=33, bs=1024, auto=1
20:06:01.492 (loader): flash, block=34, bs=1024, auto=1
20:06:01.493 (loader): flash, block=35, bs=1024, auto=1
20:06:01.509 (loader): remote cmd from 10: "status"
20:06:01.509 (reboot 11): Status: 1, 1, 1, 3, 0, 1, /tmp/arduino-sketch-97658C5253037B2845A9AD09BDBF9DF8/, TestFFT4096iq.ino.hex
20:06:01.509 (loader): flash, block=36, bs=1024, auto=1
20:06:01.510 (loader): flash, block=37, bs=1024, auto=1
20:06:01.525 (loader): flash, block=38, bs=1024, auto=1
20:06:01.526 (loader): flash, block=39, bs=1024, auto=1
20:06:01.542 (loader): flash, block=40, bs=1024, auto=1
20:06:01.543 (loader): flash, block=41, bs=1024, auto=1
20:06:01.558 (loader): flash, block=42, bs=1024, auto=1
20:06:01.559 (loader): flash, block=43, bs=1024, auto=1
20:06:01.559 (reboot 11): status read, retry 6
20:06:01.559 (reboot 11): Success
20:06:01.559 (reboot 11): Disconnect
20:06:01.575 (loader): flash, block=44, bs=1024, auto=1
20:06:01.576 (loader): remote connection 10 closed
20:06:01.576 (loader): flash, block=45, bs=1024, auto=1
20:06:01.592 (loader): flash, block=46, bs=1024, auto=1
20:06:01.592 (loader): flash, block=47, bs=1024, auto=1
20:06:01.608 (loader): flash, block=48, bs=1024, auto=1
20:06:01.609 (loader): flash, block=49, bs=1024, auto=1
20:06:01.624 (loader): flash, block=50, bs=1024, auto=1
20:06:01.625 (loader): flash, block=51, bs=1024, auto=1
20:06:01.641 (loader): flash, block=52, bs=1024, auto=1
20:06:01.641 (loader): flash, block=53, bs=1024, auto=1
20:06:01.657 (loader): flash, block=54, bs=1024, auto=1
20:06:01.658 (loader): flash, block=55, bs=1024, auto=1
20:06:01.673 (loader): flash, block=56, bs=1024, auto=1
20:06:01.674 (loader): flash, block=57, bs=1024, auto=1
20:06:01.690 (loader): flash, block=58, bs=1024, auto=1
20:06:01.690 (loader): flash, block=59, bs=1024, auto=1
20:06:01.706 (loader): flash, block=60, bs=1024, auto=1
20:06:01.707 (loader): flash, block=61, bs=1024, auto=1
20:06:01.722 (loader): flash, block=62, bs=1024, auto=1
20:06:01.723 (loader): flash, block=63, bs=1024, auto=1
20:06:01.739 (loader): flash, block=64, bs=1024, auto=1
20:06:01.739 (loader): flash, block=65, bs=1024, auto=1
20:06:01.755 (loader): flash, block=66, bs=1024, auto=1
20:06:01.756 (loader): flash, block=67, bs=1024, auto=1
20:06:01.772 (loader): flash, block=68, bs=1024, auto=1
20:06:01.772 (loader): flash, block=69, bs=1024, auto=1
20:06:01.788 (loader): flash, block=70, bs=1024, auto=1
20:06:01.788 (loader): flash, block=71, bs=1024, auto=1
20:06:01.804 (loader): flash, block=72, bs=1024, auto=1
20:06:01.805 (loader): flash, block=73, bs=1024, auto=1
20:06:01.820 (loader): flash, block=74, bs=1024, auto=1
20:06:01.821 (loader): flash, block=75, bs=1024, auto=1
20:06:01.837 (loader): flash, block=76, bs=1024, auto=1
20:06:01.837 (loader): flash, block=77, bs=1024, auto=1
20:06:01.853 (loader): flash, block=78, bs=1024, auto=1
20:06:01.854 (loader): flash, block=79, bs=1024, auto=1
20:06:01.869 (loader): flash, block=80, bs=1024, auto=1
20:06:01.870 (loader): flash, block=81, bs=1024, auto=1
20:06:01.886 (loader): flash, block=82, bs=1024, auto=1
20:06:01.886 (loader): flash, block=83, bs=1024, auto=1
20:06:01.902 (loader): flash, block=84, bs=1024, auto=1
20:06:01.903 (loader): flash, block=85, bs=1024, auto=1
20:06:01.918 (loader): flash, block=86, bs=1024, auto=1
20:06:01.919 (loader): flash, block=87, bs=1024, auto=1
20:06:01.935 (loader): flash, block=88, bs=1024, auto=1
20:06:01.935 (loader): flash, block=89, bs=1024, auto=1
20:06:01.964 (loader): flash, block=90, bs=1024, auto=1
20:06:01.965 (loader): flash, block=91, bs=1024, auto=1
20:06:01.970 (loader): flash, block=92, bs=1024, auto=1
20:06:01.972 (loader): flash, block=93, bs=1024, auto=1
20:06:01.973 (loader): flash, block=94, bs=1024, auto=1
20:06:01.973 (loader): flash, block=95, bs=1024, auto=1
20:06:12.155 (loader): program: write error
20:06:12.155 (loader): end operation, total time = 11.332 seconds
20:06:12.155 (loader): set background IMG_DOWNLOAD_ERROR
20:06:12.156 (loader): redraw timer set, image 11 to show for 4000 ms
20:06:16.157 (loader): redraw, image 10
20:06:16.157 (loader): set background IMG_ONLINE
20:06:54.069 (loader): Verbose Info event

A good load just whips through 117 blocks and finishes up like this:
Code:
16:59:13.773 (loader): flash, block=117, bs=1024, auto=1
16:59:13.799 (loader): sending reboot
16:59:13.799 (loader): begin wait_until_offline
16:59:13.850 (loader): action remove: /dev/hidraw6
16:59:13.850 (loader): USB remove /dev/hidraw6
16:59:13.850 (loader): HID/linux: device is disconnected(2)
16:59:13.850 (loader): offline, waited 1
16:59:13.850 (loader): end operation, total time = 1.111 seconds
16:59:13.850 (loader): set background IMG_REBOOT_OK
16:59:13.851 (loader): redraw timer set, image 14 to show for 1200 ms
16:59:15.052 (loader): redraw, image 9

I went back to command line loading, as in #14 and #17 above and it never fails . Never. This is with 2.5 millisecond delays. To find the hex file now requires cleaning out /tmp files when changing INO files, as Arduino 2.0 doesn't anymore. This results in a script like
Code:
#!/bin/bash
# This will fail if several hex files are in /tmp
# Either, fix this to sort using "date -r" or purge hex files before this.
# The containing directories in /tmp all start with "arduino-sketch"
cd /tmp || return
echo -n "Find Hex File, "
# hexFile="$(find arduino_build_??????/*.ino.hex)"     For <2.0 arduino
hexFile="$(find arduino-sketch-????????????????????????????????/*.ino.hex)"
echo "Loading Hex File ":"$hexFile"
cmd1="./teensy_loader_cli --mcu=TEENSY40 -w -s -v /tmp/${hexFile}"
cd ~/Documents/ArduinoTeensyCLI
eval $cmd1

I'm open to further testing, but need some fresh ideas of what to do.
 
Back
Top