Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 31 of 31

Thread: Teensyduino 1.49 Beta #1

  1. #26
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,849
    Quote Originally Posted by defragster View Post
    Paul - this millis() issues on certain set_arm_clock transitions. See: pjrc.com/threads/58053-T4-set_arm_clock-and-micros()
    I've added this to my list of issues to investigate. Not going to hold up 1.49-beta2 for this.

  2. #27
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,125
    Quote Originally Posted by PaulStoffregen View Post
    I've added this to my list of issues to investigate. Not going to hold up 1.49-beta2 for this.
    Indeed it is likely a rare not 'generally' easy to hit problem - and easy to work around. In doing the work on MICROS() using the millis() + CycleCounter timing I never triggered it. If the clock drops/raises in steps - as done in pre-production beta testing - the right thing happens. But once understood it is probably a trivial fix of proper waiting or selective reordering of the speed change process in some odd case.

    Oh speaking of Random - there was a case of something I posted where at a certain speed something failed … almost remembering what it was but not quite? Possibly a post on the SdFAT Beta thread which wouldn't be native PJRC code. Will look to refresh after posting this.

    Yeah - that's what it was: pjrc.com/threads/57669-SdFat-SDIO-for-Teensy-4-0

    SDIO failed at some speeds { F_CPU=151200000 and 24,000,000 } where that code worked otherwise - that was from compile set speed, not dynamic change.

    Which makes me think I didn't try this test with compile speed set on the failed speed points.

  3. #28
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,125
    Follow up to post #27. There is a problem at 24 MHz startup speed switching from power up reset speed - this may explain failed SDIO on SDFat Beta code?

    EDIT UPDATE: Building at 150 MHz start with millis() running right:
    T:\tCode\T4\MicrosONsetArmClk\MicrosONsetArmClk.in o Dec 10 2019 09:14:17

    F_CPU=151200000 deg C=37
    50ms delay:: 50000 us and 49 ms
    IDE speed option doesn't provide 150 MHZ - but it does 24 MHz
    I could edit my build to show 150 MHz - but edited the code {below} to show when compiled at 24 MHz and Edited to do double TimeDiff(); just to see it for sure where all these delays should be 50ms or 50,000us, also added return to 600 MHz and then asked for 150 MHz that gives bad delay:
    Code:
    #if defined(__IMXRT1062__)
    extern "C" uint32_t set_arm_clock(uint32_t frequency);
    #endif
    
    void setup() {
      while ( !Serial);
      Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
      // put your setup code here, to run once:
    #if defined(__IMXRT1062__)
    
      TimeDiff();
      TimeDiff();
      set_arm_clock(240000000); // comment here to get full speed
      TimeDiff();
      set_arm_clock(110000000); // comment here to get full speed
      TimeDiff();
      set_arm_clock(24000000); // comment here to get full speed
      TimeDiff();
      set_arm_clock(600000000); // comment here to get full speed
      TimeDiff();
      set_arm_clock(130000000); // comment here to get full speed
      TimeDiff();
      set_arm_clock(110000000); // comment here to get full speed
      TimeDiff();
      set_arm_clock(24000000); // comment here to get full speed
      TimeDiff();
      set_arm_clock(600000000); // comment here to get full speed
      TimeDiff();
      set_arm_clock(24000000); // comment here to get full speed
      TimeDiff();
      set_arm_clock(600000000); // comment here to get full speed
      TimeDiff();
      set_arm_clock(150000000); // EDITED - this was missing a 0 and was asking for 15 not 150 MHz giving  F_CPU=16200000 below
      TimeDiff();
      TimeDiff();
      Serial.printf("\n DONE \n \t F_CPU=%u", F_CPU_ACTUAL );
      Serial.printf( "\tdeg  C=%u\n" , (uint32_t)tempmonGetTemp() );
    #endif
    
    }
    
    static uint32_t t0;
    
    
    void loop() {
      // put your main code here, to run repeatedly:
    }
    
    void TimeDiff() {
    #if defined(__IMXRT1062__)
      Serial.printf("\n F_CPU=%u", F_CPU_ACTUAL );
      Serial.printf( "\tdeg  C=%u\n" , (uint32_t)tempmonGetTemp() );
    #endif
     while (!(millis()>(t0+1000)));
       t0=millis();
       uint32_t t1=micros(), t2=millis();
       delay(50);
       Serial.printf("\t50ms delay:: %u us and %u ms", micros()-t1, millis()-t2);
    }
    Results BOLD below are where the clocking is off - startup at 24, or switch 600 to 24 or 600 to 150::

    T:\tCode\T4\MicrosONsetArmClk\MicrosONsetArmClk.in o Dec 10 2019 04:16:04

    F_CPU=24000000 deg C=39
    50ms delay:: 1048 us and 1 ms
    F_CPU=24000000 deg C=39
    50ms delay:: 1048 us and 1 ms

    F_CPU=240000000 deg C=39 // going 24 to 24 with set_srm_clock does the right thing - but not on power up reset at 24
    50ms delay:: 50000 us and 50 ms
    F_CPU=110000000 deg C=40
    50ms delay:: 1010 us and 1 ms

    F_CPU=24000000 deg C=40
    50ms delay:: 50004 us and 50 ms
    F_CPU=600000000 deg C=39
    50ms delay:: 50000 us and 50 ms
    F_CPU=129600000 deg C=43
    50ms delay:: 50001 us and 50 ms
    F_CPU=110000000 deg C=41
    50ms delay:: 50001 us and 50 ms
    F_CPU=24000000 deg C=40
    50ms delay:: 50004 us and 50 ms
    F_CPU=600000000 deg C=40
    50ms delay:: 50000 us and 50 ms
    F_CPU=24000000 deg C=43
    50ms delay:: 1048 us and 1 ms
    F_CPU=600000000 deg C=40
    50ms delay:: 50000 us and 50 ms
    F_CPU=16200000 deg C=44
    50ms delay:: 1075 us and 1 ms
    F_CPU=16200000 deg C=40
    50ms delay:: 1075 us and 1 ms
    DONE
    F_CPU=16200000 deg C=40
    Last edited by defragster; 12-10-2019 at 05:19 PM.

  4. #29
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,335
    Quote Originally Posted by PaulStoffregen View Post
    Yes. Please send a pull request. Will probably be in 1.49-beta3, since I'm about to package up beta2...
    @PaulStoffregen
    PR has already been issued for the updated ST7735_t3 lib.

    Do you think you can get the PR incorporated for Wire library in the 1.49-beta2 release or is it too late?

  5. #30
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,849
    Sorry, too late for 1.49-beta2. I'm uploading it right now.

  6. #31
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,335
    Quote Originally Posted by PaulStoffregen View Post
    Sorry, too late for 1.49-beta2. I'm uploading it right now.
    Thanks not a problem should have mentioned it sooner. That's what I get for taking a nap.

Posting Permissions

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