Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 4 FirstFirst 1 2 3 4 LastLast
Results 26 to 50 of 87

Thread: Teensyduino 1.31 Beta #1 Available

  1. #26
    Junior Member
    Join Date
    Sep 2016
    Posts
    8
    Hi Pete,

    I tested the code with Teensy 3.2 with Arduino 1.6.12.

    I found GPIOC_PSOR and GPIOC_PCOR works collect, but GPIOD_PDIR does not works .

  2. #27
    Senior Member
    Join Date
    Nov 2012
    Posts
    951
    It's been a while since I played around with the pins at the hardware level. I can't remember if Paul had a macro which mapped what you are doing onto the Teensy's 3.2 hardware but the ARM chips have a different way of setting/clearing the port pins than the AVR chips do.
    Changing your two macros to this will work:
    Code:
    #define LED_ON (CORE_PIN13_PORTSET = (1<<5))
    #define LED_OFF (CORE_PIN13_PORTCLEAR = (1<<5))
    Pete

  3. #28
    Junior Member
    Join Date
    Sep 2016
    Posts
    8
    Thank you, Pete.

    The mocros works fine.

  4. #29
    Member darioconcilio's Avatar
    Join Date
    Feb 2016
    Location
    Varese, Italy
    Posts
    41
    I corrected my post, T3.2

  5. #30
    Junior Member
    Join Date
    Oct 2016
    Posts
    6
    Hi Paul, I've run into issues with Arduino 1.6.12 and TD 1.31-beta1 on Linux x64 when uploading code to a Teensy 3.6. It brings up the TD loader but the IDE errors out after a couple seconds with this (From the terminal the IDE was launched from):

    Opening Teensy Loader...

    Sketch uses 20,648 bytes (1%) of program storage space. Maximum is 1,048,576 bytes.
    Global variables use 3,964 bytes (1%) of dynamic memory, leaving 258,180 bytes for local variables. Maximum is 262,144 bytes.
    Opening Teensy Loader...
    Unable find Teensy Loader. Is the Teensy Loader application running?
    An error occurred while uploading the sketch
    Opening Teensy Loader...
    Error compiling for board Teensy 3.6.

    The loader does appear but it doesn't actually do anything as far as programming the Teensy. If I click the button on the Teensy the loader will correctly program the Teensy with the updated code, it just seems to be a problem communicating between the IDE and loader. Any suggestions?

    Thanks-
    Larry

  6. #31
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,852
    Do you have any external serial monitor program on USB to the Teensy? If so that needs to be dropped when you compile to upload or the needed communications to the Teensy is blocked from the TeensyLoader and then a button press is required to drop to the bootloader.

    The IDE Serial Monitor does this when it is used.

  7. #32
    Junior Member
    Join Date
    Oct 2016
    Posts
    6
    Quote Originally Posted by defragster View Post
    Do you have any external serial monitor program on USB to the Teensy? If so that needs to be dropped when you compile to upload or the needed communications to the Teensy is blocked from the TeensyLoader and then a button press is required to drop to the bootloader.

    The IDE Serial Monitor does this when it is used.

    I assume you mean another program that opens the USB device like minicom; I am not running any other apps that open the serial port and I haven't modified the bootloader, this is just a copy of the Blink sketch I'm using to test with. Is there a particular programmer I should have selected? I just left it as the default: "AVRISP mkII", since there was no Teensy-specific option.

    Ok. I've done a little more homework on this and it's a little different than what I was expecting. I should also add that I've moved from running the Arduino IDE remotely over the net (Using X11 remote display) to running it on a local system to avoid any weirdness that might cause.
    From what I can tell a fresh, untouched Teensy 3.6 shows up as a raw HID device like /dev/usb/hiddev2 and I have made sure the udev rules were installed from the TD download page. The permissions are correct so opening the device as my user ID is ok. One issue seems to be that there's no way to tell the IDE what port to use (It's grayed out, I expect because there is no /dev/ttyACMx device available). There also seems to be some odd TCP behavior which triggers some messages about syn flooding from the kernel:

    Oct 1 05:38:20 acebrix kernel: [27618.756793] TCP: request_sock_TCP: Possible SYN flooding on port 3149. Sending cookies. Check SNMP counters.


    The IDE prints these messages:

    Opening Teensy Loader...

    Sketch uses 16,812 bytes (1%) of program storage space. Maximum is 1,048,576 bytes.
    Global variables use 2,496 bytes (0%) of dynamic memory, leaving 259,648 bytes for local variables. Maximum is 262,144 bytes.
    An error occurred while uploading the sketch
    Error reading Teensy Loader status! (tpc)This error should never happen (when using Arduino). Please report this to paul@pjrc.com, hopefully with enough information to reproduce the problem so it can be understood and fixed!

    I'm not clear on whether the kernel messages are also associated with some throttling/blocking behavior and I'll have to look into it further. At any rate it isn't quite a clear-cut as I had hoped. For reference these are the options in the IDE under Tools I have selected:

    Board: Teensy 3.6
    USB Type: No USB
    Port <---- (disabled/grayed out)
    CPU Speed: 180 MHz
    Programmer: AVRISP mkII


    My OS info:

    Ubuntu 16.04.1 LTS
    Linux acebrix 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

    |Update|
    I did some research on what causes the kernel messages and adjusted the kernel values:

    net.core.somaxconn (to 2048)
    net.ipv4.tcp_max_syn_backlog (to 2048)

    This eliminates the messages about syn flooding from the kernel, however the error from TD about TCP problems remains and it doesn't have any effect on the core issue.
    |/end update|


    Thanks-
    Larry
    Last edited by lbattraw; 10-01-2016 at 10:13 AM. Reason: updated info on kernel tunables

  8. #33
    Senior Member
    Join Date
    Jul 2014
    Posts
    1,878
    Quote Originally Posted by lbattraw View Post
    I assume you mean another program that opens the USB device like minicom; I am not running any other apps that open the serial port and I haven't modified the bootloader, this is just a copy of the Blink sketch I'm using to test with. Is there a particular programmer I should have selected? I just left it as the default: "AVRISP mkII", since there was no Teensy-specific option.
    I never worried about programmer, so I just ckecked my Arduino/TD setup and the programmer is set to ArduinoISP.
    You could try this one

  9. #34
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,852
    AFAIK :: The programmer selection is ignored on Teensy as TeensyLoader (teensy.exe) is hardcoded during install.

    Indeed 'another program that opens the USB device like minicom' is what I meant. Perhaps you should try that - supposing the Teensy is running a sketch that prints USB output and make sure you have "Tools /USB Type / Serial" selected - like this sketch here :: Can-t-communicate-with-Teensy-3-2-through-Teensyduino?

    I'm on Windows - there may be something else in that post that might help you.

  10. #35
    Junior Member
    Join Date
    Oct 2016
    Posts
    6
    Quote Originally Posted by WMXZ View Post
    I never worried about programmer, so I just ckecked my Arduino/TD setup and the programmer is set to ArduinoISP.
    You could try this one
    Thanks for the suggestion, unfortunately it looks like it ignores which programmer you're using and behaves the same way regardless.

  11. #36
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,852
    Larry: This is your problem. It takes USB coded into the Teensy sketch to respond to the Program request, with No USB the button is required to get its attention:

    Board: Teensy 3.6
    USB Type: No USB

  12. #37
    Junior Member
    Join Date
    Oct 2016
    Posts
    6
    Quote Originally Posted by defragster View Post
    Larry: This is your problem. It takes USB coded into the Teensy sketch to respond to the Program request, with No USB the button is required to get its attention:
    Ok, thanks for the info! Is there a particular value I should choose? I thought that was only for sketches that did specific things as a USB device.

  13. #38
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,852
    I typically use the "Serial" - it allows information/debugging spew to come out. That is the default. Unless you run out of room - not that it is large (though it does create some RAM buffers)- it is always safe to just have resident. If you don't send or receive anything it will sit idle, and if you do send or receive it is DMA controlled and faster than most any other interface on the Teensy with low overhead thanks to the DMA- except the new SDIO 4 bit parallel hardware to read/write from a fast enough card.

  14. #39
    Junior Member
    Join Date
    Oct 2016
    Posts
    6
    Quote Originally Posted by defragster View Post
    I typically use the "Serial" - it allows information/debugging spew to come out. That is the default. Unless you run out of room - not that it is large - it is always safe to just have resident. If you don't send or receive anything it will sit idle, and if you do send or receive it is DMA controlled and faster than most any other interface on the Teensy with low overhead thanks to the DMA- except the new SDIO 4 bit parallel hardware to read/write from a fast enough card.

    Ok, I went ahead and chose Serial and this allows it to present the ACM device /dev/ttyACM0 after programming, which allows me to select that as the port to talk to the Teensy with. Unfortunately it still doesn't help to get it to program the Teensy automatically, I get the "report this error message" every time I restart the IDE and try uploading the blink sketch:

    Opening Teensy Loader...

    Sketch uses 20,648 bytes (1%) of program storage space. Maximum is 1,048,576 bytes.
    Global variables use 3,964 bytes (1%) of dynamic memory, leaving 258,180 bytes for local variables. Maximum is 262,144 bytes.
    An error occurred while uploading the sketch
    Error reading Teensy Loader status! (tpc)This error should never happen (when using Arduino). Please report this to paul@pjrc.com, hopefully with enough information to reproduce the problem so it can be understood and fixed!

  15. #40
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,653
    Sorry you may have mentioned it, but did you install the udev rules as mentioned in the installing teensyduino page? http://www.pjrc.com/teensy/td_download.html

  16. #41
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,346
    Which Linux distro is this?

    Localhost networking is used between the utilities Arduino runs and the Teensy Loader program. This is the first time I've ever heard of it failing on Linux. We get this sometimes with zonealarm on Windows, where it prevents local host communication.

    Teensy Losder has a Verbose Info window under its help menu. Try looking at that. It should print info about the requests coming from Arduino.

    Maybe try on Ubuntu (the only Linux which I actually test and support), or use Mac or Windows for comparison. If you can see a working setup, you'll get a good idea of what that verbose info is supposed to be when things work.

    I'm really curious what's wrong on this Linux system. Usually Linux problems are things like missing libs and udev rules.

  17. #42
    Junior Member
    Join Date
    Oct 2016
    Posts
    6
    Hi Paul, I'm actually running Ubuntu 16.04.1 LTS (x86-64), so that shouldn't be an issue. The Teensy loader freezes up when it's started from the Arduino IDE; if I click the button on the Teensy it will go through the steps of programming it, but it doesn't respond to keyboard/mouse input. I was just playing around with it and it seems to buffer the keys/clicks until it programs the Teensy, where it will then process them before going back into that frozen, unresponsive state. After using the Teensy button to force it to reprogram the same file over and over I managed to get the logs saved to a file, which I have attached, hope that may help.

    I've used other Teensy 3.1 boards before so it isn't so much a new environment, it just doesn't work currently. I've previously installed your udev rules and don't see anything that would tend to point towards missing libraries/dependencies.

    |Update|
    I've tried launching the loader without the Arduino IDE and it seems to be acting the same way-- by default when launched it freezes and doesn't respond to keys/clicks. Clicking the button on the Teensy "wakes" it up and it becomes responsive until an action is selected. I've included a second log from the console output that I've annotated to show what happens at what point.

    I've also noticed a rather odd behavior that occurs while the loader is running: it will suddenly grab focus and acts like I'm trying to move it (a 4-way arrow mouse pointer appears). This happens every couple minutes but I'm not sure what's going on since no messages are logged-- very strange. I'm using KDE as my desktop by the way; I tried it with MATE and the behavior is identical.



    Thanks-
    Larry
    Attached Files Attached Files
    Last edited by lbattraw; 10-02-2016 at 12:45 PM.

  18. #43
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,346
    Any chance you could try it with the default unity desktop? Or with gnome.

    Honestly, I have never tested it (or any software I've written) with KDE.

  19. #44
    Senior Member jimmayhugh's Avatar
    Join Date
    Nov 2012
    Posts
    168
    Just FYI, I'm running Debian 8 x64 with the MATE (Gnome 2) desktop with no issues.

  20. #45
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,346
    When you say the software is unresponsive to clicks, can you be more specific about exactly what you're clicking?

    Most of the time, the toolbar icons are disabled, so only a coulpe places are supposed to be responsive under most normal conditions. The new file icon (a document icon with purple hue) is always supposed to be enabled. When you click it, a file open dialog is supposed to appear, to let you open a different hex file. Normally with Arduino this is never needed, since Arduino automatically tells it to open the most recently compiled file.

    Anyway, the point is to establish if the gui really is frozen, or if it merely appears that way because most of the controls are not enabled when no Teensy is connected *and* in programming mode.

  21. #46
    Junior Member
    Join Date
    Sep 2016
    Posts
    8

    Question about how to set the FTM

    I am learning about how to use the FTM. Unfortunately, I could not find the way to capturing
    the counter value from FTM0_CH0/CH1. The counter itself works correct, but the value of
    FTM0_C0V/C1V are always zero.

    Is there anybody konw how to use the ALT4 pins in the correct way?


    /* FTM Capture Test */

    #define LED 13 // LED on D13
    #define LED_ON (CORE_PIN13_PORTSET = (1<<5))
    #define LED_OFF (CORE_PIN13_PORTCLEAR = (1<<5))

    #define buttonPin01 5 // Button Pin on D5
    #define buttonState (CORE_PIN5_PINREG & (1<<7))
    #define buttonMask (CORE_PIN5_BITMASK = (1<<7))

    #define statePin01 22 //
    #define statePin02 23 //
    #define PC_STATE1 (CORE_PIN22_PINREG & (1<<1))
    #define PC_STATE2 (CORE_PIN23_PINREG & (1<<2))

    uint8_t state1 = 0;
    volatile int state = LOW;
    uint16_t readCount1 = 0;
    uint16_t readCount2 = 0;

    void setup() {
    FTM0_FILTER = 0x07;
    FTM0_MODE = 0x05;

    FTM0_SC = 0x00; // Set zero
    FTM0_CNT = 0x0000; // Reset the count to zero
    FTM0_MOD = 0xFFFF; // max modulus = 65535
    FTM0_SC = 0x0A; // TOF=0 TOIE=0 CPWMS=0 CLKS=01 PS=010 (divide by 4)
    FTM0_CNTIN = 0;

    FTM0_C0SC = 0x48; // CHF=0 CHIE=1 MSB=0 MSA=0 ELSB=1 (input capture) ELSA=0 DMA=0
    FTM0_C1SC = 0x48; // CHF=0 CHIE=0 MSB=0 MSA=0 ELSB=1 (input capture) ELSA=0 DMA=0

    NVIC_ENABLE_IRQ(IRQ_FTM0);

    CORE_PIN22_CONFIG = PORT_PCR_MUX(4);
    CORE_PIN23_CONFIG = PORT_PCR_MUX(4);

    Serial.begin(115200);

    pinMode(LED, OUTPUT);
    pinMode(buttonPin01, INPUT_PULLDOWN);
    pinMode(statePin01, INPUT_PULLDOWN);

    attachInterrupt(buttonPin01, blink, HIGH);
    attachInterrupt(statePin01, count, RISING);
    }

    void loop() {
    state1 = buttonState;
    if(state1 == LOW) {LED_OFF;}
    else {LED_ON;};
    }

    void blink() {
    LED_ON ; // turn the LED on (HIGH is the voltage level)
    delay(100); // wait for a second
    LED_OFF ; // turn the LED off by making the voltage LOW
    delay(100); // wait for a second

    readCount2 = FTM0_C1V;
    Serial.println(readCount2);
    }

    void count(){
    LED_ON ; // turn the LED on (HIGH is the voltage level)
    delay(100); // wait for a second
    LED_OFF ; // turn the LED off by making the voltage LOW
    delay(100); // wait for a second
    readCount1 = FTM0_CNT;
    Serial.println(readCount1);
    }

  22. #47
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,534

  23. #48
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,852
    Cool - does it work on K66 and K64?
    #if (!defined(FastIR_h)) && (defined(__MK20DX128__) || defined(__MK20DX256__))

  24. #49
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,534
    Ooops.. it's so old.. did not think of it

  25. #50
    Junior Member
    Join Date
    Sep 2016
    Posts
    8
    Thanks Frank,

    but addressing 0x410 does not works.

Posting Permissions

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