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

Thread: Teensy 3.1, 3.2 with USB Kiibohd, long reset issue

  1. #1

    Teensy 3.1, 3.2 with USB Kiibohd, long reset issue

    Hi.
    I tested this on both Teensy 3.1 and 3.2.
    I have compiled the Kiibohd controller code and it's running well. It's an USB keyboard controller code.

    The issue is: when I have it running and press reset (to flash new code version) it behaves weirdly. It doesn't start flashing right away.
    I need to press reset a few times and after about 10-16 seconds it finally kicks in and starts flashing.
    If I don't use Kiibohd code (I just comment it out in same project) then it all works normally. Flashing starts right after pressing reset.

    The build (I don't think it matters but just in case) doesn't use Arduino but CMake and makefiles. I use Cygwin on Windows 7 and it works well. Wiki about building is here.
    When the Teensy.exe window is in manual mode it simply doesn't show program and reboot buttons as if the reset function got interrupted or something. In auto mode it just doesn't show anything.
    Going even further I've found out that Output_setup() calling usb_init() suffices to have this issue, and exactly this line
    NVIC_ENABLE_IRQ( IRQ_USBOTG );
    causes it. But it's simply needed to work.

    I've already talked with HaaTa on IRC and he suggests that my interrupts vector in RAM gets overwritten after start.
    And this would also explain why I couldn't get any interrupt timers working (PIT, pit0_isr). They just crash/stop code on first call.

    But I'm not yet that good with such low level issues debugging on mcu's and also don't know what to try next to solve this.
    Any help or ideas would be great. Or how can I check this interrupt vector in runtime?
    Last edited by CryHam; 03-15-2016 at 09:06 PM.

  2. #2
    Right actually I have to press reset once or twice and wait 16 sec to start flashing.
    And this is independent of F_CPU frequency setting.
    Any ideas?
    Is this ResetHandler's fault or bootloader's?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,298
    Do programs uploaded by Arduino start up normally?

  4. #4
    I tested this now. Short answer: yes.
    But this is odd. I had my kiibohd code on Teensy 3.2. Then started Arduino, compiled and pressed upload, it said it needs a manual reset press. I pressed it few times, waited and it never uploaded.
    Then I went back to my kiibohd build, commented out the keyboard code, leaving just an oled demo (which ofc works fine and uploads instantly, without issues).
    Uploaded that, again went back to Arduino and this time it worked normally, uploads each time after upload press (without reset).
    I'm sure something in kiibohd code does something strange which causes it but what should I look for or how to test it?

Posting Permissions

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