Other Parts Discussed in Thread: TMP100, TMP006
I am unable to get temperature readings from the TMP100. I am using EUSCI B2. In tracing my code ( using as much of the Driverlin APIs as possible).
ADD0 AND ADD1 lines are grounded on the chip
I have included a screen shot of the SCL and SDA waveforms when i call: TMP100SendData( data_buffer, SlaveAddress);
in the TMP100Init(...) fucntion the function and execute the line:
MAP_I2C_masterSendMultiByteStart(EUSCI_B2_BASE, buffer[i]); // Send start, address and 1st byte
It appears the code is writing the correct address ( i.e. 0x48, but i see no 'ACK' before sending 0x01 )
SCL - Top plot
SDA - Bottom plot
CODE:
#define TMP100_SLAVE_ADDRESS0 0x48
#define TMP100_RES_12BITS 0x60 // Typically 320ms conversion time
#define NON_SHUTDOWN_MODE 0x00 // Continuous conversion
After setting up the EUSCI_B2 as a Master, I run the following initailization function:
TMP100Init(TMP100_SLAVE_ADDRESS0, TMP100_RES_12BITS | NON_SHUTDOWN_MODE ); // Equiv to TMP100Init( 0x48, TMP100_RES_12BITS | NON_SHUTDOWN_MODE )
void TMP100Init(uint_fast16_t SlaveAddress, uint8_t Config_Reg_Value )
{
uint8_t data_buffer[3];
data_buffer[0] = TMP100_CONFIG_REGISTER; // 0x01
data_buffer[1] = Config_Reg_Value ; // 0x01
data_buffer[2] = 0; // Buffer termination for 'TMP100SendData routine
TMP100SendData( data_buffer, SlaveAddress);
// Reset to reading Temperature
data_buffer[0] = TMP100_TEMP_REGISTER;
data_buffer[1] = 0; // Buffer termination for 'TMP100SendData routine
TMP100SendData( data_buffer, SlaveAddress);
}
void TMP100SendData( uint8_t *buffer, uint_fast16_t SlaveAddress)
{
unsigned int i = 0;
// Specify slave address
MAP_I2C_setSlaveAddress(EUSCI_B2_BASE, SlaveAddress);
// Set Master to transmit mode
MAP_I2C_setMode(EUSCI_B2_BASE, EUSCI_B_I2C_TRANSMIT_MODE);
MAP_I2C_masterSendMultiByteStart(EUSCI_B2_BASE, buffer[i]); // Send start, address and 1st byte
i++;
while( buffer[i] != 0)
{
MAP_I2C_masterSendMultiByteNext(EUSCI_B2_BASE, buffer[i]);
i++;
}
MAP_I2C_masterSendMultiByteStop(EUSCI_B2_BASE); // End Transmission
}