CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

SMBus / I2C Problem
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
farouk_baya



Joined: 18 Jun 2010
Posts: 27

View user's profile Send private message

PostPosted: Wed Dec 24, 2014 8:44 am     Reply with quote

I get the correct i2c adresse but when reading data from the sensor I get always MSB = 0xFF and LSB = 0xFF.
I think the problem can be about the i2c speed.
the configuration is as follows:
Cpu clock = 32 M
i2c speed (#use i2c) : Fast = 40000 (40KHz)

Is that correct?
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Dec 24, 2014 11:29 am     Reply with quote

Since you say you get the correct addresses, you can assume it's speed is correct, though your 'code snippet' isn't correct.

All '0xFF' usually means no data. Are there other registers you can write and read to correctly?

If that device has a bit of RAM, send known data to it, then read, better yet, if there's some EEPROM, send known data to it, power off, wait,power up, read the EEPROM.

I don't have that device so I can't test....

jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Wed Dec 24, 2014 3:37 pm     Reply with quote

I'd change the clock setting to be slow=40000 not fast.

The chip supports 10KHz to 100KHz max. The 'slow' standard is for 100KHz. Fast normally starts at 400KHz. It doesn't matter on most chips, but on one with programmable slew rates, selecting 'fast' would switch to these. Better to stick with 'slow' since this is what the chip supports.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group