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

Thread: Teensy 3.5 (maybe 3.1) CPU, BUS and SPI speed experiments

  1. #1
    Member
    Join Date
    Jul 2016
    Location
    Denmark
    Posts
    25

    Teensy 3.5 (maybe 3.1) CPU, BUS and SPI speed experiments

    I am starting this thread so someone can yell at me if i do something stupid and share the results of my experiments, or should this be on the Beta Test thread?

    I started looking at the SPI library and add comments from the data sheet https://github.com/alex-Arc/SPI/blob/doc/SPI.cpp
    on line 166 and 167 CTAR0 and CTAR1 is defined but with frame size 7 and 15 respectively, anyone know why?

    is there a good way to measure the speed of the teensy? i tried this:
    Code:
    unsigned long mics = 0;
    unsigned long micsDiff = 0;
    
    void setup() {
      Serial.begin(9600);
      delay(1000);
      Serial.printf("F_CPU %u   F_BUS %u \n", F_CPU, F_BUS);
    
      mics = micros();
      //delayMicroseconds(1);
      micsDiff  = micros();
      micsDiff -= mics;
      unsigned int measureTime = micsDiff;
      Serial.printf("measured time: %u \n", micsDiff);
    
      mics = micros();
      __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); __asm__("nop\n\t"); 
      micsDiff = micros();
      micsDiff -= mics;
    
      Serial.printf("measured time: %u without measuretime: %u singel cycle: %f*\n", micsDiff, micsDiff-measureTime, (micsDiff-measureTime)/40);
      
      
    }
    
    void loop() {
      
    }
    on at teensy 3.5 at 24 MHz and got:

    F_CPU 24000000 F_BUS 24000000
    measured time: 1
    measured time: 3 without measuretime: 2 singel cycle: 2.484428

    that seems quite a bit of, do
    Code:
    __asm__("nop\n\t");
    not represent one cycle?
    Last edited by alex-arc; 09-26-2016 at 05:21 PM. Reason: more info

Posting Permissions

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