Purpose of MKL02Z32VFG4

jarnoldbrown

New member
Hi,

I'm new to the Teensy platform, but thinking of using the MKL26Z64VFT4 in a design, and thus thinking of purchasing a Teensy LC for experimentation.
I am confused as to the purpose of the MKL02Z32VFG4 chip. Since it connects to the SWD_CLK and SWD_DIO pins, my best gues is that it contains the binary for a USB bootloader and that it can erase and re-program the MKL26Z64VFT4 in the event that the user manages to erase or otherwise disable the bootloader.

Is this correct?

Kind regards,

John
 
Mostly correct. It's entirely the bootloader, not just if/when the user does something bad.

When the "upload code" USB magic packet gets sent from the host to the main MCU or when the "program" button on the board gets pressed the MKL0 takes over, uploads the bootloader code to the main MCU's RAM, and tells it to start running that code. The bootloader in RAM erases the Flash, reads the new image from USB and writes it to flash, then reboots itself.

The biggest advantage to this method is 100% of the Flash space of the MCU is available for user code; none is reserved for a bootloader etc.
 
... and lugnuts like me have a harder time destroying their teensy.

That said, Roxanne (my pet humidifier controller based on a LC) as been running without a hiccup for 5 days now with 16% utilization. I guess it's not only stable but also kicking the watchdog all over town.
 
Mostly correct. It's entirely the bootloader, not just if/when the user does something bad.

When the "upload code" USB magic packet gets sent from the host to the main MCU or when the "program" button on the board gets pressed the MKL0 takes over, uploads the bootloader code to the main MCU's RAM, and tells it to start running that code. The bootloader in RAM erases the Flash, reads the new image from USB and writes it to flash, then reboots itself.

The biggest advantage to this method is 100% of the Flash space of the MCU is available for user code; none is reserved for a bootloader etc.
Ah! I see. That's nice.
Has anyone written a Flash based resident bootloader? I am happy to write my own, but I'm a bit put off by AN4370, which mentions a size of 32k bytes. Seems like a lot to me, although I have no feel for how much space he USB stuff take up, and I do know how 32 bit code eats memory.
 
Ah! I see. That's nice.
Has anyone written a Flash based resident bootloader? I am happy to write my own, but I'm a bit put off by AN4370, which mentions a size of 32k bytes. Seems like a lot to me, although I have no feel for how much space he USB stuff take up, and I do know how 32 bit code eats memory.

You likely would be better off using uTasker. That is, unless you put no value on your time or enjoy writing bootloaders.

Not sure why one would write a bootloader if the desire is to save space on the device. If you really want to go bare metal, then get a tag-connect connector and the appropriate external device to communicate directly with the MCU over the SWD pins. Visual Studio + Visual Micro + Visual GDB fill out the software side, as long as assembling the tool chain is not too difficult.

As for me, I'll gladly pay the $8 per board for the convenience of a external bootloader to save my bacon and the amazing technical support I have gotten here. To each his/her own.
 
Last edited:
As for me, I'll gladly pay the $8 per board for the convenience of a external bootloader to save my bacon and the amazing technical support I have gotten here. To each his/her own.

Agreed,
For me, one of the greatest plus of Teensy is that is one can simply download a program without having needing a bootloader program around.
tell the teensyloader which program you wanted to download, press the button and off you go. Nothing simpler than this.
 
I am talking about a commercial, volume product here. So I can't be adding extra parts or using a "standard" bootloader.

Thanks anyway for your comments.
 
A couple of questions:

The PJRC website says the MKL02Z32VFG4 bootloader chip is "for DIY Teensy LC, 3.2, 3.5, 3.6 Projects". The Teensy 4.0 ad 4.1 are not mentioned. Does the MKL02Z32VFG4 also work with the Teensy 4.0 and 4.1.

Once the Teensy has been loaded with an image using the bootloader chip, will the Teensy then reboot in future without a MKL02Z32VFG4 connected? I assume the reset pin and software debug pins would need to be conditioned appropriately.

thanks
 
Teensy 4.x DIY boards use this pjrc.com/store/ic_mkl02_t4.html

In the case of T_4.x the bootloader chip is actively involved in power on of the 1062 MCU chip. Without the bootloader indeed startup process would need supplemented as indicated in section: Power Up Sequence
 
Thanks for the reply.

"In the case of T_4.x the bootloader chip is actively involved in power on of the 1062 MCU chip." Is this the same for the Teensy LC and 3.2 ?
 
Back
Top