I'm using a couple of TMP102 temperature sensors in a project (using IC2 pins 27 & 28). I've noticed that if the temperature sensors are not present then the program halts. I'm trying to find away to prevent this from happening so that I can still use other aspects of the program in the event of a sensor failure. I was also hoping to set up one version of my program but be able to use it with either one or two temp sensors without changing the code.
Anyone know if this is possible? Can I do any kind of error capture in the event that the sensors fail or are not present?
Thanks.
I'm using a couple of TMP102 temperature sensors in a project (using IC2 pins 27 & 28). I've noticed that if the temperature sensors are not present then the program halts. I'm trying to find away to prevent this from happening so that I can still use other aspects of the program in the event of a sensor failure. I was also hoping to set up one version of my program but be able to use it with either one or two temp sensors without changing the code.
Anyone know if this is possible? Can I do any kind of error capture in the event that the sensors fail or are not present?
Thanks.
This searches the bus for connected devices, so it should be obvious how you'd check if a specific device is present.
Hope that works; please say if not, otherwise it'd be great to share your working solution!
Simon
Hi Leo,
Assuming the bus is functional, then you can certainly detect if a device is present. Take a look at:
* http://mbed.org/users/simon/programs/I2CU/
This searches the bus for connected devices, so it should be obvious how you'd check if a specific device is present.
Hope that works; please say if not, otherwise it'd be great to share your working solution!
Simon
You can check for presence of the sensors as mentioned by Simon. However, make sure that you always have the 2 pull-up resistors present on the i2c bus. When they are missing the bus hardware (and software) will hang.
Wim
You can check for presence of the sensors as mentioned by Simon. However, make sure that you always have the 2 pull-up resistors present on the i2c bus. When they are missing the bus hardware (and software) will hang.
Wim
with that combination, if the sensor is missing/broken then the pullups allow the code to detect that, if the sensor is attached and working then the code can detect that and then read the value safely
information about the pullups is here :-
http://mbed.org/handbook/I2C
I've then done a version of TMP102 that includes the code linked above
http://mbed.org/users/simon/programs/I2CU/
with that combination, if the sensor is missing/broken then the pullups allow the code to detect that, if the sensor is attached and working then the code can detect that and then read the value safely
Important Information for this Arm website
This site uses cookies to store information on your computer.
By continuing to use our site, you consent to our cookies.
If you are not happy with the use of these cookies, please review our
Cookie Policy
to learn how they can be disabled.
By disabling cookies, some features of the site will not work.
Access Warning
You do not have the correct permissions to perform this operation.
I'm using a couple of TMP102 temperature sensors in a project (using IC2 pins 27 & 28). I've noticed that if the temperature sensors are not present then the program halts. I'm trying to find away to prevent this from happening so that I can still use other aspects of the program in the event of a sensor failure. I was also hoping to set up one version of my program but be able to use it with either one or two temp sensors without changing the code.
Anyone know if this is possible? Can I do any kind of error capture in the event that the sensors fail or are not present?
Thanks.