zeke 693 Posted November 14, 2014 Share Posted November 14, 2014 @ArcticSaturn: The first byte transmitted out on the I2C bus is a composition of the slave address and the read/write bit. Since the read/write bit occupies the least significant bit position in this first byte, the address appears to be incorrect but it's okay. For example, if the slave address = 0x04 and the R/W bit = 0 (write command) then the first byte looks like 0x08. Here's a C code snippet to elaborate: ... /************************************************************************** * Start reading sensor by sending the START condition **************************************************************************/ i2c_start(); /************************************************************************** * Then write out the sensor I2C address + the Read Bit * ( I2C Address << 1)|READBIT * ( (0x28<<1) | 0x01 ) = 0x51 **************************************************************************/ i2c_out_byte( ( SLAVE_ADDRESS<<1 ) | READBIT ); /************************************************************************** * Now see if the sensor responded to the command by checking * the ACK bit. **************************************************************************/ AckBit = i2c_readackbit(); ... Does that make sense? Is that what you are seeing? ArcticSaturn 1 Quote Link to post Share on other sites
ArcticSaturn 1 Posted November 14, 2014 Share Posted November 14, 2014 @@zeke yes it does. I just read the spec from Sensirion and they say1000,000 + R/W bit. In my working code I always started with 0x80 so my assumption was address is 0x80 (which is wrong). Thanks for pointing me to it! Have a nice weekend! zeke 1 Quote Link to post Share on other sites
zeke 693 Posted November 14, 2014 Share Posted November 14, 2014 @ArcticSaturn: Excellent! Yeah, this detail tripped me up too when I first attempted I2C comms. That's why I commented my C code - to remind myself later on. I hope you have a nice, warm weekend too! Quote Link to post Share on other sites
wayfarer 0 Posted May 3, 2015 Share Posted May 3, 2015 Hi Rei, I try to use your library with my CC3200. I want to attach two vcnl4000 proximity sensors to te board. Because of the fixed I2C address I have to use a software interface. I have a problem with your library. When a try to compile I get the following error: C:\Users\myway\Documents\energia-0101E0015\hardware\cc3200\libraries\I2C_SoftwareLibrary\I2C_SoftwareLibrary.cpp: In function 'void delayI2Cms(uint16_t)': C:\Users\myway\Documents\energia-0101E0015\hardware\cc3200\libraries\I2C_SoftwareLibrary\I2C_SoftwareLibrary.cpp:33:48: error: '__delay_cycles' was not declared in this scope while (delay--) __delay_cycles(TICKS_PER_MS); ^ C:\Users\myway\Documents\energia-0101E0015\hardware\cc3200\libraries\I2C_SoftwareLibrary\I2C_SoftwareLibrary.cpp: In function 'void delayI2Cus(uint16_t)': C:\Users\myway\Documents\energia-0101E0015\hardware\cc3200\libraries\I2C_SoftwareLibrary\I2C_SoftwareLibrary.cpp:37:48: error: '__delay_cycles' was not declared in this scope while (delay--) __delay_cycles(TICKS_PER_US); Actually I have no idea about the missing function "__delay_cycles". Can you help me please? Way Quote Link to post Share on other sites
Rei Vilo 695 Posted May 3, 2015 Author Share Posted May 3, 2015 This library was designed for the MSP430G2553, so it may not work with the CC3200, as I tried to explain in Some Misconceptions about Libraries. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.