RE: programming i2c device with TINIs400
"Gerry Dubois" <[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <[email protected]> |
You might have an addressing problem. The I2C device I'm using (PCF8574A) in
the documentation shows a 8 bit slave address but the I2C bus has a 7-bit
addressing mode. I had to right shift my address by one bit to get things to
talk. This also explains the comment in the I2C example, 0x48 is 0x90 right
shifted 1 bit.
// Set I2C slave we want to talk to. 0x90 in this case. //should be 0x48
port.slaveAddress = (byte)0x48; //or should be 0x90 ???
- Gerry
-----Original Message-----
From: Gerry Dubois [mailto:[email protected]]
Sent: Monday, January 26, 2004 6:52 AM
To: [email protected]
Subject: FW: [TINI]programming i2c device with TINIs400
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Sunday, January 25, 2004 4:46 PM
To: tini-6tN4nzCoH/[email protected]
Cc: Gerry Dubois
Subject: Re: [TINI]programming i2c device with TINIs400
Hi G.D.
thanks for your help... I am new with I2C...
this is my test code :
I2CPort port = new I2CPort();
//port.setStretchCycles(I2CPort.STRETCH0);
port.setClockDelay((byte)2);
port.slaveAddress = (byte)0x70; //the SAA 1064 is at 0x70 (write)
0x71 (read) is slave adress ok (see below...)
while(i<500) {
System.out.println("i2ctest read V0.1.0 "+i++);
len=port.read(b,0,1);
if (len>0) System.out.println("i2c read "+new String(b,0,len));
//tini prints nothing
try {Thread.sleep(50);}catch(Exception e){}
}
I get a scope, I do not see any acknoledge from slave...
-----_----------_______-----------_------- --- SDA
------_--_--_--_--_--_--_--_--_--_----------- SCL T#10µs
I will try with another hardware (I have now an I2C eval. board from
Philipps...)
BTW, from i2ctest.java (tini1.12/examples) I think that the choice of
slave adress is erroneous according comment on previous line ?
// Set I2C slave we want to talk to. 0x90 in this case. //should be 0x48
port.slaveAddress = (byte)0x48; //or should be 0x90 ???
Gerry Dubois wrote:
>I've just got my I2C running on a similar HW configuration (TINITs400 with
>5V I2C bus). This is the code I used (straight from the demo app )
>
> port = new I2CPort();
> port.setClockDelay((byte)2);
>
>Works great. I'm controlling PCF8574 8-bit I/O expanders.
>
>Unfortunately with the limited information provided it's impossible to tell
>if you have a hardware or software problem. Can you post the pertinent code
>fragments?
>
>- Gerry
>
>
>
>-----Original Message-----
>From: tini-admin-6tN4nzCoH/[email protected] [mailto:[email protected]] On Behalf Of
>Ponsard Raphael
>Sent: Friday, January 23, 2004 7:10 AM
>To: tini-6tN4nzCoH/[email protected]; [email protected]
>Subject: [TINI]programming i2c device with TINIs400 (which adress for
>SDA/SCL)
>
>Hi,
>
>I have some trouble with I2C ... My tini board is a TINIm400 on a
>TINIs400 socket (out of the box)
>
>I have selected 5V pull ups for the I2C bus via the J23-25 solder
>jumpers. I2C slave is a SAA1064 (4 x 7digit led)
>
>
>I don't understand how to instanciate a com.dalsemi.system.I2CPort()
>I try to do as in the example i2cTest.java but it does not work.(is void
>parm. constructor only for 80C390 ?? javadoc is not very clear...)
>I try several delays...
>
>My test application display nothing (the first read over I2C fails).
>Unfortunatly, I do not have a scope ...
>
>If I would use the 2nd constructor (with io adress) which one use ?
>
>
>btw, where can I find memory map and device adress map of the tinis/m400 ?
>
>
>thanks
>RP
>
>_______________________________________________
>TINI mailing list
>TINI-6tN4nzCoH/[email protected]
>To UNSUBSCRIBE, edit your profile, or see list archives:
>http://lists.dalsemi.com/mailman/listinfo/tini
>
>_______________________________________________
>TINI mailing list
>TINI-6tN4nzCoH/[email protected]
>To UNSUBSCRIBE, edit your profile, or see list archives:
>http://lists.dalsemi.com/mailman/listinfo/tini
>
>
>
_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini