Teensy2++ external power and use without USB

Status
Not open for further replies.

heimi

Active member
I have an Teensy2++ application (plain C) in HID-mode to extend my very recent DIY RC-transmitter with a USB interface. I want to transmit data from and to the transmitter when plugged into a PC (Mac). In addition, the Teensy does other work in the transmitter. - This works fine on the breadboard, but I want to let it run with USB disabled for reducing power consumption and of course without the PC while using the transmitter outside. On the Teensy I have the pads cut apart and the 2 schottky's plugged in between and to the external (battery) power as explained on the Teensy site.
When started from the external power, the T2 does not work. I think this is the meaning of your annotation '... this will wait forever' in the example code.
Question 1:
Does the teensy loader work if I have not initiated the USB with usb_init() at startup? I couldn't find an answer in the docs for that specific issue.
My intention is to cut the red USB wire of the Mount adaptor inside the transmitter and to use the USB power for a relay to switch off the battery when USB is plugged in. So I could initiate the USB part with an pin change interrupt. Should that work?
Question 2:
How do I deactivate the USB part to reduce power when the USB is detached? Is clearing the USBE and setting the FRZCLK bit sufficent?
Thanks
heimi
 
Does the teensy loader work if I have not initiated the USB with usb_init() at startup?

Yes, but it's impossible to request a reboot via the USB, like Arduino does when you click the Upload button. You'll have to press the pushbutton on Teensy.

How do I deactivate the USB part to reduce power when the USB is detached? Is clearing the USBE and setting the FRZCLK bit sufficent?

Something like this.

Code:
void usb_shutdown(void)
{
        UDIEN = 0;      // disable interrupts
        UDCON = 1;      // disconnect attach resistor
        USBCON = 0;     // shut off USB periperal
        PLLCSR = 0;     // shut off PLL
        usb_configuration = 0;
        usb_suspended = 1;
}
 
Thank you for the quick response. I will try this. I do not work with arduino, I always use the pushbutton.

Does the Teensy detect a newly attached USB cable when the pull-up is disconnected?
 
Status
Not open for further replies.
Back
Top