Teensy 3.1

01 Jan 2014

Hi there guys!

I just received a Teensy 3.1 board and it is brilliant, but I'd like to use my Mbed stuff with it... I'm not sure if there is a policy about making announcements before a shipping product, but I'd like to suggest support for this great little dev board in the mbed environment! :)

Cheers

02 Jan 2014

Had heard about it before, had a look at it. The microcontroller is not the issue: Martin is currently working on support for the http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=FRDM-K20D50M, which uses the same one as the Teensy 3.0, and the 3.1 just uses another version of the same one: some settingds would need to be changed but that would be pretty much it.

The problem is programming it. It looks like it wants a hex file, while mbed returns bin files (if you compile online), so then you have to convert the bin file to a hex file. Aditionally programs have to meet certain requirements regarding which flash area they use, since contrary to mbed, on the teensy a closed source bootloader is used for programming, which makes it probably a bit problematic.

02 Jan 2014

Hi Erik, I had a look at Martin's work last night and will see what degree of compatibility that offers.

But while I enjoy the Arduino platform (the Teensy's native development environment), I prefer the clean OO Mbed platform for my ARM chips :)

Cheers

08 Apr 2014

Hi.

Matt Parsons wrote:

But while I enjoy the Arduino platform (the Teensy's native development environment), I prefer the clean OO Mbed platform for my ARM chips

Me too. The teensy 3.1 modules for small volume production are great. Any possibility to develop my code on any HW even a modified teensy would be ok.

It should be easily possible to convert the mbed bin to a hex for production etc.. (I have some old C source for that, I believe...)

This way development, production programming and updates at the customer site would be possible.

Looking forward to good news regarding the mbed development for teensy 3.1

04 Nov 2014

Hi Erik, hi Martin.

What is the situation right now? I would like to start a customer proyect programming the teensy 3.1 with mbed.

Bin2Hex conversion is not a problem. See:

http://sourceforge.net/projects/bin2hex/

http://www.keil.com/download/docs/113.asp

http://developer.mbed.org/questions/1147/Bin2Hex-Utility-for-64bit-Windows-7/

I can supply C-source code also if really needed. Best Regards.

Eduardo

05 Nov 2014

K20D50M is supported, look at the implementation and see if you can leverage it for your board

https://github.com/mbedmicro/mbed mbed SDK

08 Nov 2014

The Teensy3.1 is really a non starter for Mbed.

I have tried a very simple LED blink code from Mbed, converted to .hex and loaded to the Teensy board but did not work. I may be wrong but looking further it appears to use a boot loader code that clashes with the mbed flash code.

Unfortunately the SWD connections are not accessible to the board so it cannot be programmed from the FRDM board SWD connector either. Unless the Mbed user code can be changed to load and start from a different position in the flash memory map, I can't see this board being used on Mbed.

26 Nov 2014

There is another guy who has not succeded. See: http://forum.pjrc.com/threads/25008-Mbed-API-compatibility-layer

The different crystal may be the issue.

26 Nov 2014

May not be a non starter after all Eduardo, I have it working now, but for the moment this is not really for MBED until confirmed as good to go so click on your link above for further details.

Edit... I have loaded several programs including a large 100k code, checked some embedded peripherals and is working as it should.

/media/uploads/star297/mbed_teensy_test.jpg

Still not sure if there are any issues with NVIC's and bootloader code clashes, but you can try it for now. Don't forget the clock setup to mode-0 in the MBED-SRC lib line 47 (see below):

https://developer.mbed.org/users/mbed_official/code/mbed-src/file/f79a1bf6b233/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c

The button will not reset the device, you will need to power cycle to run your code.

To recap usage:

Save your K20D50M program from Mbed (BIN file)

Open in Hexplorer

Export as an Intel Hex file (ending .hex)

Run teensy.exe program

Open the .hex file

Connect Teensy and press the button

Program

Power cycle the Teensy and it should run.

27 Nov 2014

Brilliant. In the file you pointed out there are two possibilites: changing (as you said)

  1. define CLOCK_SETUP 1 to
  2. define CLOCK_SETUP 0 or changing line 70 from
  3. define CPU_XTAL_CLK_HZ 8000000u to
  4. define CPU_XTAL_CLK_HZ 16000000u

I will test this friday or monday. Thanks a lot for your effort.

By the way. I believe that teensy 3.X is based on a bootloader that is placed in K20 Ram by the companion chip every time you press the button. There is probably nothing fixed in K20 flash that is needed for teensy to work. This is why teensy is so robust. No matter what you write to the K20 flash the companion chip reboots the K20 with a fresh bootloader in Ram everytime you want. I hope this is a correct description.

27 Nov 2014

Not sure if there will be a problem with changing the XTAL define to 16MHz as it may not set the bus prescalers correctly, but I will give it a try.

You may be right about the bootloader, it makes sense. If this is the case then it should work fine.

28 Nov 2014

Now working with 16MHz Xtal currently at 48MHz core, will run at 72MHz but prescalers need changing for correct timers.

29 Nov 2014

Mbed-SRC import for Teensy3.1 now running at 72MHz available here:

http://developer.mbed.org/users/star297/code/MBED-SRC-Teensy31-setup/

Let me know if it works for you I can then send a pull request for this to be added to the Official MBED library.

Only the pins and functions as per the standard platform will work and it will not recognise the additional Flash available. This is only clock source setting changes.

03 Dec 2014

That link gives me a "Page not found". I'd love to try it out...

03 Dec 2014

I took it off for the time being as the interrupt vectors and memory mapping were wrong. I have done this now, added extra pin configurations and currently testing the standard Mbed K20D50M peripherals. All going well, which they are so far, I will update the link in the PJRC forum later today. What will remain is for the ADC and CAN code to be added.I hope to take existing code from the other KLxx platforms.

03 Dec 2014

Thank you very much, Paul. Code for using DMA would be a nice addon. Is that available for the other Freescales?

03 Dec 2014

I would look here, you could ask a question for more details.

https://developer.mbed.org/users/Sissors/code/SimpleDMA/

03 Dec 2014

Looks good, thanks a lot. I'll check it out ASAP

03 Dec 2014

Had post ready but forgot to post, now too late :P

26 Jan 2015

Paul, did you had a chance to propose an update in the PJRC forum. I could not find it ? Thanks for your help.

26 Jan 2015

It has been pulled into the Mbed-SRC where you can see it now, waiting to be available on the Platforms page that should happen soon. Its also available on the Mbed GIt Hub if you want to use offline compiling. I will update the PJRC forum page to that effect.

28 Jan 2015

Paul,

Thanks for your answer.

I compile latest version with arm-gcc 4.8 (from launchpad.net) and 4.9 (Terry Guo PPA) but the blinky example does not start. I can neither run Blinky on FRDM-K20 I am on linux ubuntu 14.04 and it's working for my KL25Z.

Do you have any clue because I am stuck ...

Thanks again for the great job.

28 Jan 2015

ARM GCC is known to not work for both FRDM and Teensy. I don't use it myself, so someone elses problem (or the nicer way to put it, hard to fix something you don't use).

The Keil compiler and exporter both do work properly, but I don't think Keil is available on Linux. It would be the same as what the online compiler uses, so someone needs to figure out why it does not work on GCC.

28 Jan 2015

@Jacques

https://github.com/mbedmicro/mbed/issues/845, reported, currently open. If you find a cause, please share it there or better ,send a pull request on github.

28 Jan 2015

@Martin @Erik

Sorry I should have googled a little more to find the bug report.

This is strange because teensyduino uses arm gcc. (It's a 4.7 series). I will try with this version and check all the compile flags ... and switch to FRDM-K22F very soon.

Thanks for your help.

28 Jan 2015

@Martin @Erik

Sorry I should have googled a little more to find the bug report.

This is strange because teensyduino uses arm gcc. (It's a 4.7 series). I will try with this version and check all the compile flags ... and switch to FRDM-K22F very soon.

Thanks for your help.

23 Jul 2015

Paul Staron wrote:

It has been pulled into the Mbed-SRC where you can see it now, waiting to be available on the Platforms page that should happen soon. Its also available on the Mbed GIt Hub if you want to use offline compiling. I will update the PJRC forum page to that effect.

Do you have links to the PJRC forum thread?

23 Jul 2015

Its here Jim:

https://forum.pjrc.com/threads/25008-Mbed-API-compatibility-layer

and here is a preview of the Mbed platform page, waiting for some testing to be completed before it can go live.

https://developer.mbed.org/platforms/teensy-3-1/

23 Jul 2015

Paul Staron wrote:

waiting for some testing to be completed before it can go live.

For the last half a year roughly.

Btw since I have it added via a beta option I can't test it myself, but if there is no add button you can just add "/add" after the url to add it.

23 Jul 2015

I have it on good assurance that the Mbed team have been working on it non stop, testing it solidly. If you want something good you have to wait for it Erik, otherwise you end up crap (sorry did I say crap, I meant ST)