Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Teensy2++ external power and use without USB

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    16

    Teensy2++ external power and use without USB

    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

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,750
    Quote Originally Posted by heimi View Post
    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;
    }

  3. #3
    Junior Member
    Join Date
    Nov 2013
    Posts
    16
    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?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •