
Originally Posted by
PaulStoffregen
Teensy Loader uses HID protocol. Windows allows multiple programs to access the same HID interface. If you're running TyCommander or any other program which tries to talk to the bootloader at the same time as Teensy Loader, you can expect that to fail in all sorts of unexpectedly wrong ways.
This is Always AFTER a completed Program Upload. All devices are running their sketch, and USB Serial connected to TyComm for SerMon. Then from TyComm GUI button 'Reset' issues a Restart to a selected Teensy and that provokes the Teensy Loader 'Image response' : Erasing ... Download Error. Just did it again {dev Ser#6052840} with this verbose response - when normally Teensy Loader would Ignore that device 'Reset/Restart':
Code:
18:47:51.270 (ports 55): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
18:47:51.276 (ports 55): remove: loc=usb:0/140000/0/6/1/2
18:47:51.276 (ports 55): usb_remove: usb:0/140000/0/6/1/2
18:47:51.276 (ports 55): nothing new, skipping HID & Ports enum
18:47:51.289 (ports 55): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
18:47:51.290 (ports 55): nothing new, skipping HID & Ports enum
18:47:51.291 (ports 55): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
18:47:51.292 (ports 55): nothing new, skipping HID & Ports enum
18:47:51.489 (ports 55): WM_DEVICECHANGE DBT_DEVICEARRIVAL
18:47:51.491 (ports 55): found_usb_device, id=\\?\usb#vid_16c0&pid_0478#00093c64#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
18:47:51.491 (ports 55): found_usb_device, loc=usb:0/140000/0/6/1/2 Port_#0002.Hub_#0005
18:47:51.491 (ports 55): found_usb_device, hwid=USB\VID_16C0&PID_0478&REV_0105
18:47:51.491 (ports 55): found_usb_device, devinst=0000001f
18:47:51.491 (ports 55): add: loc=usb:0/140000/0/6/1/2, class=HID, vid=16C0, pid=0478, ver=0105, serial=00093c64, dev=\\?\usb#vid_16c0&pid_0478#00093c64#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
18:47:51.491 (ports 55): hiddev_from_devinst_list: iface=0
18:47:51.492 (ports 55): found_usb_device complete
18:47:51.492 (ports 55): usb_add: usb:0/140000/0/6/1/2 [no_device] (Teensy 4.0) Bootloader
18:47:51.529 (ports 55): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
18:47:51.531 (ports 55): hid, found devinst=00000020
18:47:51.531 (ports 55): hid, path=\\?\hid#vid_16c0&pid_0478#8&13065cc&1&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
18:47:51.531 (ports 55): hid, opened handle
18:47:51.531 (ports 55): devinst=00000020, location=usb:0/140000/0/6/1/2
18:47:51.531 (ports 55): vid=16C0, pid=0478, ver=0105, usepage=FF9C, use=0024
18:47:51.531 (ports 55): devpath=\\?\hid#vid_16c0&pid_0478#8&13065cc&1&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
18:47:51.531 (ports 55): usb_add: usb:0/140000/0/6/1/2 hid#vid_16c0&pid_0478 (Teensy 4.0) Bootloader
18:47:51.555 (loader): Device came online, code_size = 2031616
18:47:51.557 (loader): Board is: Teensy 4.0 (IMXRT1062), version 1.05
18:47:51.569 (loader): File "R:\temp\arduino_build_Micros_IsrDetect.ino\Micros_IsrDetect.ino.hex", 56320 bytes
18:47:51.579 (loader): File "R:\temp\arduino_build_Micros_IsrDetect.ino\Micros_IsrDetect.ino.ehex", 56320 bytes, and 4960 loader utility
18:47:51.581 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
18:47:51.583 (loader): File "Micros_IsrDetect.ino.hex". 56320 bytes, 3% used
18:47:51.622 (loader): set background IMG_ONLINE
18:47:51.633 (ports 55): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
18:47:51.635 (ports 55): remove: loc=usb:0/140000/0/6/1/2
18:47:51.635 (ports 55): usb_remove: usb:0/140000/0/6/1/2
18:47:51.635 (ports 55): nothing new, skipping HID & Ports enum
18:47:51.642 (loader): File "R:\temp\arduino_build_Micros_IsrDetect.ino\Micros_IsrDetect.ino.hex", 56320 bytes
18:47:51.652 (loader): File "R:\temp\arduino_build_Micros_IsrDetect.ino\Micros_IsrDetect.ino.ehex", 56320 bytes, and 4960 loader utility
18:47:51.654 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
18:47:51.656 (loader): File "Micros_IsrDetect.ino.hex". 56320 bytes, 3% used
18:47:51.698 (loader): elf appears to be for Teensy 4.0 (IMXRT1062) (2031616 bytes)
18:47:51.702 (loader): elf binary data matches hex file
18:47:51.705 (loader): elf file is for Teensy 4.0 (IMXRT1062)
18:47:51.710 (loader): using hex file - Teensy not configured for encryption
18:47:51.754 (loader): begin operation
18:47:51.790 (loader): flash, block=0, bs=1024, auto=1
18:47:51.905 (ports 55): WM_DEVICECHANGE DBT_DEVICEARRIVAL
18:47:51.908 (ports 55): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#6052840#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
18:47:51.908 (ports 55): found_usb_device, loc=usb:0/140000/0/6/1/2 Port_#0002.Hub_#0005
18:47:51.908 (ports 55): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
18:47:51.908 (ports 55): found_usb_device, devinst=00000002
18:47:51.908 (ports 55): add: loc=usb:0/140000/0/6/1/2, class=USB, vid=16C0, pid=0483, ver=0279, serial=6052840, dev=\\?\usb#vid_16c0&pid_0483#6052840#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
18:47:51.908 (ports 55): comport_from_devinst_list attempt
18:47:51.908 (ports 55): found Ports in classguid_list at index=1
18:47:51.908 (ports 55): port COM25 found from devnode
18:47:51.908 (ports 55): found_usb_device complete
18:47:51.910 (ports 55): usb_add: usb:0/140000/0/6/1/2 COM25 (Teensy 4.0) Serial
18:47:56.851 (ports 55): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
18:47:56.852 (ports 55): nothing new, skipping HID & Ports enum
18:47:56.929 (ports 55): WM_DEVICECHANGE DBT_DEVICEARRIVAL
18:47:56.930 (ports 55): nothing new, skipping HID & Ports enum
18:47:57.114 (ports 55): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
18:47:57.116 (ports 55): nothing new, skipping HID & Ports enum
18:47:57.813 (loader): HID/win32: write failure, num = 0
18:47:57.815 (loader): program: write error
18:47:57.817 (loader): HID/win32: HidD_GetPreparsedData failed, device assumed disconnected
18:47:57.826 (loader): end operation, total time = 6.067 seconds
18:47:57.830 (loader): set background IMG_DOWNLOAD_ERROR
18:47:57.833 (loader): redraw timer set, image 11 to show for 4000 ms
18:47:57.865 (loader): HID/win32: vid:046D pid:C52B ver:1211 usb:0/140000/0/9/4/2/4
18:47:57.870 (loader): HID/win32: vid:046D pid:C52B ver:1211 usb:0/140000/0/9/4/2/4
18:47:57.873 (loader): HID/win32: vid:046D pid:C52B ver:1211 usb:0/140000/0/9/4/2/4
18:47:57.878 (loader): HID/win32: vid:046D pid:C52B ver:1211 usb:0/140000/0/9/4/2/3
18:47:57.882 (loader): HID/win32: vid:046D pid:C52B ver:1211 usb:0/140000/0/9/4/2/4
18:47:57.885 (loader): HID/win32: vid:046D pid:C52B ver:1211 usb:0/140000/0/9/4/2/3
18:47:57.889 (loader): HID/win32: vid:046D pid:C52B ver:1211 usb:0/140000/0/9/4/2/3
18:47:57.895 (loader): HID/win32: vid:046D pid:C52B ver:1211 usb:0/140000/0/9/4/2/4
18:48:01.830 (loader): redraw, image 9
Indeed - been asking about teensy_restart.exe as a way to perform a Restart - not Reboot to Bootloader? TyComm calls that 'Reset'. And I'm looking to find a way to USB Trigger the Restart not using TyComm - ideally a PJRC tool that you could repro with it if shows.
In the Integrity Examples there is the 'R'estart {SCB_AIRCR = 0x05FA0004;} key entry processed - and triggering that from within the code does a Restart, and that does not trigger the indicated Loader Image behavior.
My machine shows this for _ports:
Code:
C:\T_Drive\Arduino_1.8.16_155\hardware\tools>teensy_ports.exe
{
"address": "usb:0/140000/0/6/1/1",
"online": true,
"label": "COM9 (Teensy 4.0) Serial",
"vid": "16C0",
"pid": "0483",
"iserial": "1037997",
"boardName": "Teensy 4.0",
"protocol": "Teensy"
}
{
"address": "usb:0/140000/0/6/1/4",
"online": true,
"label": "COM28 (Teensy 4.0) Serial",
"vid": "16C0",
"pid": "0483",
"iserial": "668380",
"boardName": "Teensy 4.0",
"protocol": "Teensy"
}
{
"address": "usb:0/140000/0/6/3",
"online": true,
"label": "COM8 (Teensy 4.0) Serial",
"vid": "16C0",
"pid": "0483",
"iserial": "1037996",
"boardName": "Teensy 4.0",
"protocol": "Teensy"
}
{
"address": "usb:0/140000/0/6/1/2",
"online": true,
"label": "COM25 (Teensy 4.0) Serial",
"vid": "16C0",
"pid": "0483",
"iserial": "605284",
"boardName": "Teensy 4.0",
"protocol": "Teensy"
}
Is there a PJRC CMDline tool way to Restart/Reset those devices?