I am trying to read in data from a 8-byte shift register. It consistently reads all zeros.
I am referencing this example: https://developer.electricimp.com/api/hardware/spi/readblob
I had my SPI connected to an FPGA but I removed the FPGA and instead just connected a wire from 3V3 to pinB on my imp006. No other hardware connected to pinB
// Configure the SPI bus on an imp006
spi <- hardware.spiXABCD;
spi.configure(SIMPLEX_RX | MSB_FIRST | CLOCK_IDLE_LOW, 400);
hardware.pinD.configure(DIGITAL_OUT);
function read8bytes() {
hardware.pinD.write(1);
// Read some data...
local s = spi.readblob(8);
hardware.pinD.write(0);
// ...and return it
return s;
}
// Log results from the above functions
server.log(read8bytes().tostring());
Expected output: something non zero
Actual output:
2020-08-07 20:31:27-0700 [Status] Downloading new code; 0.26% program storage used
2020-08-07 20:31:27-0700 [Device] binary: 00 00 00 00 00 00 00 00