i2c communication error 'MasterSendStart'

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
dwiw_
Level 1
Level 1
50 sign-ins 25 sign-ins 10 sign-ins

hi,

first, I want say sorry to you for my english.

I'm using cy8ckit-044 as master to read out the data from mpu9250 via i2c communication.

I got error "implicit declaration of function 'I2C_MPU9250_I2CMasterSendStart' is invalid in c99".

I have looked at default file of i2c and get this for MasterSendStart function

"uint32 I2C_MPU9250_I2CMasterSendStart(uint32 slaveAddress, uint32 bitRnW, uint32 timeoutMs);"

another thing I confused is in another examples for i2c the MasterSendStart function is

"uint8 I2C_MPU9250_Master_MasterSendStart(uint8 slaveAddress, uint8 R_nW)"

there isn't uint32 timeoutMs, why is this happen?

I have tried to write the timeoutMs with "100u" and even make variable #define I2C_TimeOut (100u) in file.h (shown below) but it still error.

I2C_MPU9250_I2CMasterSendStart(address,MPU9250_WRITE, 100u);

or

I2C_MPU9250_I2CMasterSendStart(address,MPU9250_WRITE,I2C_TimeOut); //#define I2C_TimeOut (100u) in file.h

anyone have solution?

thank,

Dwi.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear Dwi-san,

(1) Please include "project.h" in mpu9250.c and i2c.c

NOTE: BTW the name "i2c.c" and "i2c.h" are very prone to conflict with system library source names,

  I would suggest to pick some other name to be safe.

(2) Add "I2C_TimeOut" in the argument of many I2C_MPU9250_I2CMasterXXXX()

(3) Note I2C_MPU9250_I2CMasterReadByte() does not return read data, data must be in the argument list.

(4) There was ONE "I2C_MPU9250_I2CMasterSendStop() ;" which throws too few arguments error

     even when I added "I2C_TimeOut" in the argument list,

     so I copied another call of this function from non error part of the source

     and replaced the line with it. Then the error was gone.

     I think that there must have been some non printable letter of non standard US ascii letter  included in the line.

(5) Now the first error is in the beginning of interrupt.h which I hope that you are the one to fix...

Best Regards,

12-Feb-2020

Motoo Tanaka

View solution in original post

3 Replies