Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 11 months ago.
Honeywell pressure sensor with I2C
Hello,
I am trying to communicate with honeywell pressure sensor. The sensor is not sending back an ack when the address and r/w bit is transmitted to it. Is there any settings to be done. The datasheet only asks to wait for the ack from the sensor and there are no mentioned settings. The address of my device is 0x38. When I change the slave address to eeprom it works fine.
datasheet: http://sensing.honeywell.com/index.php/ci_id/45841/la_id/1/document/1/re_id/0
snipets from the code:
main code
#include "mbed.h" LPC2468_Init(); // MAM functions ConfigurePLL(); // Setup clocks and PLL LPC2468GPIOInit(); // Set the GPIOs __disable_interrupt(); // disable interrupts during VIC setup LPC2468VICInit(); // Setup VIC init_timer(); __enable_interrupt(); I2C_Init(); // Init I2C0 interface // here should be the data from I2C slave finally I2CnBytes = 2; I2C_access = 0; // write access I2C_sendbyte[0] = 0x38 + 0x00; // address byte, 0x00 means write access I2C_sendbyte[1] = 0x00; // I2C_done = 0; I2C_StartTransmission(); // Set start flag, I2C data transfer is then operated by interrupts while (I2C_done==0) {}; // wait for I2C communication to complete, I2C_done is set by interrupt for (i=0; i<1000; i++) ; // wait needed for I2C to finish before clearing flags I2C0CONCLR = 0x7C; // clear all flags Sleep(6);
tx init
#include "mbed.h" void I2C_StartTransmission(void) { I2C0CONSET = 0x40; //Set I2C enable flag I2C0CONSET = 0x20; //Set start flag }
Can some one tell me if I am missing some setting for the sensor.
1 Answer
10 years, 7 months ago.
Dear Shena,
If you're sure about pull-up 2k2 resistors on i2c bus then it must be usual "7 bit address issue", Please download "I2C_Debug_for_RealTerm" code and test what address seemd by mbed.. Then change the address in your code as you see on realterm.. This is an example for Honeywell sensor I use;
I2C i2c(p9,p10); ... char data [3]; int oraddr = 0xF1; labelled as 0x78H device !!! ...
i2c.start(); i2c.read(oraddr, data, 2);
...