Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: Shakipu on July 06, 2014, 06:39:33 PM

Title: [SOLVED] i2cdetect doesn't detect anything
Post by: Shakipu on July 06, 2014, 06:39:33 PM
Hello everyone,

I got a few sensors I would like to plug to my A20 (without NAND, Rev.E) and they are working using I2C. These sensors are the BMP180 and the TSL2561 from Adafruit. I tried them with an Arduino and it was perfectly functional.

Then I tried to plug them into the I2C bus of the UEXT2 connector. I tried i2cdetect to detect them but nothing is being detected. I've checked almost 10 times my cabling and tried it on the Arduino another time but i2cdetect won't find it. I also tried to put my Arduino as a I2C slave and plug it directly to my A20 but again, nothing is detected.

I tried to put it on the UEXT1 connector or on the GPIO2 connector. Still nothing. The best I can get is what this guy get : https://www.olimex.com/forum/index.php?topic=2866.0. And this seems more a bug than anything else.

I'm using kernel 3.4.67+ with Debian distributed from Olimex. Is there a module I need to load ? Something I need to patch ?

Thanks in advance. I've been struggling my whole week-end on this...
Title: Re: i2cdetect doesn't detect anything
Post by: bubi on July 06, 2014, 09:21:50 PM
Hi Shakipu,

I don't understand if with arduino the TSL2561 still works.
By default arduino use internal pull-up resistors on SDA and SCL signal (see Wire.c), but they are on 5V, while the TSL2561 runs at 3.3V. So you could damage the sensor.
Same thing if you want to use arduino as a slave for the olinuxino a20.

From the post you linked I can see that are used both i2c-0 and i2c-1, but the i2c channel used in the UEXT connectors are i2c-1 and i2c-2. i2c-0 is used to connect the AXP209 power management unit, and the "UU" means that the device with address 34 has been registered by the kernel

Try to disable arduino internal plug-in and see if it works (I'm using arduino as a i2c slave to manage the motor shield)

Regards   
Title: Re: i2cdetect doesn't detect anything
Post by: dave-at-axon on July 07, 2014, 06:25:31 AM
Do you gave pullup resistors on the external boards you are trying to use?

Disable them as the A20 has pullups on the board already. I've seen this give lots of failed devices before.
Title: Re: i2cdetect doesn't detect anything
Post by: Shakipu on July 07, 2014, 08:48:46 AM
QuoteBy default arduino use internal pull-up resistors on SDA and SCL signal (see Wire.c), but they are on 5V, while the TSL2561 runs at 3.3V. So you could damage the sensor.
Same thing if you want to use arduino as a slave for the olinuxino a20.

The Adafruit documentation says :
QuoteYou may be wondering, how is it OK to connect a 3.3V chip like the TSL2561 to 5.0V data pins like the Arduino? Isn't that bad? Well, in this specific case its OK. I2c uses pullup lines to the 3.3V power pin, so the data is actually being sent at 3.3V. As long as all the sensors/device on the i2c bus are running on 3.3V power, we're fine.

So I should be fine, I've got no problems reading these sensors with an Arduino.

QuoteDo you gave pullup resistors on the external boards you are trying to use?

Disable them as the A20 has pullups on the board already. I've seen this give lots of failed devices before.

Disabling them means that I should remove them from the board. I've got no control over these pullups resistors. However, I tried to use the I2C on the GPIO2 (TWI0) because they don't have any pullups resistors. The result stays the same.

QuoteFrom the post you linked I can see that are used both i2c-0 and i2c-1, but the i2c channel used in the UEXT connectors are i2c-1 and i2c-2. i2c-0 is used to connect the AXP209 power management unit, and the "UU" means that the device with address 34 has been registered by the kernel

Thanks for the explanation about the i2c-0. I already tried to poll the i2c-2 but nothing is detected. When I do i2cdetect -l, I can see the three I2C buses (0, 1 and 2).
Title: Re: i2cdetect doesn't detect anything
Post by: dave-at-axon on July 07, 2014, 01:38:08 PM
Quote from: Shakipu on July 07, 2014, 08:48:46 AM
Disabling them means that I should remove them from the board. I've got no control over these pullups resistors. However, I tried to use the I2C on the GPIO2 (TWI0) because they don't have any pullups resistors. The result stays the same.

TWI0 does have pullups via R75 and R76. They are next to the SDA and SCL at the AXP209

If you do have them on your board, I would suggest to somehow remove them. I have seen issues with failed I2C when there are more than 1 pullups on the boards.

Lastly, can you show us how you have it wired to the A20?
Title: Re: i2cdetect doesn't detect anything
Post by: adinu on July 07, 2014, 01:44:14 PM
You most likely already checked this but just in case:

Do you have I2C enabled in the sys_config.fex file (twi0_used, twi1_used and twi2_used)?
Title: Re: i2cdetect doesn't detect anything
Post by: Shakipu on July 07, 2014, 07:23:51 PM
This is the TWI part of my script.bin :
Quote[twi0_para]
twi0_used = 1
twi0_scl = port:PB00<2><default><default><default>
twi0_sda = port:PB01<2><default><default><default>

[twi1_para]
twi1_used = 1
twi1_scl = port:PB18<2><default><default><default>
twi1_sda = port:PB19<2><default><default><default>

[twi2_para]
twi2_used = 1
twi2_scl = port:PB20<2><default><default><default>
twi2_sda = port:PB21<2><default><default><default>

Quote
TWI0 does have pullups via R75 and R76. They are next to the SDA and SCL at the AXP209
You are true, I've double checked the schematic.
I was talking about the pullups resistors on the breakout boards for the sensors. I surely don't want to play too much with my A20. Plus, it's easier to remove the pullups resistors on the sensors than on the A20.
I will make you a diagram as soon as possible. For now, I'm a little bit busy but I will try to make something clean for you.

EDIT: Here is a quick drawing made with Inkscape. Keep in mind that I use the BMP180, not the BMP085 (it's almost the same) and I'm not using the Flora version of the light sensor (the classic version doesn't exist in Fritzing) but the wiring is the same. These sensors works with the Arduino Uno.

(http://image.bayimg.com/4023ab46e6428ec8bd50bd8732597c7e9d7c7fc3.jpg) (http://bayimg.com/LaPcpaaFC)
Title: Re: i2cdetect doesn't detect anything
Post by: Shakipu on July 08, 2014, 12:48:21 AM
The MOD-BMP085 from Olimex uses pullups too.
Title: Re: i2cdetect doesn't detect anything
Post by: dave-at-axon on July 08, 2014, 04:47:04 AM
If you have left the pullups on both boards, I suggest you remove them if you can. I am pretty certain that is why it's not working. My board here had pullups on it for a RTC and I could not get it to work until I removed them from the board. As the A20 has them already, it now works fine.
Title: Re: i2cdetect doesn't detect anything
Post by: bubi on July 08, 2014, 12:50:50 PM
Hi Shakipu,

do you have rev1 or rev2 of the BMP180 breakout? rev2 has an internal level-shifter that could not work properly with same voltage on HV and LV side.

Did you tryed to use only the light sensor? just to know if it works on the A20
Title: Re: i2cdetect doesn't detect anything
Post by: Shakipu on July 08, 2014, 07:40:26 PM
Bupi, I have the rev2 of the BMP180. If you are true, this could be something more difficult to fix. I tried to plug only the tsl2561 but I got nothing on my i2c buses. Sometimes, I get this on the i2c-1 :
Quote0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
But my sensor is at the address 0x39...

QuoteI suggest you remove them if you can. I am pretty certain that is why it's not working.
Yay... I may try this if nothing else works. Where does your RTC come from ?
Title: Re: i2cdetect doesn't detect anything
Post by: dave-at-axon on July 09, 2014, 06:42:17 AM
Quote from: Shakipu on July 08, 2014, 07:40:26 PM
Where does your RTC come from ?

I use the Maxim DS1338 and I included it on my carrier board that I use with the A20. The driver is using the DS1307 and I rebuilt the Linux kernel to use it.


I have another idea for your little boards. If you don't need to use them with an Arduino and plan only to use with the A20, remove all of the level shifting parts and pullups etc and then link the input to the output via the solder pads left behind. Then everything is simple and there is no pullups or level shifting to give your bus any issues and as you as powering from 3.3V all is well.
Title: Re: i2cdetect doesn't detect anything
Post by: martinayotte on July 09, 2014, 04:34:32 PM
On which bus did you connect your i2c devices ?
because the i2c-1 bus is the one where the AXP chip is connect.
With my A20 board, I've some i2c devices on UEXT1 and they are seen on i2c-2.
Title: Re: i2cdetect doesn't detect anything
Post by: bubi on July 09, 2014, 05:05:45 PM
Shakipu, your result of i2cdetect on i2c-1 is normal. The addresses that you see are referred to the EEPROM T24C16BN-SH, and that's good because means that the i2c port works  ;)

In my case I have a DS1307 and an arduino connected via a level-shifter at the same bus and all work properly.

Try, as suggested by dave-at-axon, to remove all pull-up resistors from the breakout (you can restore them later if needed)

Regards
Title: Re: i2cdetect doesn't detect anything
Post by: Shakipu on July 09, 2014, 08:07:31 PM
Ok, I was just wondering why these addresses were showing some times and some times not.
Title: Re: i2cdetect doesn't detect anything
Post by: dave-at-axon on July 10, 2014, 10:45:15 AM
Quote from: Shakipu on July 09, 2014, 08:07:31 PM
Ok, I was just wondering why these addresses were showing some times and some times not.

The pullups?????

Remove them and see if this cures the issues.
Title: Re: i2cdetect doesn't detect anything
Post by: dave-at-axon on July 10, 2014, 10:53:02 AM
Quote from: martinayotte on July 09, 2014, 04:34:32 PM
On which bus did you connect your i2c devices ?
because the i2c-1 bus is the one where the AXP chip is connect.
With my A20 board, I've some i2c devices on UEXT1 and they are seen on i2c-2.

Mmmmm.

On the schematic the AXP209 is on TWI-0. I can confirm this as I have my LCD touch on this and on my original dev board, I got errors on TWI-0 from the AXP209 code when I powered down the touch driver.

My RTC is on TWI-1 and my analog inputs are on TWI-2 and both come from the UEXT connections.

Which OS are you using? The above is based on Android. This is the entry from the FEX file and these ports match with the schematic.


[twi0_para]
twi0_used = 1
twi0_scl = port:PB00<2><default><default><default>
twi0_sda = port:PB01<2><default><default><default>

[twi1_para]
twi1_used = 1
twi1_scl = port:PB18<2><default><default><default>
twi1_sda = port:PB19<2><default><default><default>

[twi2_para]
twi2_used = 1
twi2_scl = port:PB20<2><default><default><default>
twi2_sda = port:PB21<2><default><default><default>
Title: Re: i2cdetect doesn't detect anything
Post by: martinayotte on July 10, 2014, 05:03:56 PM
Hi Dave,

You're right, I've confused myself between AXP and the EEPROM.
what I have is the following, but my own temp sensor (4B) attached on UEXT1 is still on bus #2 :

root@A20:~/LDC-indoorcom# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                         
root@A20:~/LDC-indoorcom# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                         
root@A20:~/LDC-indoorcom# i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- 4b -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                         
Title: Re: i2cdetect doesn't detect anything
Post by: Shakipu on July 10, 2014, 06:52:18 PM
I removed the pullups of the TSL2561 at works today but when I came back home to try it, it seems that all of my sensors were broken... I tried them with an Arduino but there is definitely a problem : the TSL2561 return me an overload error and nothing happens for the BMP180. I haven't made any changes on my wiring... God thanks, my GPS and OlinuXino still works... I will try to find out what happened but I don't have all my tools where I am (I am temporarily out of my real home for work).

I think that sleeping with the window open and the components next to the window isn't a good thing. Especially when it's raining outside and there is thunderstorms...
Title: Re: i2cdetect doesn't detect anything
Post by: Shakipu on July 26, 2014, 08:36:11 PM
Hi everyone,

time has passed since my last try with i2c but today it is a success. I got the TSL2561 communicate with my A20 and I can now go on further developments. The BMP180 looks definitely broken so I may buy one that is better or find what is broken on my BMP180 and try to repair it.

I think that the fix for my i2c problem was to remove the pullups resistors. Thank you everyone !