Community
cancel
Showing results for 
Search instead for 
Did you mean: 
bweve
New Contributor I
1,738 Views

AM2315 i2c temperature/humidity sensor- have you gotten it to work?

I've got one hooked up to the Edison via the arduino dev kit, am using Intel's IoT UPM code for the sensor, and can never get valid responses.

The model/version check show data that changes every call.

The testSensor method tells me there's a timeout and if you ignore that, you never get valid temp/humidity readings (as expected given the timeout error).

Is it just possible I don't have the pins set up correctly? I'm running this:

echo 27 > /sys/class/gpio/export

echo 28 > /sys/class/gpio/export

echo mode1 > /sys/kernel/debug/gpio_debug/gpio27/current_pinmux

echo mode1 > /sys/kernel/debug/gpio_debug/gpio28/current_pinmux

i2cdetect -y -r 6

 

and get this:

./i2cSetupTest.sh: line 1: echo: write error: Device or resource busy

./i2cSetupTest.sh: line 2: echo: write error: Device or resource busy

0 1 2 3 4 5 6 7 8 9 a b c d e f

00: -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- --

 

Regardless of what I try, I can't get the sensor to respond. I also have ONLY ever see "device is busy" or similar error when I try to set it via those command above.

 

Please tell me where I'm misguided.

 

13 Replies
Sergio_A_Intel
Employee
158 Views

Hi,

What image are you using? Have you already seen http://iotdk.intel.com/docs/master/upm/group__am2315.html upm: libupm-am2315 . What UPM version are you using? This error has been reported several times in the community. According to what other users have reported this error appears when you are trying to export a GPIO that is already exported. You can ignore the message, it doesn't affect anything.

Have you already seen http://www.intel.com/support/edison/sb/CS-035275.htm Intel® Edison Boards — Intel® Edison Kit for Arduino* Hardware Guide ?

Sergio

bweve
New Contributor I
158 Views

I believe I have the latest UPM but how can I tell?

-

>You can ignore the message, it doesn't affect anything.

Right, I finally read about that. So at this point, my only issue is with the am2315 code in the UPM.

I suppose I could grab the code from the github source - that would ensure I'm using the latest, right?

Sergio_A_Intel
Employee
158 Views

Hi,

You can check the latest upm version using opkg info upm. The latest version is 0.4.0.

Sergio

Carlos_M_Intel
Employee
158 Views

Hi dethSwatch,

Do you have updates on this?

Did you check your upm version?

Regards,

Charlie

bweve
New Contributor I
158 Views

CMata_Intel Yes- thanks for checking in. I'm now using .4 on both the compiler and the board itself without any different.

opkg list-installed gives:

upm - 0.4.0

mraa - 0.8.1

 

Those the latest, aren't they?

 

After rebooting and running init_i2c.sh (which tells me the lines are , I do:

root@edison:/tmp# i2cdetect -r -y 1

0 1 2 3 4 5 6 7 8 9 a b c d e f

00: -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: UU UU UU UU -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- --

root@edison:/tmp# i2cdetect -r -y 6

0 1 2 3 4 5 6 7 8 9 a b c d e f

00: -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- --

 

3 and 9 crash the system, the rest give "--".

 

Running this code:

for(int i =0; i<256; i++)</span>

{

if(i==9) continue;

printf("%i\n", i);

sensor = new upm::AM2315(i, AM2315_I2C_ADDRESS);

int iError = sensor->testSensor();

if(iError==0)

{

puts("GOT IT");

printf("%i", i);

}

delete sensor;

}

gives:

0

am2315: Error, timeout reading sensor.

am2315: Error, timeout reading sensor.

am2315: Error, timeout reading sensor.

am2315: Model: 0x74b7 Version: 0xb7 ID: 0x128d74b7

am2315: Executing Sensor Test

am2315: Error, timeout reading sensor.

am2315: Humidity/Temp reading was unchanged - warning

am2315: Test complete

 

And so on, but 3 is skipped and 10 crashes to the command line.

 

I've used 10k resistors on both lines as well as 4.7k resistors.

 

I've got 2 of these sensors and have tried them both in various configurations.

 

I also note that the arduino code functions perfectly and that they had to double-up the start command in order to wake it up. In other posts, I've seen that 2 i2cdetect's in a row wake it up, but that hasn't worked for me. Is it possible that the am2315 Edison code is really galileo code used without change and maybe something...

Sergio_A_Intel
Employee
158 Views

And what about the Edison image? What is the output of running configure_edison –version?

Sergio

bweve
New Contributor I
158 Views

What's this indicate? Thanks very much for your help- I'm very appreciative, this is the one thing holding up the product.

root@edison:/# configure_edison --version

159

root@edison:/# configure_edison --latest-version

146

Sergio_A_Intel
Employee
158 Views

Have you already installed this sensor's library? Check https://github.com/adafruit/Adafruit_AM2315 adafruit/Adafruit_AM2315 · GitHub for the installation details.

Sergio

bweve
New Contributor I
158 Views

no, I'm using the IOT UPM version http://iotdk.intel.com/docs/master/upm/classupm_1_1_a_m2315.html here as supplied by Intel.

I HAVE used that code, which works fine with my sensor, on an actual Arduino Uno, but that's clearly not the desire here. I've got my edison attached the Edison arduino dev kit board.

Sergio_A_Intel
Employee
158 Views

Have you tried to connect a logic analyzer to the sensor to see if it's sending data?

Sergio

bweve
New Contributor I
158 Views

I've got it hooked up to my ds1054z oscilloscope and it looks fine as far as I can tell.

However at this point, I believe I'll reimplement with SHT line since that's what I'd prefer if I have to do it from scratch.

It looks like (at the moment) that the MCU will work fine for my purposes.

It'd be a good idea to remove the AM2315 from the list of supported sensors in the UPM- I can't get confirmation that anyone's ever gotten it working on the Edison.

William_P_Intel
Employee
158 Views

This code was written on Galileo. I did find the AM2315 was touchy as far as timing was concerned.

I was having trouble following above, but was the sensor fully functional from the i2cdetect and i2cdump commands? If they are failing, the issue is signaling. As I recall, you do need to be careful for which registers are touched and only hit registers covered in the datasheet. This isn't really an i2c device, but simply implements an i2c like protocol with some tight timing requirements.

In the above dumps, which bus is the AM2315 on?

bweve
New Contributor I
158 Views

It -should- be on i2c bus # 6 according to the docs, but the i2cdetect isn't showing anything on any of the channels.

I wrote more code that iterated through each of the channels 1..9 (except 3, iirc) and nothing was found.

To be honest, I believe I've hit a deadend with the am2315 and will be trying my hand at the sht and the MCU.

If there's no resolution, I'm comfortable with that, but would appreciate it if this was noted in the UPM sensors list so that we can save other people time.

Reply