PDA

View Full Version : Programming a Teensy via Win 7



UNTEngineer
11-26-2012, 04:57 PM
Im having some issues getting the computer to recognize that the Teensy is a Serial Port, so I cant program the Teensy. I also ran into a strange problem with one of my USB cables heating up as soon as I plugged it into the Teensy (I resolved that issue by using another, shorter cable), but I still cant program the Teensy. I know its powered, because the led blinks just fine, and the other devices Ive got powered through the Teensy are all responding. How can I get Win 7 to recognize the device? Im using Arduino 0021 for my code.

Nantonos
11-26-2012, 09:20 PM
How can I get Win 7 to recognize the device? Im using Arduino 0021 for my code.

Install Arduino 1.0.2 and then Teensyduino 1.10.
Your ancient Arduino 0021 is the culprit here I am sure.

UNTEngineer
11-26-2012, 11:22 PM
Install Arduino 1.0.2 and then Teensyduino 1.10.
Your ancient Arduino 0021 is the culprit here I am sure.

Well I had it working fine on my Vista laptop. My Uno programs fine with the Arduino 0022. I'll try these new versions.

Nantonos
11-27-2012, 06:20 PM
Well I had it working fine on my Vista laptop. My Uno programs fine with the Arduino 0022. I'll try these new versions.

Yes, your Uno will run programs compiled with 0.22 and suchlike releases from four years ago. Equally, it runs fine with 1.0.2 released less than a month ago - and benefits from bug fixes. There is no particular beneit to running old beta versions when the Arduino platform has been out of beta for a year or two. You will need to watch out for some 0.22 0.23 to 1.0 changes (Wire.send renamed to Wire.write, Wire.receive renamed to Wire.read).

Teensyduino makes modifications to the Arduino binaries and thus, for safety, only works with specific versions of the Arduino codebase (1.0.1, 1.0.2).

UNTEngineer
11-27-2012, 07:01 PM
Well I tried the latest versions with the Teensy, and still no luck on getting the computer to recognize the COM port. I hear that little sound when I unplug and plug in the Teensy, but Hardware Manager doesnt recognize anything. I know the Teensy itself is functioning because the blink program is running, so I dont have any idea what is wrong.

Nantonos
11-28-2012, 05:32 AM
In the Tools menu, what is your USB type set to?

UNTEngineer
11-28-2012, 09:10 PM
In the Tools menu, what is your USB type set to?

USB Type is set to Serial.

el_supremo
11-28-2012, 09:52 PM
Is it a Teensy 3?

Pete

UNTEngineer
11-28-2012, 09:57 PM
Is it a Teensy 3?

Pete

No. Its a Teensy 2.0.

Nantonos
11-28-2012, 10:51 PM
OK, so what error message do you get when you try to upload a program?

UNTEngineer
11-28-2012, 11:38 PM
OK, so what error message do you get when you try to upload a program?

Nothing. COM port isnt even being recognized by the computer.

PaulStoffregen
11-28-2012, 11:45 PM
First, Teensy is *not* a serial port while programming. It works differently from Arduino Uno. There's more explanation here: (scroll to "No Serial Port While Programming")

http://www.pjrc.com/teensy/troubleshoot.html

Troubleshooting experience using Arduino Uno, where you "look for the serial port to program the code", simply does not apply to Teensy.

When running the bootloader and ready for programming (eg, after pressing the pushbutton), Teensy appears as a HID device with ID 16C0:0478. The Teensy Loader looks for this, not a serial port. You can look for it in the Windows Device Manager, but do not look under "Ports". Here's how to find it in the device manager:

http://www.pjrc.com/teensy/check_halfkay_vista.html

Of course, the simplest thing to do is just run the Teensy Loader and watch the window. When you push the button, the loader should recognize the board and change the gray-blurry image to a clear, color image of the board. There's also a "verbose info" in the help menu (yes, it's hidden in a place nobody ever looks... the help menu) to show you more detailed info about what the Teensy Loader is seeing.

PaulStoffregen
11-28-2012, 11:53 PM
Also, when you program Teensy using Arduino, the Teensy only becomes a serial port when it boots up using your freshly programmed code. So you do NOT select the serial port from the Tools menu before programming. That's not necessary for programming, because in programming mode Teensy is a HID device that's automatically recognized by the Teensy Loader.

When Teensy becomes a serial port, you do need to select the port from the Tools > Serial Ports menu before opening the Arduino Serial Monitor.

However, Teensy can implement non-serial devices (a capability no Arduino board has). Select it from the Tools > USB Type menu. In the modes where Serial isn't selected, a special HID interface is used to emulate serial, so your sketch can still use Serial.print() to send to the Arduino Serial Monitor. You do not need to select the port (and you can't, because it's not a real serial port). Instead it's automatically detected and routed to the Arduino Serial Monitor.

Really, all this stuff should "just work"... but it does break down when people with years of experience troubleshooting traditional Arduino boards depend on the "everything is a serial port" model Arduino uses. Teensy can implement a serial port when the Tools > USB Type selects Serial... but it is not natively a serial port like Arduino.

UNTEngineer
11-29-2012, 01:54 AM
Ok Ok. So I did find it under HID devices. And the loader totally recognizes it.

I set the USB Port Type as RAW HID, and it worked. I managed to upload one of the examples to the Teensy to verify uploading.

Thanks Paul. Its been awhile since I've used the Teensy's, I appreciate the setup reminder.

UNTEngineer
11-29-2012, 03:05 AM
Well I'm still not getting anything over the COM port for serial communication. Im trying to setup this XBee to just send some Serial data for debugging. Is there something special I should be doing?

Im following the image just like it says with pins 2,3 on the XBee shield going to pins 7,8 on the Teensy.

Nantonos
11-29-2012, 08:53 AM
Nothing. COM port isnt even being recognized by the computer.
Well, it won't be recognised as a Serial device until your program (which you uploaded to the Teensy) makes it become one. Remember this is a native USB device, not a 'serial over USB only' device like Arduino.
So, did you try to upload a program?

PaulStoffregen
11-29-2012, 10:31 AM
I can't parse your message. does Serial.print() work at all? if not, focus on that before the xbee.

UNTEngineer
11-29-2012, 07:53 PM
So, did you try to upload a program?

Uhh, yeah. I followed the advice that Paul posted. Uploading a program to it works. I got that, but now Im try to troubleshoot the COM port and Serial communications.


I can't parse your message. does Serial.print() work at all? if not, focus on that before the xbee.

I cant tell if Serial.print() works or not, because the COM port doesnt show up to feed data to the terminal. The code compiled and uploaded to the Teensy just fine (and it works for the most part other than the Serial output debug stuff), so I know the code is good. How should I be setting up the Terminal to view Serial data out of the Teensy?

Nantonos
11-29-2012, 11:05 PM
I cant tell if Serial.print() works or not, because the COM port doesnt show up to feed data to the terminal. The code compiled and uploaded to the Teensy just fine (and it works for the most part other than the Serial output debug stuff), so I know the code is good. How should I be setting up the Terminal to view Serial data out of the Teensy?

I just went through these steps, on Win7, with the Device Manager open. Since it all works for me, could you go through them as well and say when what you see differs from what I see?


Open Device Manager
Launch the Teensyduino environment
Set board to Teensy 2, USB type to serial
Load Examples > Teensy > USB Serial > Hello World
Plug in Teensy. Device manager wil probably show an extra HID device (depends on what sketch was loaded before)
Compile, upload, press Teensy button
Device Manager now shows USB Serial (Communication Class, Abstract Control Model) (COMx)
(in my case that is COM5, see attached image)
Set Serial Port to that number
Open Serial Monitor
Hello World is printed

73

Nantonos
11-29-2012, 11:27 PM
Same thing on Teensy 3.0, which re-used COM5. Apparently multiple USB Serial devices can share a USB Serial COM port number.

UNTEngineer
11-30-2012, 01:43 AM
Programming it works. Windows wont recognize the Teensy as a COM port.

PaulStoffregen
11-30-2012, 01:50 AM
Try running the serial installer. Even if you're previously run it, the installer marks the registry device nodes to be refreshed by the new hardware wizard... so many of the funky problems that can happen with Windows get fixed when the unplug and reconnect.

The serial installer is on this page:

http://www.pjrc.com/teensy/td_download.html

UNTEngineer
11-30-2012, 02:00 AM
Try running the serial installer. Even if you're previously run it, the installer marks the registry device nodes to be refreshed by the new hardware wizard... so many of the funky problems that can happen with Windows get fixed when the unplug and reconnect.

The serial installer is on this page:

http://www.pjrc.com/teensy/td_download.html

Tried that. Still nada.

PaulStoffregen
11-30-2012, 02:34 AM
Well, you've double checked Tools > USB Type is Serial, and it's obviously running the sketch, and the USB works because you can reprogram the board. Is that all correct?

When it's begins running the sketch, does *anything* new appear in the Windows Device Manager. It's obviously implementing a serial device, so something should show up.

UNTEngineer
11-30-2012, 03:29 AM
Well, you've double checked Tools > USB Type is Serial, and it's obviously running the sketch, and the USB works because you can reprogram the board. Is that all correct?

When it's begins running the sketch, does *anything* new appear in the Windows Device Manager. It's obviously implementing a serial device, so something should show up.

Yes to the first three questions. The sketch gets uploaded fine and it runs just fine. The Device Manager shows it as a HID but not as a COM port. I should be able to get it to show up as a COM port to actually view something on the serial terminal. But its not doing that.

Aargh
12-02-2012, 05:16 AM
I have just had a very similar problem as UNTEngineer. Turns out it was a problem with my code causing the Teensy to hang (an eternal growing String), which for some reason meant the computer couldn't see it as a com port. Very frustrating as all of my troubleshooting Serial.print()'s weren't working! In my case, If I loaded the file which had the error in it, it caused the com port problem untill I restarted the computer, so even if I loaded a sample file, such as DigitalReadSerial, it still wouldn't see the com port! I could however load the "blink" file and see the LED happily flashing away.
For me, I got something along the lines of - Serial port couldn't be opened, try to close other programs using it when trying to open serial monitor.

UNTEngineer
12-04-2012, 01:56 PM
I have just had a very similar problem as UNTEngineer. Turns out it was a problem with my code causing the Teensy to hang (an eternal growing String), which for some reason meant the computer couldn't see it as a com port. Very frustrating as all of my troubleshooting Serial.print()'s weren't working! In my case, If I loaded the file which had the error in it, it caused the com port problem untill I restarted the computer, so even if I loaded a sample file, such as DigitalReadSerial, it still wouldn't see the com port! I could however load the "blink" file and see the LED happily flashing away.
For me, I got something along the lines of - Serial port couldn't be opened, try to close other programs using it when trying to open serial monitor.

Just saw this post. I havent had any luck with my code on the Teensy (though, I do know it runs on the Uno). I will have to start from scratch to see if I can catch the problem. Perhaps debugging this code on Atmel Studio 6 might help. Thanks for the insight. I'll post if I get anywhere (or not) with this.

keithg
12-05-2012, 02:29 AM
New thread started

Sorry

UNTEngineer
12-05-2012, 03:48 AM
Paul,

I cannot reliably auto-reboot program any of my teensies (2 or 3) on win 7 x64 (java is 1.7.something). I have never had an issue with any arduino board. I can pretty regularly get them to program after I hit the reset button, but an 'auto-reboot' re-program happens only once in maybe 20 attempts. At one point, I could not communicate the the teensy at all and thought I had blown it. I had to reboot in Linux to program it. I am running the Beta 7 environment under windows 7 64 bit, currently, but it has happened since beta 3.

If I boot the laptop as linux ubuntu 12.04 x64, it works flawlessly, every time.

Is there a log or other diagnostics I can give you?

Keith

I'd appreciate it if you started your own thread rather than hijacking mine. Thanks.