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

Thread: Teensy 4.0 SPI Clock isn't Square at Relatively Low Speeds

Threaded View

  1. #1

    Teensy 4.0 SPI Clock isn't Square at Relatively Low Speeds

    Hey everyone! I have been trying to use SPI on my Teensy4.0 that is running at 600MHz at faster speeds then 5MHz but I can't even manage to get square waves at this speed. The code is a simplified version of what I'm trying to do but the behavior is same in the code provided below and the more cluttered code that I'm using in the actual device. Please take a look at the screenshots and you'll understand what I mean. I captured the waveforms using Saleae Logic Pro 16 Logic analyzer.

    How can I manage to get cleaner signals here?
    Thank you very much for your answers.

    Edit: I'm using the latest Teensyduino software

    1.5MHz SCK
    Click image for larger version. 

Name:	1.5MHz.jpg 
Views:	34 
Size:	27.7 KB 
ID:	25318
    2.5MHz SCK
    Click image for larger version. 

Name:	Screen Shot 2021-07-22 at 12.55.29 AM.jpg 
Views:	32 
Size:	27.2 KB 
ID:	25317
    5MHz SCK
    Click image for larger version. 

Name:	5MHz.jpg 
Views:	32 
Size:	29.8 KB 
ID:	25319
    Capture Config & Device
    Click image for larger version. 

Name:	Screen Shot 2021-07-22 at 12.59.34 AM.png 
Views:	32 
Size:	193.2 KB 
ID:	25320


    Code:
    #include "SPI.h"
    //#include <SPI.h> gives the same result
    
    SPISettings spiWrite(5000000, MSBFIRST, SPI_MODE0);
    byte printBytes[2] = {0, 0};
    void setup() {
      SPI.begin();
      // put your setup code here, to run once:
    
    }
    
    void loop() {
      SPI.beginTransaction(spiWrite);
    
      SPI.transfer(printBytes[1]);
      SPI.transfer(printBytes[0]);
      delayNanoseconds(250);
    
      SPI.endTransaction();
      // put your main code here, to run repeatedly:
    
    }
    Last edited by BlueTurtle; 07-22-2021 at 05:26 AM.

Posting Permissions

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