Other Parts Discussed in Thread: TMP126
I have been trying to read from a PIC24 running SPI at 31Khz
Sending a 0x01, 0x0C, 0x00, 0x00 to get Device ID returns 0x21 0x26 as expected.
Sending 0x01, 0x00, 0xFF, 0xFF or any other value in bytes 2 & 3 just returns the byte sent instead of the expected temperature read.
My configuration is written as 0x00, 0x03, 0x00, 0x84 - Average samples, Continuous, 250ms interval
Please help as 6 hours have been lost on this
uint8_t receive_buffer[6] = {0};
uint8_t spi_write_buffer[4] = {0x01, 0x00, 0xFE, 0xFE};
// uint8_t spi_write_buffer[6];
//-- Set bit-0 - Read command.
// set chip select low to start comms
SS_TEMP_SetLow();
receive_buffer[0] = SPI1_Exchange8bit(spi_write_buffer[0]); // read
receive_buffer[1] = SPI1_Exchange8bit(spi_write_buffer[1]); // sub address
UART2_Write(0xFF);
receive_buffer[2] = SPI1_Exchange8bit(spi_write_buffer[2]); // Receive
receive_buffer[3] = SPI1_Exchange8bit(spi_write_buffer[3]); // Receive
SS_TEMP_SetHigh();
UART2_Write(receive_buffer[0]);
UART2_Write(receive_buffer[1]);
UART2_Write(receive_buffer[2]);
UART2_Write(receive_buffer[3]);