Question about SPI chip select timing.

Status
Not open for further replies.

warpigs330

Active member
I am testing SPI with the teensy 4.1 with the goal of using the DAC7554 with it. I have not actually hooked them up together yet, as I have just been investigating the SPI signals from the Teensy. I noticed the fall time of the chip select seemed really slow compared to the clock and data, to the point where I would be surprised if it worked. I tried connecting to other pins and just pulling them low, and they all respond this way, even the pins that are currently sending clock and data.

Here is the script I am using, as well as an image from the oscilloscope.
PXL_20210402_020148488.MP.jpg

Code:
#include <SPI.h>

int value1 = 0x8026;
int value2 = 0x0801;
int value3 = 0x8027;
int value4 = 0x0000;

void setup (void)
{
  Serial.begin (9600);
  Serial.println ("Starting");
  digitalWrite(SS, HIGH);  // ensure SS stays high for now
  

  // Put SCK, MOSI, SS pins into output mode
  // also put SCK, MOSI into LOW state, and SS into HIGH state.
  // Then put SPI hardware into Master mode and turn SPI on
  SPI.begin ();

  // Slow down the master a bit
  SPI.setClockDivider(SPI_CLOCK_DIV8);

}  // end of setup

void loop (void)
{
  // enable Slave Select
  digitalWrite(SS, LOW); 

  SPI.transfer (1);   // initiate transmission
  SPI.transfer (11);
  SPI.transfer (22);
  SPI.transfer (33);
  SPI.transfer (44);

  // disable Slave Select
  digitalWrite(SS, HIGH);

delay (1); 
}
 
Thank you! I actually figured this out by using a different example. I should have waited just a bit longer before posting. I got the teensy working with the dac as well and it even works up to 50mhz spi clock. That means it can update all 4 channels at 200khz 12bit resolution! And JLCPCB has tons of them.
 
Status
Not open for further replies.
Back
Top