Okay this is the code after those changes and I am still seeing all zeros:
#include <SPI.h>
#include <stdint.h>
//*******Arduino MICRO SPI pins********
#define SS1 2
byte dataBuffer[8];
void setup() {
pinMode(SS1, OUTPUT);
pinMode(SS, OUTPUT);
digitalWrite(SS1, HIGH);
digitalWrite(SS, HIGH);
Serial.begin(9600);
SPI.begin;
}
void loop() {
//Sensor 1
delay(20); //MLX90333 startup takes 16ms
SPI.beginTransaction(SPISettings(160000, MSBFIRST, SPI_MODE1)); //320000 is about max
delay(5);
int j;
for (j=0; j<10; j++){
digitalWrite(SS, LOW);
delay(20); //Short delay necessary here
int i;
for (i=0; i<8; i++){
dataBuffer[i] = SPI.transfer(255); // Must transfer 1's, 0's don't work
}
digitalWrite(SS, HIGH);
SPI.endTransaction();
Serial.print(dataBuffer[2],8); //Print 3rd byte, MSB for Alpha
Serial.print(", ");
Serial.print(dataBuffer[4],8); //Print 5th byte, MSB for Beta
Serial.print(", ");
}
//Sensor 2
delay(20); //MLX90333 startup takes 16ms
SPI.beginTransaction(SPISettings(160000, MSBFIRST, SPI_MODE1)); //320000 is about max
delay(5);
for (j=0; j<10; j++){
digitalWrite(SS1, LOW);
delay(20); //Short delay necessary here
int i;
for (i=0; i<8; i++){
dataBuffer[i] = SPI.transfer(255); // Must transfer 1's, 0's don't work
}
digitalWrite(SS1, HIGH);
SPI.endTransaction();
Serial.print(dataBuffer[2],8); //Print 3rd byte, MSB for Alpha
Serial.print(", ");
Serial.print(dataBuffer[4],8); //Print 5th byte, MSB for Beta
Serial.print(", ");
}
}
My MOSI has a very low voltage and not much reaction to applying a field. Also when I look at the clock (SCLK) I see a voltage change when I apply a field to first sensor but not the second sensor.. shouldn't there be no reaction here?