OLIMEXINO-NANO and I2C shield not working

Started by Malte, May 29, 2014, 09:24:52 PM

Previous topic - Next topic

Malte

I recently bought a Olimexino Nano and have a strange problem connecting an shield that communicates via I2C to the board.
I dont use the UEXT I2C connections but D2/D3. (UEXT is ocuppied with an UEXT Module (MOT-BT) with UART).
The shield only needs 3.3V, so this should be no problem.

The problem is, that the wire libary is not working. Starting a communication seems to work (e.g. beginTransmission() ), but as soon as I call endTransmission() the Nano freeze.

I checked, the shield is working perfectly together with an Olimexino 328 (The shield is connected to 3.3V).

Do you know how to solve this problem?


Lurch

MOD-BT uses SDA/SCL for two of it's lines. Does the I2C work without the MOD-BT connected?
If so, you may want to change those pins. There was a notice from Olimex in one of these forums about this.
I don't have the link, but the text was:
QuoteCan you check if you have R4, R5, R7, R9, R10 mounted on the board?
You might need to remove those if you aren't aiming for full UART (just RX and TX are needed for data communication with MOD-BT).
We actually don't populate those resistors in the last MOD-BT revision.
Only CTS signal remains (pin 7 of the connector for MOD-BT)!
Be careful with CTS (Clear To Send)!
It might disable the whole BT communication if sending is not enabled by CTS.

Malte

I already checked if MOD-BT is the problem and found the same information. Yes, they are mounted on the MOD-BT (also i just bought MOD-BT just recently) but removing the MOD-BT did nothing. Still the same problem with I2C.

Looking at the Olimnexino Nano schema I noticed there are 2 4.7K pull-up resistors (R10/R11) between 3.3V and SDA/SCL. I am not an electronic expert but maybe they are to much? I know you should use 4.7k pullup if you want to connect an 3.3.V I2C shield on a 5V board.

I also looked into the wire libary.
 
TWI.H
// activate internal pullups for twi.
  digitalWrite(SDA, 1);
  digitalWrite(SCL, 1);

Maybe both are to much? I deactiveted them in TWI.H but nothing changed.

Also i noticed that the leonardo is defined with 16Mhz (as it is in the 5V variant)
leonardo.build.f_cpu=16000000L

And wire uses it to calculate the twi bit rate
TWBR = ((F_CPU / TWI_FREQ) - 16) / 2;

But as i now to run 16Mhz you should have 3.6V, with 3.3V the chip is overclocked? I am still learning on the ardunio plattform, but the frequency is more or less just a definition to calculated different settings and does not really reflect the actual speed the chip runs on or?
So maybe the timing settings are wrong?


I just guessing at the moment....It has to do something with the Olimexino Nano because the same setting works on the Olmexino 328.




Lurch

Are you sure the shield is using D2/D3 like the Olimexino NANO?
The Olimexino328 - at least the ones I have - uses A4/A5 for the SDA/SCL, not D2/D3
Can't think of anything else that would be that off.

Malte

On the Olimexino328 I use A4/A5 for SDA/SCL, on the Olimexino Nano D2/D3.

Same setting, same (basic) test code...On the Olimexino328 it works perfectly, switching to Nano: nothing.

Both are powered by 5V, in both cases the shield is connected to 3.3V.

Lurch

If the shield is getting it's 3,3V from the normal pin, then it should be OK. I can try it this afternoon.
The only problem I had was with the 3,3V on the UEXT, which is only turned on when D8 is an output high.

Malte

Thanks a lot for your effort.

I am really out of clues why this happens on the nano. My only last suggestions would be the resistors but I really dont think so.

The Problem with the UEXT i got in the beginning with MOD_BT...btw. MOD_BT on the Nano only works if you user Serial1 and change in the blueetooth.h libary Serial to Serial1.



Lurch

I just tried NANO's I2C with a 24FC256 I2C EEPROM on D2/D3 (+3.3V, GND) and had no problems to write and read the EEPROM.
I didn't try the MOD-BT because the weird 32U4 serial communication to program the chip is a hassle.
The I2C works fine, though. If the board works for you on the 328, that's really weird. There are only 4 lines (+3.3V, SCL, SDA, GND) to connect to the NANO, so it can't really go wrong?
The 4.7K resistors are fine for normal loads.

Malte

Unfortunaly I dont have any other I2C shield at hand, so I cant try if this works.

Later I am going to check to voltage of SDA/SCL. Maybe the shield does not work really well on the 3.3V of the Nano and doesnot reach the necessary threshold to trigger a signla. I think you need at least >1.8V.

I will try...else I am out of clues.