Teensy 3.6 mkl02Z32vfg4(Cortex M0) and upload code

Status
Not open for further replies.

angel777

Member
Hi to everybody,

i know that for uploading code on teensy i need to be in program mode and that is possible when:

-using teensy loader application
-press the program button
-set the program pin to GND (that is the same thing as above)

Is there a way to do that without the mkl02Z32vfg4(Cortex M0)?
Where resides the HalfKay Bootloader?
Is there a pin on the CortexM4 that can put itself in program mode?

If that is not possible, is there a code (and how) to program the mkl02Z32vfg4(Cortex M0) to act as it is doing on teensy?

Thanks a lot,
regards,
Samuele
 
All Teensy MCUs, including the Teensy LC which comes closest to your mkl02Z32 have a small MKL02/04 based external processor containing the bootloader software and controlling the upload process into the Teensy CPU. The advantage of that solution is that the target processor's flash memory is not crowded with a bootloader program but is 100% available for user code.
The disadvantage is that only the Teensy processors, combined with the bootloader processor which is preprogrammed to support only Teensys, can be programmed this way.

If you want to flash a processor outside the Teensy universe, you are at the wrong address here and you should look out for the development and programming tools sold directly by NXP.
 
Last edited:
All Teensy MCUs, including the Teensy LC which comes closest to your mkl02Z32 have a small MKL02/04 based external processor containing the bootloader software and controlling the upload process into the Teensy CPU. The advantage of that solution is that the target processor's flash memory is not crowded with a bootloader program but is 100% available for user code.
The disadvantage is that only the Teensy processors, combined with the bootloader processor which is preprogrammed to support only Teensys, can be programmed this way.

If you want to flash a processor outside the Teensy universe, you are at the wrong address here and you should look out for the development and programming tools sold directly by NXP.

Hi,
thanks for the reply. I know that the MKL02 is outside the Teensy universe. What i ask is if you know what is the code that they've uploaded on this MCU to become the HalfKay bootloader for the teensy.
Thanks again,
Samuele
 
So there is no way at all to upload a code without the M0?
(Even with a ftdi or uploading another bootloader directly on the M4?)
If i'd like to use the M4 in production how can i do it?
 
As I said, NXP sells naturally adapted development and programming tools for all their processors. If you want to program a CPU which is not supported by PJRC's bootloader chip, that might be the only way to go.

The other variant would be re-compiling your code for the Teensy LC and buying/using that one. It's a mkl02z64.

I'm having a hard time understanding why you ask here in the Teensy forums while you designing a project around a non-Teensy processor. Thus, NXP, the processor manufacturer might be the best address to ask for support.
 
Last edited:
I'd like to make the teensy the "heart" of my project.
I need to reproduce it (without redundant parts) ,together with others components, on a single PCB board and finally to upload the sketch that i've made with arduino IDE on it.

I don't want to make the M0 the core of my project. The core is the M4(the core of teensy not?) but i don't know how to upload the code i've created with arduino IDE on it.
Sorry if i have not been clear..is it possible to do that?
 
If you look at the various threads for DIY teensy you will see a fair number of people have been down the path going from proto to production. You are correct that the M0 is not the core, it's just an autonomous programer that can take control of the M4 and get it back to a known config and stick a bootloader onto it, and you can potentially use another programing path.

So the normal process, which I think you are heading along is:
Teensy breadboard prototype
Custom PCB with Teensy fitted to the board
Prototype/small production with all components of the Teensy on the PCB
Production model with just M4 and needed hardware with some sort of header to allow a re-usable M0 mini PCB to be jacked in to program - at this point you loose the easy ability to reprogram from post production, and need to either know there will be no changes by end users, or have built a firmware update process into your own code from one of the various examples (see forum posts on OTA)- and be very careful that your updates don't do anything that will block further updates, since there is no longer the M0 there as a safety net.
Final step is to take the Teensy HEX file and program it as part of fab machinery via the programing port, which is possible but believe it takes some poking of the build values to get some of the M4 low level registers (clock selection etc) right, since they are normally set by the M0, not the Teensy hex file.
 
If you look at the various threads for DIY teensy you will see a fair number of people have been down the path going from proto to production. You are correct that the M0 is not the core, it's just an autonomous programer that can take control of the M4 and get it back to a known config and stick a bootloader onto it, and you can potentially use another programing path.

So the normal process, which I think you are heading along is:
Teensy breadboard prototype
Custom PCB with Teensy fitted to the board
Prototype/small production with all components of the Teensy on the PCB
Production model with just M4 and needed hardware with some sort of header to allow a re-usable M0 mini PCB to be jacked in to program - at this point you loose the easy ability to reprogram from post production, and need to either know there will be no changes by end users, or have built a firmware update process into your own code from one of the various examples (see forum posts on OTA)- and be very careful that your updates don't do anything that will block further updates, since there is no longer the M0 there as a safety net.
Final step is to take the Teensy HEX file and program it as part of fab machinery via the programing port, which is possible but believe it takes some poking of the build values to get some of the M4 low level registers (clock selection etc) right, since they are normally set by the M0, not the Teensy hex file.

You are right..from proto to production..
It is really important that the end users could update the software on the M4.
As you are telling me this is not possible without the M0.
The only way seems OTA but it is so dangerous if something is going wrong.
I think that teensy is not a real development board since you've got to buy from them (i've read 8$ a piece) the M0 pre-programmed..
 
The under $7 Pre-Programmed M0 bootloader chip is what turns the M4 MCU Teensy into a Teensy. Without the bootloader M0 - you don't have the Teensy and all that comes with it from PJRC. The cost of that is buying the MO chip to get USB programmability and support and safety and common software libraries that come with that to 'harness' the 32 bit Teensy MCU family. As GremlinWrangler notes that M0 can be temporary - but when not present the USB program interface is not present.
 
It's certainly possible for end users to load new code, with examples floating around for serial and SD card sources along with the commercial uTasker http://www.utasker.com/kinetis/TEENSY_3.1.html, though don't believe they have updated to T3.5/6, most likely because the money to support the man hours to do so didn't flow from the T3.1 work they did, possibly a useful data point in this. As you note though any single CPU solution will always be exciting to do customer updates to, especially if you don't have enough on board storage to keep 2, preferably three copies of your code and a hardware design that allows user selection between them.

Hence where the Teensys came from in the first place, adding a second CPU and increasing cost and complexity of the devboard but reducing the potential to have users brick the thing and having the full space of the core available for user code. If you want a robust firmware update solution Teensy certainly isn't your only or best choice, but when doing the math for how much your programmer IC costs don't forget to factor in the per unit programing charges that'll need to happen at some point.
 
Hi,

There is a question I ask myself.
Is it with the JTAG bus that the M0 programs the M4? or is it another protocol?
 
Status
Not open for further replies.
Back
Top