18X i2c question

tommh44

New Member
I am trying to read a Si570 via i2c with an 18x. No matter what I do, I get back hex FF.
The datasheet for the Si570 says the following:
"Fast mode operation is supported for transfer rates up to 400 kbps..."
"....found in the I2c Bus Specification standard(fast mode operation)"
Is there something about this fast mode that the 18X can not do?
From the reading that I have done so far, fast mode does not seem different except for the speed.

Any comments?

Thanks, Tom
 

tommh44

New Member
&FF is classic of no device present.
Address?
oe connection?
According to the data sheet, the address is Hex 55.
OE is active high. The Si570 puts out the default signal with with no connection to OE or with 1K to plus... signal goes away when OE grounded. As expected.
The Si570 is a 3.3 volt device. I tried running the 18X at 3.3 also. My "heart beat" led and several things I tried work fine.
But, I decided to do it the right way by using the mosfet method for level shifting (Phillips ap note AN97055) and running the 18X at 5 v.
On the scope, I see signals at the correct levels.
Pullups on both sides.
 

BeanieBots

Moderator
The data sheet I read said address and oe function were set at point of order by order code. No mention of 55.
The PICAXE should be happy at 3.3v. Lose the level shifting to eliminate from equation.
 

tommh44

New Member
The data sheet I read said address and oe function were set at point of order by order code. No mention of 55.
The PICAXE should be happy at 3.3v. Lose the level shifting to eliminate from equation.

Thanks,
Silabs has an online tool which generates a part number by specifying the various options such as the start up frequency, output format, etc. It generates the I2C address. That may be hex 55 unless you specify one. I did not specify on. Once you have the part number (on the device), you can use the same tool to verify the characteristics by entering the part number. Just did that and it says hex 55.
I certainly like the less complicated one voltage solution.
 

BeanieBots

Moderator
May well be the level shifting. Easy to get wrong.
Wire direct at 3.3v and try again.
If that still does not work, then sorry, out of ideas.

Post your code. Maybe one of the other guys can spot an error.
 

tommh44

New Member
May well be the level shifting. Easy to get wrong.
Wire direct at 3.3v and try again.
If that still does not work, then sorry, out of ideas.

Post your code. Maybe one of the other guys can spot an error.
OK, back to simple version (everything 3.3v).
Code:

i2cslave $55,i2cslow,i2cbyte
pause 100 ' have tried pause 10
readi2c 7,(b0) 'have tried 0,(b0)
debug

I have also tried using word read.
Thanks for you help.
Tom
 

hippy

Technical Support
Staff member
The address ($55) is usually given in documentation as a 7-bit number, shifted left when actually sent to form an 8-bit entity with the lsb indicating read or write. You should try ...

-- I2cSlave $AA, i2cSlow, i2cByte

If that doesn't work it may be worthwhile writing some code which probes all I2C Addresses ...

Code:
Pause 2000
For b0 = $20 To $FE Step 2
  I2cSlave, b0, i2cSlow, i2cByte
  I2cRead 7, (b1)
  If b1 <> $FF Then
    SerTxd( "Possibly on Address ", #b0, CR, LF )
  End If
  Pause 10
Next
SerTxd( "Done" )
 
Last edited:

tommh44

New Member
The address ($55) is usually given in documentation as a 7-bit number, shifted left when actually sent to form an 8-bit entity with the lsb indicating read or write. You should try ...

-- I2cSlave $AA, i2cSlow, i2cByte

If that doesn't work it may be worthwhile writing some code which probes all I2C Addresses ...

Code:
Pause 2000
For b0 = $20 To $FE Step 2
  I2cSlave, b0, i2cSlow, i2cByte
  I2cRead 7, (b1)
  If b1 <> $FF Then
    SerTxd( "Possibly on Address ", #b0, CR, LF )
  End If
  Pause 10
Next
SerTxd( "Done" )
WOW!!!, Thanks. The $AA did the trick. I would have never guessed that. Wonder why they don't just say that in the datasheet.
Thanks again.
Tom
 

hippy

Technical Support
Staff member
WOW!!!, Thanks. The $AA did the trick. I would have never guessed that. Wonder why they don't just say that in the datasheet.
It's just another thing to confuse newcomers, like Address meaning the I2C Device Address or Internal Memory Location, and the I2cByte argument meaning the addressing field ( Internal Memory Location ) is 8-bit with I2cWord meaning 16-bit and it has nothing to do with the size of data transfer which is always 8-bit bytes regardless.

Technically a datasheet stating an address as $55 is correct, although many people talk of an address as $AA because that's the way it's used when setting up hardware registers and in I2cSlave commands. Yes, it can get confusing :)

Glad it's working. You can try moving up to I2cFast again now.
 
Top