Main Site Documentation

What is the correct wiring to do I2C on a Panda II?


#1

Apologies for submitting this very noob question. I have spent an hour googling, and have not found an answer.

Connecting a Panda II to an I2C device: What is the correct wiring?

(specifically, I am working with a blinkm, and a maxm)

Thank you, and apologies for such a noob q!


#2

Did you try D2 = SDA & D3 = SCL? I haven’t tried it myself but that would be my guess based on the labeling.


#3

you can use software I2C driver as well and can use any pin

http://code.tinyclr.com/project/297/software-i2c-driver/


#4

I can confirm what ianlee74 did write. I’m using i2c for an LCD display and an EEProm very often.

Architect may also be right, but I didn’t try software i2c by myself :hand:


#5

This should work:

// 0x09 is BlinkM default adddress, also broadcast 0x00 can be used
var blinkM = new I2CDevice(new I2CDevice.Configuration(0x09, 400));
blinkM.Execute(new I2CDevice.I2CTransaction[]
{
	// fade to black
	I2CDevice.CreateWriteTransaction(new byte[] {(byte)'c', 0x00, 0x00, 0x00}),
	// play script 1 five times
	I2CDevice.CreateWriteTransaction(new byte[] {(byte)'p', 0x01, 0x05, 0x00})
}, 1000);

I’m didn’t find any info about BlinkM I2C bus speed so I assume the default 400 KHz. You can use the software version of I2C as well but i don’t think there is any need (the software version gives you more control over the bus but with the speed limitation).


#6

Take a look at the Init() function in the blinkm command wrapper code. It initializes the I2C bus at 100MHz. Why 100? Not sure, I probably got that from another example and since it works, did not test with other values.

Catch any fish yet? :wink:


#7

Yes, caught the fish!

Did you try D2 = SDA & D3 = SCL?

This works.

Thanks!

Question: From reading the code
http://code.tinyclr.com/project/266/blinkm-command-wrapper/

How / where do you see the pin assignments? (I was looking for cpu.pin references, and did not find any).

Please advise (I want to better understand this world!)

Thanks!


#8

I put the pin assignments in the header comments. Also, GHI publishes a brochure for every board that lists all the pins and what they do (some have multiple uses). You can find the brochures on the downloads tab on the catalog page for each respective board. Early on, I printed these out and hung them on the wall next to my bench. With several different boards, it’s impossible (well, highly unlikely, except for the savants) to memorize all of them.


#9

I put the pin assignments in the header comments.

Yes, but I am using a Panda board, and had no idea what a Domino board is (I figured it out, after an hour of digging around)

Also, GHI publishes a brochure for every board that lists all the pins and what they do

You mentioned this before, and I immediately went digging, found nice GHI PDF files with layouts, pin listing, etc. However after reading all these docs, I did not find anything that said “I2C is handled on pins # and #” I probably don’t know what to look for.

Thanks a ton for the lib. I have it working, and am using it.

It took a lot more time to get blinkm going on Panda than it did on Arduino. Some detail in the usage example (like the needed “using” clause) and comments that apply to Panda would help.

IOW, don’t assume the consumer of the lib has a clue about I2C or namespaces, or any of that jazz…

Thank you!


#10

Sam, just a couple of quick points. I don’t want to sound like I’m criticising you here, I’m just trying to point out that different people come here with different knowledge gained from different ways, which is what makes life exciting but also sometimes confusing.

You don’t “need” the using clause; that simply gives VS the pointer that you’re “using” a different namespace without fully qualifying it. Namespaces can trip you up, so it’s an important concept to grasp (since this is a C# concept, you could run into similar issues with netduino and with any C# code you were writing). There is at least a small section on namespaces in the “resources” section of the getting started book on the wiki that might have helped here.

I2C can be another important concept to understand as you get closer to the hardware. The I2C uses standard pins on an Arduino, and all shields are set up to put an I2C device on the right pins - so you may not find that documented clearly in that way (if you were using an ATMEL chip “in the raw” the fact that I2C is only on specific pins would have been spelled out much clearer). Since a Panda (and Domino) have a standard Arduino pinout, the I2C pins are the same. If you knew the I2C concepts then you would have realised you were looking for SDA and SCL lines, which are shown on all the Fez brochures - and that would have quickly answered the question for you. I’ve just updated the I2C info on the Wiki http://wiki.tinyclr.com/index.php?title=I2C_-_EEPROM to add some specific pin related information that might also help.

As I said I don’t want to sound like I’m saying anything other than we all have different knowledge and sometimes that’s hard to bridge.


#11

@ samjones3 Since you had problems with finding the proper pins it’s a good reason to believe that it’s not clear enough for beginners. The I2C pins are however in the documentation, you just have to know what you are looking for (see below).


#12

Got a sudden Déjà vu feeling.

http://www.tinyclr.com/forum/1/5389/

;D ;D ;D


#13

Let me be a little cocky by saying: “Great minds think alike” :wink:


#14

Unfortunately, this isn’t printed on the Domino itself the way it is on the Panda-II.


#15

@ Gralin

I have no doubt about you!


#16

Thanks all for feedback of all kinds!

Received and absorbed!