# Is it possible to program the Teensy3.0/3.1/3.2 in C?

I need to program my Teensy3.2 (hasn't arrived yet) in C. Looking at the Teensy pinouts page, the last board for which pinouts for C language are given is the Teensy++ 2.0. Is it still possible to program the Teensy3.2 in C? If so, what are it's pins called in C?

Thanks!

evamvid

Basically the teensy board is a Cortex M4 from Freescale (MK20 family). So you can download the Freescale toolchain and create a project totally in C for the MCU inside the Teensy.

But you need to create a JTAG connection between a debugger and the MCU if you want to debug/program it.

• If I program directly to the MCU, to access the Teensy's outputs, will I just have to figure out which Teensy GPIOs are connected to which pins on the MCU in order to use the Teensy GPIOs? Dec 14 '15 at 13:12
• Untrue about the jtag, and those pins may be difficult to access anyway. Dec 14 '15 at 14:01
• Yes, you should understand the MCU and the GPIO/pins configuration from the Reference Manual of the manufacturer. @ChrisStratton Why do you say it's untrue? The teensy has a bootloader that communicates with the Arduino SW in the PC. If you want to program and debug the MCU with Kinetis Design Studio or any other IDE, you will need the JTAG pins (SWD to be precise) Dec 15 '15 at 11:36
• No, you can use the teensy bootloader and a provided utility to program it from any source. IDE is irrelevant. Further, I think you will find that connecting to the SWD pins is quite complicated as the board was not intended to support that. Dec 15 '15 at 15:43

Yes, they are programmed in C++, but C is a subset of this, so you can just us C.

There default environment is a Java-based Arduino editor and there are some automatically added wrappers that prevent you from having to get involved with the C startup routines for the processor. However, application programs can all be written in C. Here's 'Hello world':

    void setup()   {
Serial.begin(38400);
}

void loop()
{
Serial.println("Hello World");
delay(1000);
}

• well, this is the arduino language, correct? I'm trying to load an already-written software on (TMK Keyboard), which is written in C and compiled into a .hex. Can I do this? Dec 14 '15 at 4:35
• You certainly cannot load .hex files (which were compiled for a different processor) onto a Teensy. You may find that much of the C code is reusable on a Teensy, but some of the core functions will likely need to be modified to work with the different hardware on Teensy. Dec 14 '15 at 4:50
• It would be compiled into a .hex for teensy. It's written for teensy. The processor is specified in the makefile. Dec 14 '15 at 5:01
• I guess what I'm actually asking is, what is the C pinout for Teensy 3.2 (it doesn't seem to be provided on the pjrc website) Dec 14 '15 at 5:01
• I have no idea about what you mean by a 'C pinout'. The Teensy pinouts are shown at pjrc.com/teensy/pinout.html Dec 14 '15 at 5:30