Page 1 of 1
Teensy Support ?
Posted: Wed Aug 24, 2011 12:57 am
by itain
How about porting to a
Teensy?
Main issue IMHO will be with using the serial port. Host interface can be either USB or USART1. Current code has a contains both direct access to USART0 and using the Serial library.
USART0 does not exist on the Teensies.
The teensyduino Serial library is using the USB.
The teensyduino Uart library is using the UART1.
Otherwise, only remap the IO pins and go. The Tensy2.0 has a few pins more than the arduino mini.
The Teensy2.0++ has about the same pin count as the arduino mega, in a smaller board.
-- Itai
Re: Teensy Support ?
Posted: Sat Sep 10, 2011 9:01 pm
by cass3825
Itai,
Sorry for the late reply. I have looked into this in the past, and the downside of the Teensy processor is the reduced number of pins that utilize 'pin change' interrupts, which the multiwii code uses. I'm a big fan of the Teensy, but it's not a good fit for this project.
Regards,
Billy
Re: Teensy Support ?
Posted: Sun Sep 11, 2011 4:16 am
by timecop
One word,
PPM
Re: Teensy Support ?
Posted: Tue Sep 13, 2011 12:05 am
by wapko
i have a couple of teensy boards and would love a port.. ppm would solve the pin change interrupt issue. another is the timer regs. they also differ..
i'm not that well versed in mcu's.. especially timers and such.. i can blink leds no problem, wont get me flying however..
maybe i should try and read up on timers in different atmels.. i've been meaning to for quite a while.
anybody with the knowledge to change the timers to correspond to the ATMEGA32U4 and AT90USB1286 mcus ?
if youre in EU and want to avoid import duties,
www.floris.cc should have teensy boards..
Re: Teensy Support ?
Posted: Wed Sep 14, 2011 4:19 pm
by ciskje
Taken from Baronpilot:
B0, B1 B2 B3 B4 have PCINT also on Teensy 2.0+
Code: Select all
void setupRx() {
#ifdef TEENSYP
pinMode(PIN_B0,INPUT);
pinMode(PIN_B1,INPUT);
pinMode(PIN_B2,INPUT);
pinMode(PIN_B3,INPUT);
pinMode(PIN_B4,INPUT);
PCICR |= (1<<PCIE0);
PCMSK0 = (1<<PCINT0) |
(1<<PCINT1) |
(1<<PCINT2) |
(1<<PCINT3) |
(1<<PCINT4) ;
#else
pinMode(2, INPUT); // 3 is used for esc
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
// interrupt on pin change PCINT
PCICR |= (1 << PCIE2);
PCMSK2 = (1 << PCINT18) | // pin2
(1 << PCINT20) | // pin4
(1 << PCINT21) | // pin5
(1 << PCINT22) | // pin6
(1 << PCINT23) ; // pin7 // not need if you don't use RXDIRECT
#endif
for(int i=0;i<MAXCHANIN;i++)
rawIn[i]=CENTER;
}
Re: Teensy Support ?
Posted: Wed Sep 14, 2011 7:09 pm
by itain
I'm looking at the Teensy 2.0 (ATMega32U4). There are 8 "pin change interrupt" pins and 4 16-bit pwm outputs. 3 of which are conflicting so it's possible to use 5 channel receiver and 4 "high res pwm" outputs for the motors.
With little effort it's also possible to use the two input compare pins for channels 6 & 7, and then one 8-bit pwm and one 10-bit pwm.
It should be OK to use PB0, PB1, PB2, PB3, PB4 for the radio and PB5, PB6, PB7 and PC6 for the motors.
Haven't yet completed checking the Teensy 2.0++ (AT90USB1286). There are still only 8 PCINT inputs but more PWM outputs.
Re: Teensy Support ?
Posted: Tue Dec 20, 2011 1:42 am
by ziss_dm
Hi itain,
Did you make any progress on this port?

Could you please share your ideas on pin assigment?
regards,
ziss_dm
Re: Teensy Support ?
Posted: Tue Dec 20, 2011 10:41 am
by UndCon
I had a Teensy++ (2.0) and I sold it as timelapse remote for Nikon cameras

Re: Teensy Support ?
Posted: Wed Dec 21, 2011 12:50 am
by ziss_dm
Hi,
This is powerful remote..

I have played with Teensy++ 2.0, yesterday and managed to compile 1.8 with following configuration:
6 PWM (motors)
5 receiver channels (PCI interrupt)
GUI -> USB serial
HW TWI
With little effort, I think it would possible to get:
8 PWM (with soft TWI)
8 receiver channels (external interrupts)
Not sure, Is it worth it..

But I like 128K flash and 8K SRAM... And USART is free.
regards,
ziss_dm
Re: Teensy Support ?
Posted: Sat Dec 24, 2011 11:26 am
by UndCon
Actually it is not only timelapse - it is also works a camera dolly powering 2 motors so far (a 3rd might be added)
It is programmable by the leftover joystick from nunchuck and a few buttons
And it features a 2*16 LCD
On the wishlist is "waypoint-like" navigation where you preset a few directions for the camera 3-5 positions or so...
I am currently working on the LCD backend for menues.
//UndCon
Re: Teensy Support ?
Posted: Fri Jan 20, 2012 12:12 pm
by ronco
Hi,
it may be possible to flash the arduino leonardo bootloader on the Atmega32u4 Teensys ..
see this instrucktion (just the flash to leonardo part)
http://txapuzas.blogspot.com/2009/12/pa ... duino.htmli dont speak spain? but what i understand:
connect a normal arduino to the Atmega32u4 like this:
- uncomment the arduino leonardo parts in the arduino/hardware/boards.txt (remove the # in front of the lines) (arduino 1)
- upload to the normal arduino the sketch arduino/examples/ArduinoISP (arduino 1)
- go to tools -> programmer select Arduino as ISP
- keep the normal arduino connected and select tools->board->arduino leonardo
- select tools->burn bootloader
(not shure)
ill test this if i get my Atmega32u4 board
i made a Atmega32u4 - to leonardo pin image(also not shure if its right)
.. and i ordered one of the Atmega32u4 breakouts

if we do it like this we can use the arduino IDE and if the real leonardo becomes available we have support for it

Regards Felix
Re: Teensy Support ?
Posted: Sun Apr 29, 2012 10:43 am
by ronco
Hi,
i added a teensy 2.0 support to the actual shared trunk. its not much code because the ATmega32u4 is already there for the ProMicro
to use the teensy with teensduino instead of loading the leonardo bootloader i had to change some small things.
here is a fast pinout for it:
i will do a wiki for both (teensy2.0 and Promico) soon.
regards Felix
Re: Teensy Support ?
Posted: Sun Apr 29, 2012 2:15 pm
by PaulStoffregen
Hi, Paul here, from PJRC -- the guy who made Teensy.
Please please please:
Do NOT flash the Leonardo bootloader onto Teensy!!
The Leonardo bootloader (of the Sparkfun ProMicro) does not work with Teensyduino.
The Leonardo code has known USB bugs, which don't affect everyone, but when they do happen, it's no fun. There's a very good reason Sparkfun's web page says "this bootloader is still in its infancy so expect some glitchiness here and there"! And frankly, it's pretty astounding Sparkfun sells such a product where even the Arduino Team refuses to officially release Leonardo, even though they showed the Leonardo hardware at Maker Faire last last year. They know the software isn't ready. There's a very good reason they removed the examples and commented the lines in boards.txt before releasing Arduino 1.0.
Teensyduino is very stable and well tested, with over 3 years of widespread use.
Felix has done great work here. Just uncomment TEENSY20 to work with Teensyduino, and please ignore these many messages about reflashing bootloaders.
Re: Teensy Support ?
Posted: Tue May 01, 2012 1:00 pm
by ronco
Hi,
My first teensy board is complete now

it looks like everything works well (atm. just on the ground) ill do some flight tests soon .. but i think it will behave just like the promicro does.
the good things on it (compared with the sparkfun promicro) are:
- it has all pins of the ATmega32u4 broken out (6 hardware PWM outputs, 6 RX channels with a free Serial port possible)
- it has a miniUSB (not a micro)
- its bootloader loads up very fast (~0.5 sec)
- it is smaller
- it is cheaper
its just the 5 LDO and the usb power fuse that is better on the Promicro (on the bottom of the teensy is a footprint for 5 or 3,3v LDOs)
my ATM. unused ATmega32u4 colletion

(the teensy fits well to it)
Re: Teensy Support ?
Posted: Sun Jun 17, 2012 8:55 pm
by KoekieMonster
Hi,
I've followed above pinout diagram for teensy but can't get my yaw servo to move.
all 3 motors work, just the servo doesn't.
I'm using gyro, acc and mag. and using dev build 20120504.
I am using HWPWM6 and I did uncomment the #define TEENSY20.
does anyone know why my tail servo isn't moving?
KoekieMonster.
Re: Teensy Support ?
Posted: Tue Jun 19, 2012 3:45 pm
by ronco
hi,
ill check this soon.. and fix it if needed
regards Felix
Re: Teensy Support ?-NanoWii
Posted: Sat Jun 23, 2012 11:49 am
by polo_fly2
Hello,
I have exact the same issue like KoekieMonster but with a NanoWii and the last dev_20120622. In the Tricopter config the pin (6) is dead - 0V . In the
Bi-copter config the servos (5+6) do move.
I have looked in the code, but my level of understanding does not allow me to find a solution at the moment.
many thanks for any help...
Georg
Re: Teensy Support ?
Posted: Sat Jun 23, 2012 12:52 pm
by ronco
Hi,
it is fixed now in the current dev (shared trunk)
if you want to use it in 2.0 or the released devs.. here is the fix..
replace this (in def.h):
Code: Select all
#define SERVO_5_PINMODE DDRD |= (1<<7); // 6
#define SERVO_5_PIN_HIGH PORTD |= 1<<7;
#define SERVO_5_PIN_LOW PORTD &= ~(1<<7);
#define SERVO_6_PINMODE DDRC |= (1<<6); // 5
#define SERVO_6_PIN_HIGH PORTC|= 1<<6;
#define SERVO_7_PIN_LOW PORTC &= ~(1<<6);
with this:
Code: Select all
#define SERVO_5_PINMODE DDRC |= (1<<6); // 5
#define SERVO_5_PIN_HIGH PORTC|= 1<<6;
#define SERVO_5_PIN_LOW PORTC &= ~(1<<6);
#define SERVO_6_PINMODE DDRD |= (1<<7); // 6
#define SERVO_6_PIN_HIGH PORTD |= 1<<7;
#define SERVO_6_PIN_LOW PORTD &= ~(1<<7);
there was also a problem with the serial code in the dev20120622
you can fix it by replacing one line in the serialAvailable function in serial.ino
replace this:
Code: Select all
if(port == 0) return T_USB_Available(USB_CDC_RX);
with:
Code: Select all
if(port == 0) return T_USB_Available();
regards Felix
Re: Teensy Support ?
Posted: Mon Jun 25, 2012 10:21 am
by polo_fly2
Halo Felix,
thank you for the new code. It works

- servo is moving now in the Tri- config.
Just another question. Is there any easy way to get the status LED pin ( D13 on ProMini) also on the NanoWii board somewhwre ?
Thanky you
Georg
Re: Teensy Support ?
Posted: Mon Jun 25, 2012 10:59 am
by ronco
hi Georg,
because of some more status LED pin requests i added pin 4 as Status pin in the shared trunk now.
if you like to use it now here is the code

replace the nanowii defines in def.h to this:
Code: Select all
#if defined(NANOWII)
#define MPU6050
#define ACC_ORIENTATION(X, Y, Z) {accADC[ROLL] = -Y; accADC[PITCH] = X; accADC[YAW] = Z;}
#define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] = -X; gyroADC[PITCH] = -Y; gyroADC[YAW] = -Z;}
#undef INTERNAL_I2C_PULLUPS
// move motor 7 & 8 to pin 4 & A2
#define SOFT_PWM_3_PIN_HIGH PORTD |= 1<<4;
#define SOFT_PWM_3_PIN_LOW PORTD &= ~(1<<4);
#define SOFT_PWM_4_PIN_HIGH PORTF |= 1<<5;
#define SOFT_PWM_4_PIN_LOW PORTF &= ~(1<<5);
#define SW_PWM_P3 4
#define SW_PWM_P4 A2
#define HWPWM6
// move servo 3 & 4 to pin 12 & 11
#define SERVO_3_PINMODE DDRD |= (1<<6); // 12
#define SERVO_3_PIN_HIGH PORTD |= 1<<6;
#define SERVO_3_PIN_LOW PORTD &= ~(1<<6);
#define SERVO_4_PINMODE DDRB |= (1<<7); // 11
#define SERVO_4_PIN_HIGH PORTB |= 1<<7;
#define SERVO_4_PIN_LOW PORTB &= ~(1<<7);
// use pin 4 as status LED output if we have no octo
#if !defined(OCTOX8) && !defined(OCTOFLATP) && !defined(OCTOFLATX)
#define LEDPIN_PINMODE DDRD |= (1<<4); //D4 to output
#define LEDPIN_TOGGLE PIND |= (1<<5)|(1<<4); //switch LEDPIN state (Port D5) & pin D4
#define LEDPIN_OFF PORTD |= (1<<5); PORTD &= ~(1<<4);
#define LEDPIN_ON PORTD &= ~(1<<5); PORTD |= (1<<4);
#endif
#endif
.. if you have more questions related to the nanowii .. there is a thread in hardware forum
http://www.multiwii.com/forum/viewtopic.php?f=6&t=1337&p=10137#p10137 .. just to keep this one for the teensy
regards felix
Re: Teensy Support ?
Posted: Mon Jun 25, 2012 11:57 am
by polo_fly2
Hi Felix,
OK. I´ll follow you there ... and thanks a lot .
Georg
Re: Teensy Support ?
Posted: Mon Jun 25, 2012 2:35 pm
by KoekieMonster
yay, servo works, stupid I haven't checked the pinout in the code...
Now, next question:P I would like to use the uart on the teensy for gps, is this allready implemented? or just on the arduino mega?
KoekieMonster.
Re: Teensy Support ?
Posted: Mon Jun 25, 2012 3:33 pm
by ronco
Hi,
The gps should work if you set its serial in the config.h to 1.. it depends on the baro type (if you use a baro) if the sketch fits to it.. the atmega 32u4 has 3.6K less flash because of the larger USB bootloader.
the ms baro takes much more flash then the BMP085..
it fits for sure with a i2c GPS.
regards felix
Re: Teensy Support ?
Posted: Mon Jun 25, 2012 3:37 pm
by KoekieMonster
Hi,
I'm nog using a baro(yet), also since it is a teensy it has the halfkay bootloader(wich only uses(like its name says) 0.5K)
Is the gps status visible in the GUI?
KoekieMonster
Re: Teensy Support ?
Posted: Mon Sep 03, 2012 8:48 pm
by curseur59
Hello,
I'm tring to buid a specific teensy board for multiwii, but some informations don't match code in version 2.1. For example the trigger pin that interact with vbat with fullpin configuration. Please help, i Will post my board for every one. Thanks a lot. Curseur.