I2C on non ARM instruction sets
Posted: Wednesday 11 January 2017 23:23
Hi,
Today I received the: CJMCU HTU21D BMP180 BH1750FVI Temperature Humidity Barometer Light Brightness Sensor
I've build Domoticz for LEDE on a MIPS_24kc instruction-set. (platform: GL.inet 6416) I included the I2C drivers and have a /dev/i2c-0 device which is detecting my sensors:
So I went ahead and included the BMP180. Which went fine, no errors and got my first sensor values. Unfortunately I quickly discovered that this value was not changing. So I looked at the source code:
Which seems to be correct because there is no __arm__ defined. And that's why I'm getting those default values.
However I do not see the "Only supported on ARM architecture!" sentence in the logs. And also having those fake values seems strange to me? why having fake values instead of just none?
My actual question:
Could it be me or is there no ARM specific dependency in the i2c library?
According to this piece of code:
It should just use the /dev/i2c-0 or /dev/i2c-1 port. Which could be present on any instruction set as long as it is running Linux. There is no specific ARM dependency there.
Could someone explain why this could not run on another instruction-set than ARM?
Regards,
Timeless
Today I received the: CJMCU HTU21D BMP180 BH1750FVI Temperature Humidity Barometer Light Brightness Sensor
I've build Domoticz for LEDE on a MIPS_24kc instruction-set. (platform: GL.inet 6416) I included the I2C drivers and have a /dev/i2c-0 device which is detecting my sensors:
Code: Select all
root@lede:~# i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- 23 -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77
Code: Select all
#ifndef __arm__
temperature = 21.3f;
humidity = 45;
#ifndef _DEBUG
_log.Log(LOG_ERROR, "%s: Only supported on ARM architecture!...", szI2CTypeNames[m_dev_type]);
return;
#else
_log.Log(LOG_ERROR, "%s: Only supported on ARM architecture!... Debug: just adding a value", szI2CTypeNames[m_dev_type]);However I do not see the "Only supported on ARM architecture!" sentence in the logs. And also having those fake values seems strange to me? why having fake values instead of just none?
My actual question:
Could it be me or is there no ARM specific dependency in the i2c library?
According to this piece of code:
Code: Select all
I2C::I2C(const int ID, const _eI2CType DevType, const int Port):
m_dev_type(DevType)
{
m_stoprequested = false;
m_HwdID = ID;
m_ActI2CBus = "/dev/i2c-1";
if (!i2c_test(m_ActI2CBus.c_str()))
{
m_ActI2CBus = "/dev/i2c-0";
}
}Could someone explain why this could not run on another instruction-set than ARM?
Regards,
Timeless