How to use a fake Teensy in Arduino / Teensyduino on Linux  

I recently bought a fake/knock off teensy from china. They can be purchased from Dealextreme and others. Problem is, the device is more like a teensy 1.0 but reports as teensy 2.0 to the teensy loader application. So uploading stuff to the fake teensy from Teensyduino does not work.

Fortunately, there also is a teensy loader command line interface ( teensy_loader_cli) that does work with the fake teensy. So all one has to do, is to make Teensyduino use the cli loader instead of the graphical one.

Most of the following code is stolen from here.

First, cd into your arduino directory

Second, edit
/hardware/teensy/boards.txt

and change
teensy2.upload.avrdude_wrapper=teensy_reboot

to
teensy2.upload.avrdude_wrapper=fake_teensy


Third, create a file
/hardware/tools/fake_teensy

with the following contents:
#!/usr/bin/perl
use Getopt::Std;
#print @ARGV;
my %args;
my $hexfile;
my $dfu = "/usr/local/bin/teensy_loader_cli";
my $cpu;
my $hexfile;

getopt('Uflash',\%args);
$hexfile=$args{U};
$hexfile =~ s/flash:w://;
$hexfile =~ s/:i//;
$cpu=$args{c};

#print "\n[" . $hexfile . "]";
#print "\n[" . $cpu . "]\n";
#print "$dfu $cpu erase\n";
#system "$dfu $cpu erase";
print "$dfu -mmcu=at90usb162 $hexfile\n";
system "$dfu -v -mmcu=at90usb162 $hexfile\n";
#system"$dfu $cpu flash $hexfile";
#print "$dfu $cpu start\n";
#system "$dfu $cpu start 1>&2";
#print "\n";

Sorry ... didn't care to pretty up the script. Don't forget to make it executable.

Finally, copy the teensy_loader_cli application to
/usr/local/bin/teensy_loader_cli


That's it ... now you can program your fake teensy from Teensyduino.
The only problem is, that the device does not perform a reset after programming and one hast to do it manually, e.g. cut the power.

[ add comment ] ( 11 views ) permalink print article ( 0 / 0 )
[ 158 comments ] ( 2686 views ) permalink print article ( 3 / 359 )

| 1 |