Jump to content
I2Cdevlib Forums

I2Cdev on STM32F103 hangs


Recommended Posts

I am trying to port I2Cdev lib to STM32F103RC. I received the following informations on my terminal:

Testing device connections...MPU6050 connection successful

Resetting MPU6050...
Disabling sleep mode...
Selecting user bank 16...
Selecting memory byte 6...
Checking hardware revision...Revision @ user[16][6] = 4d
Resetting memory bank selection to 0...
Reading OTP bank valid flag...OTP bank is valid!
Reading gyro offset TC values...
X gyro offset = 3
Y gyro offset = 63
Z gyro offset = 63
Setting slave 0 address to 0x7F...
Disabling I2C Master mode...
Setting slave 0 address to 0x68 (self)...
Resetting I2C Master control...
Writing DMP code to MPU memory banks (1929 bytes)
Success! DMP code written and verified.
Writing DMP configuration to MPU memory banks (192 bytes in config def)
Success! DMP configuration written and verified.
Setting clock source to Z Gyro...
Setting DMP and FIFO_OFLOW interrupts enabled...
Setting sample rate to 200Hz...
Setting external frame sync to TEMP_OUT_L[0]...
Setting DLPF bandwidth to 42Hz...
Setting gyro sensitivity to +/- 2000 deg/sec...
Setting DMP configuration bytes (function unknown)...
Clearing OTP Bank flag...
Setting X/Y/Z gyro offset TCs to previous values...
Writing final memory update 1/7 (function unknown)...
Writing final memory update 2/7 (function unknown)...
Resetting FIFO...
Reading FIFO count...Current FIFO count=0
Setting motion detection threshold to 2...

It hangs at the step "Setting motion detection threshold to 2" so I look inside the function setMotionDetectionThreshold(2). It call to function BytesWrite and I found that it hangs at this step:

/* Send START condition */
I2C_GenerateSTART(DEFAULT_I2C, ENABLE);

/* Test on EV5 and clear it */
while(!I2C_CheckEvent(DEFAULT_I2C, I2C_EVENT_MASTER_MODE_SELECT)); //it hangs here

I am very confuse because the other functions also call BytesWrite and all of them just done, only setMotionDetectionThreshold hangs at this step.

Can any body please help me solve this problem?

My code is here: http://www.mediafire.com/download/dz9e5k8pnk2msk6/MPU6050_DMP.rar. My complier is Keil V4.73.

Thanks & Regards

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...