chipKIT® Development Platform

Inspired by Arduino™

2 uno32 boards via I2C

Created Wed, 11 Jun 2014 19:57:30 +0000 by Pogij


Pogij

Wed, 11 Jun 2014 19:57:30 +0000

Hi

I'm trying to connect two chipkit uno32 boards using I2C bus. I have connected these two boards as it is shown in the image [url]http://i.imgur.com/01wA8KQ.jpg[/url]. From examples in MPIDE i have uploaded master_writer program to master board and slave_receiver to slave board. But my slave board does not send anything to USB. What am I missing here?

And I am sort of a beginner when it comes to this kind of stuff so please make suggestions a bit more noob friendly :). I also read somewhere that connection should contain pull up resistor but I don't understand what exactly should I do.

Thanks


majenko

Wed, 11 Jun 2014 20:33:36 +0000

There's one little thing missing - the required I2C pullup resistors. Add resistors (on one board only) between A5 and +3.3V and between A5 and +3.3V - they should be around 3.3KΩ - 4.7KΩ.


Pogij

Thu, 12 Jun 2014 20:11:59 +0000

Hi

So now my connections look like in the picture [url]http://i.imgur.com/PiEHPYI.jpg[/url] (I don't have any resistor between 3.3k and 4.7k so I just used two 2.2k resistors) but I'm still not getting anything on slave Serial Monitor. So are my connections still wrong or should I search for the problem elsewhere?

Thanks


dangeljs

Thu, 12 Jun 2014 21:17:49 +0000

You need pull-ups on both lines (A4 and A5) so if you have you circuit set up like your picture it is wrong. Repeat for A4 the same as you did for A5.


majenko

Thu, 12 Jun 2014 22:02:36 +0000

Also, don't connect 5V to Vin, you'll be starving the 5V regulator (it needs at least 6.5V). Connect 5V to 5V.


Pogij

Fri, 13 Jun 2014 17:39:33 +0000

So now my system looks like picture: [url]http://i.imgur.com/1GFOUAp.png[/url]. I think I got it connected the way you suggested but unfortunately I get nothing from slave on Serial monitor. Could it be that some other connections I have on Master board (which I did not show on picture) that would be messing it up.

Thanks


dangeljs

Fri, 13 Jun 2014 22:16:23 +0000

I didn't see it anywhere in your posts, but did you configure jumpers that select between Analog inputs and I2C interface? I beleive they are J6 and J8?

If you have communicated with other modules with I2C, the you obviously have them set correctely. Just a guess.


Pogij

Fri, 13 Jun 2014 23:03:03 +0000

Ok so I tried connecting Arduino as a Master to Slave Uno32 and everything worked. So the question now is why doesn't it work with two Uno32 boards. JP6 and JP8 jumpers are set correctly. I have also tried connecting Master Uno32 to Arduino as slave receiver and again nothing is received.


Pogij

Sat, 14 Jun 2014 18:09:00 +0000

Ok so by now I have tried sending data from Arduino board to each of Uno32 boards and both times it worked as it's supposed to. Bu sending data from any of Uno32 boards to Arduino does not work. So apparently there is something missing or is wrong with master_write program since the boards are capable of receiving data but not sending it over I2C bus. I'm trying to find solution here but unfortunately without luck so far.


jRobert

Mon, 16 Jun 2014 07:07:52 +0000

If you want a ChipKIT to talk to an Arduino on the I2C you need to remove the pull-up resistors. The Arduino has internal pull-ups to 5V that are enabled by the library.The ChipKIT I2C pins are 5Volt tolerant,but do not have internal pull-ups. The I2c pins are open collectors so the pins see a HIGH except when the collectors turn on and pull them to a LOW. An Arduino needs to see 5V to see it as a HIGH. If you want two ChipKITs to talk you will need the external pull-ups to 3.3V.


Pogij

Mon, 16 Jun 2014 16:32:53 +0000

Well my goal is to make one ChipKit send commands to other ChipKit. I have only used Arduino to find out where system fails. And as far as I have tested I think there is a problem with ChipKit sending data over I2C, since I can send data from Arduino to ChipKit but can't send data from ChipKit to Arduino (I have also tried connecting those two without pull up resistors but still I get nothing on Arduinos Serial Monitor).


GrahamM242

Mon, 16 Jun 2014 17:48:29 +0000

I've had the Uno32 running as both master and slave, and can confirm that it does indeed work well in either role. As a master, it was communicating with a 24AA04 EEPROM. As a slave, it was emulating a DDC2 EEPROM, and also performed that task without any problems.

I don't have two Uno32 boards, but I do have an Uno32 and a Fubarino SD board. I used the master_writer and the slave_receiver examples. I only connected SDA, SCL and GND between the two boards, and I ensured that both boards were connected to the same computer via USB. This was to avoid any issues with ground potential. (even if it did give me headaches remembering which serial port is which device). Pull up resistors were 10K and connected to 3.3V.

I ran the Uno32 as master, and Fubarino SD as slave, and transmission and reception worked. I ran the Fubarino SD as master, and the Uno32 as slave, and transmission and reception worked.

I'm using MPIDE version mpide-0023-windows-20140511-test.

If you do want to use the Arduino for testing, you may run into issues with 3.3V vs 5V logic. Technically 3.3V is not high enough for the Arduino to read as high. According to the spec sheet, 3.5V is required on the I2C bus. There's a bunch of information at I2C Bi-directional Level Shifter.


Pogij

Mon, 16 Jun 2014 20:27:58 +0000

Ok I understand that in many of your cases communication worked as it's supposed to. But in my case it doesn't. I'm just hoping someone has any idea what could be solution to the problem so I can try it. Arduino, as said, is not planned in final system. It was used just so I could test if any of my Uno32 boards was broken. But both of them were accepting data from Arduino, which tells me at least that wiring should not be the problem.

I'm developing in Linux, but have also tried in Windows with version you are using but I get same results. Also both of my boards are connected to the same PC.


Pogij

Tue, 17 Jun 2014 15:14:56 +0000

Ok I found the solution. I looked around chipkit32 github project and found that certain changes were made in wire examples. Apparently there is a hardware bug and to solve the problem all I had to do was to change line in both master_writer and slave_receiver:

Wire.begin(4);

with line:

Wire.begin(40);

Now everything works.


GrahamM242

Wed, 18 Jun 2014 08:08:01 +0000

Ahh, yes, that makes sense. It also explains why I couldn't reproduce the problem, as the examples have been updated to use 40 as the I2C address.

Glad you were able to get this sorted!