Program Teensy from another Teensy?

Thanks everyone for taking the time to try to resolve my problem.
My final goal is to use one micromod teensy to program another micromod teensy. I have no choice, I cannot use another teensy model on my project for other reasons.

I have just finished building a prototype which will end me doing tests between two micro mod teensy.
I will get back to you as soon as possible with screenshots this time ;) .
 
I don't know why but from teeny micormod to teensy micromod your program works Frank B :) ! I don't know why it doesn't work with a teensy 4.1 in master.

Thank you so much !

I just modified "case 0x26: filename =" TEENSY40.HEX "; return true;" in "case 0x26: filename =" TEENSYMM.HEX "; return true;".
 
One of the links linked to this or a link to it: github.com/PaulStoffregen/USB_Tester

It is a PJRC tester that programs a Teensy - updated to T_4.0 with known ID's - matching the note in prior p#28:
Code is 4 yrs old for model ID's - but updated 2 years ago for T_4.2 included test blink HEX file.
Code:
...
			case 0x24: filename = "TEENSY40.HEX"; return true;
			default:
				Serial.printf("Unknown model ID = 0x%02X\n", id);
				return false; // unknown
		}
	}
	return false;
}

// program blink firmware
bool program_teensy(const char *filename)
{
...
 
When I use T4.1 as master, it looks like the teensy connected to the Host port programs properly, but in fact it doesn't. All the packets are sent, nothing times out, but the device doesn't reboot (the program doesn't get written properly I guess). I suspect it was the same in your test, but you just never realized it. Paul says himself earlier in the thread that there are issues using it on T4.1 devices. Any chance you'd be will to test again and confirm that all is working when a T4.1 device is the master?
 
I quickly tried running USB_Tester.ino on a Teensy 4.1 rather than Teensy 3.6. So many things go wrong. This code was only tested on Teensy 3.6, specifically the hardware in the
To make this work easily, run it only on Teensy 3.6.

Paul, I really need this working on a T4.1. I've been studying the USB protocol and the code in ehci.cpp all day, looking for where things go wrong, but I'm stumped. I know you are busy, and I don't expect you to provide me any code, but if you have any insights as to why this doesn't work on a T4.1, could you please share them.

Regards,
Rob
 
Paul, I really need this working on a T4.1. .... I know you are busy, and I don't expect you to provide me any code, but if you have any insights as to why this doesn't work on a T4.1, could you please share them.

Providing code (but without supporting documentation) is the easy part.

Insight into a problem... that's much more work.

Some time ago I did build new USB tester using Teensy 4.0... and many of the recent software developments. A serial flash chip is used for the file storage, rather than SD card. It uses MTP for access to that chip. CrashReport and the new breadcrumbs are also used throughout the code. It was sort of a test bed for quite a lot of software development.

Sorry, no documentation exists regarding the hardware. But I can tell you it has an improved analog circuit and MAX11613 ADC chip for measuring the USB device current. It was made with a pretty extravagant power supply, using separate step-down switchers for Teensy 4.0 + 7 segment display and the USB device under test with quite a lot of effort in filtering and even a secondary LDO so the device under test gets pristine USB power. Other than the fancy circuitry to measure USB device current, it's basically just a Teensy 4.0, SPI flash chip (ordinary SPI on pins 10-13), and HT16K33 7-segment display.

With that in mind, here's the code.
 

Attachments

  • USB_Tester2.zip
    10.6 KB · Views: 30
Providing code (but without supporting documentation) is the easy part
Thanks, Paul. I had a quick look over the code and it's basically the same process as before, so I must be dealing with some sort of hardware issue. Considering how much attention you are paying towards the proper current, that would probably be the place for me to start looking for issues. Thank-you for taking the time to reply.
 
One more question, Paul.

Is is safe to assume that after we call bootloader.write() and the control callback comes back 'Complete', we can reuse / free the memory location passed to bootloader.write()?
 
Yup, USB host hardware is basically the same between Teensy 3.6 and 4.0 / 4.1.

I'm so happy to report that I solved the issue.
Code:
#define RAWHID_RX_SIZE		64 // 32 works fine for T3.6, but not T4.1

A few notes about your driver, Paul. I think you'll find that if you implement a minimum wait time between queue_Control_Transfer(), your reliability will go up a lot. I assume you added all the 'power' extras just for interest sake, as it doesn't seem necessary on my end. Thanks for all your help.
 
Last edited:
YAY @yeahtuna. Did you mod the prior code or use the posted zip code in the end?

My setup is quite different. I'm streaming the firmware via rawHID from an application on a computer, through a master unit (T3.6 or T4.1) to a device connected to the master's USB host port.

I didn't use Paul's code, although I did borrow a few snippets. I tried to use his code, but ran into issues so I went back to my own code that was working fine when T3.6 was the master. I can post it if you want.
 
My setup is quite different. I'm streaming the firmware via rawHID from an application on a computer, through a master unit (T3.6 or T4.1) to a device connected to the master's USB host port.

I didn't use Paul's code, although I did borrow a few snippets. I tried to use his code, but ran into issues so I went back to my own code that was working fine when T3.6 was the master. I can post it if you want.

Cool - glad it is working, just wondered if it ended up showing/improving an easy sample to test. Have seen this topic of Teensy host programming a Teensy device and it seems fun - but never tried here.
 
Back
Top