I'm currently having some issues using an I2C communication or rather using the i2c library.
It seems to have no effect if, the kbits per second parameter is changed.
-- i2c_lib - snippet
Code: Select all
/** Implements I2C on the i2c_master_if interface using two ports.
*
* \param i An array of server interface connections for clients to
* connect to
* \param n The number of clients connected
* \param p_scl The SCL port of the I2C bus
* \param p_sda The SDA port of the I2C bus
* \param kbits_per_second The speed of the I2C bus
**/
[[distributable]] void i2c_master(server interface i2c_master_if i[n],
size_t n,
port p_scl, port p_sda,
unsigned kbits_per_second);
main.xc - snippet
Code: Select all
par{
on tile[1]:i2c_master(i2c,1,SCL,SDA,100);
on tile[1]:adc(i2c,0);
}
SCL in blue, SDA in yellow. On the right hand side the timing is measured with two coursers.
Rising or lowering this parameter doesn't really effect the timing. Also the SCL's shape seems to be a bit suspicious.
Is this a known problem ? I haven't modified the i2c_lib in any kind.
Edit:
I was digging a bit more regarding this problem and found out that the variable 'bit_time' which is calculated in the i2c_master task always has the value 100. No matter if kbits_per_second is about 100, 400 or even 1000.
But when I was trying to debug the calculation the xtimecomposer showed in the variable tab the following error... "_Si2c_master_0.init.1.state_ptr <mi_cmd_var_create: unable to create variable object>"
Cheers,
Chris