George1988
Member
Hi, I am new to embedded programing recently I bought a Teensie 3.6 board to learn programming for a University project. I was trying to use the SPI library to communicate with an absolute encoder. I have connected MOSI to pin 11, MISO to pin 12 (not needed for the encoder), SCK at pin 13, and CS of the absolute encoder at pin 25. At the same bus I have two other slave device and for this reason I keep pins 10 and 24 high.
I measured with an oscilloscope the output of pin 13 but it seems i am not getting the clock signal as an output. Is there an issue with my code. As a final goal I would like to create a sketch that gives the output data of the abs.encoder in binary form. (Attached is the manual of the encoder not necessary at this point. Between the Teensie board and the abs.encoder i use a differential driver for my clock signal and a differential receiver for the data signals.)
I measured with an oscilloscope the output of pin 13 but it seems i am not getting the clock signal as an output. Is there an issue with my code. As a final goal I would like to create a sketch that gives the output data of the abs.encoder in binary form. (Attached is the manual of the encoder not necessary at this point. Between the Teensie board and the abs.encoder i use a differential driver for my clock signal and a differential receiver for the data signals.)
Code:
#include <SPI.h> // include the SPI library:
const int ssimu = 10;
const int sshand = 24;
const int ssfork = 25;
void setup() {
// set the slaveSelectPin as an output:
pinMode (ssimu, OUTPUT);
pinMode (sshand, OUTPUT);
pinMode (ssfork, OUTPUT);
// initialize SPI:
SPI.begin();
Serial.begin(9600);
}
void loop() {
// take the SS pin high to de-select the chip:
digitalWrite(ssimu,HIGH);
// take the SS pin high to de-select the chip:
digitalWrite(sshand,HIGH);
// take the SS pin low to select the chip:
digitalWrite(ssfork,LOW);
}
Attachments
Last edited: