- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I'm trying to connect the Honeywell differential pressure sensor (SSCDRRN005PD2A5) with PSOC4 using the I2C.
https://sensing.honeywell.com/SSCDRRN005PD2A5-amplified-board-mount-pressure-sensors
I want to acquire the pressure sensor values and send it to the computer through UART. The UART connection is working, but I'm not able to acquire any pressure values. I am trying to follow the document below showing the i2C protocol. I changed the slave address to 0x28 and am trying to read two bytes from register 0x01.
Part of my code is below and I also attached the full files. Thank you for your help.
int main()
{
int32 status;
int x_value;
int y = 200;
char str[20];
CyGlobalIntEnable;
I2C_Start();
UART_1_Start();
CyDelay(100);
// UART Connection
UART_1_UartPutString("UART Connected");
int32 Status;
uint8 x0,x1;
Status = I2C_I2CMasterSendStart(ADXL375_ADDR , I2C_I2C_WRITE_XFER_MODE, TIMEOUT_MIO);
Status |= I2C_I2CMasterWriteByte(REGISTER_DATAX0, TIMEOUT_MIO);
//Status |= I2C_I2CMasterSendStop(TIMEOUT_MIO);
for(;;)
{
Status |= I2C_I2CMasterReadByte(I2C_I2C_NAK_ADDR, &x0, TIMEOUT_MIO);
Status |= I2C_I2CMasterReadByte(I2C_I2C_NAK_ADDR, &x1, TIMEOUT_MIO);
//int32 status1 = (x0 & 0xc0) >> 6;
x_value = ((x0 & 0x3f) << 😎 +x1;
int Pmax = 5;
int Pmin = -5;
int Output_max = 16384;
int Output_min = 8224;
int p = ((x_value - Output_min)*(Pmax - Pmin))/(Output_max-Output_min)+Pmin;
itoa(p, str, 10);
UART_1_UartPutString("\r\n p = ");
UART_1_UartPutString(str);
CyDelay(500);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi hewo_3702871
Can you probe the line and check if I2C communication is happening? You can also check the return status from the I2C_I2CMasterWriteByte to make sure I2C communication is working as expected.
As I see from the datasheet, sending 0x01 to the device will set it to "device in command mode" (please confirm if this is the case). And if so, you can just read the data by using the I2CM_I2CMasterReadBuf to read all 4 bytes and perform the calculation.
Thanks,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi hewo_3702871
Can you probe the line and check if I2C communication is happening? You can also check the return status from the I2C_I2CMasterWriteByte to make sure I2C communication is working as expected.
As I see from the datasheet, sending 0x01 to the device will set it to "device in command mode" (please confirm if this is the case). And if so, you can just read the data by using the I2CM_I2CMasterReadBuf to read all 4 bytes and perform the calculation.
Thanks,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Can you test with my sample?
You may need to change the target device and pins for I2C.
MCU Tester, a Swiss Army Knife for PSoC (CY8CKIT-044 version)
If i2c > scan command reports your sensor, the hardware connection should be fine.
Then in the i2c prompt, try "readregs <reg_x0_address> 4"
moto