2018年7月13日 星期五

[nRF52840] ble app uart + I2C + MPU6050 Acc & Gyro Output

    本篇是基於ble_app_uart_bi-direction_test來延續加入新功能, 主要是新增了I2C Master Driver和對MPU6050 Acc/Gyro數值的讀取.

1. Test Video:


      
   2. Test Code Download Link: (only support keil-mdk 5)

   3. Softdevice Download Link:

   4. Mergehex Tool Download Link:
       mergehex.exe

   5. Code flow:
    • Add define for test command:
      • "a" command: Output Acc Data
      • "g" command: Output Gyro Data

    • Implement "nus_data_handler" function for "a" & "g" command:

    • Implement main loop flow:


  6. I2C Signal:

    • Sensor Init:



    • Get Acc data:

    • Get Gyro data:

  7. Build code and update code flow:
      Please follow ble_app_uart_test step to do.

10 則留言:

  1. .\_build\nrf52840_xxaa.axf: error: L6047U: The size of this image (34892 bytes) exceeds the maximum allowed for this version of the linker

    Hello, I am getting this error. Please help.

    回覆刪除
    回覆
    1. Hi, Do you use free version of Keil-mdk? If yes, it will have code size limitation, thanks.

      刪除
  2. Hi, How did you wire the MPU6050 with the nrf development board?

    回覆刪除
    回覆
    1. Hi:
      MPU6050 SCL -> EVB P0.27
      MPU6050 SDA -> EVB P0.26
      MPU6050 VDD -> EVB 3V
      MPU6050 GND -> EVB GND

      刪除
  3. Hi, how can I add an option of reading Magnetometor values as well?

    回覆刪除
    回覆
    1. Hi:
      You mean is reading magnetometor value from mpu6050? or adding a magnetometor sensor into this project?

      Have a nice day,
      JustinWang

      刪除
  4. Hello, i need to get value from the magnetometor of mpu6050, I get values of accelerometer and gyroscope, but it doesnot show my magnetometer values. But i added the function to read magn values.
    Thanking in advance.

    回覆刪除
    回覆
    1. Hi:

      The MPU6050 only have acc and gyro sensor, so you can't get magnetometer value from MPU6050.
      You can add a new magnetic sensor into I2C bus to get the magnetometer value.

      Have a nice day,
      JustinWang

      刪除
  5. Hello. Thank you for your code. I was trying to run the code in segger embedded studio version 17.0.2. The code builds completely. I can see that the ble is connected to mobile device. But I see no data from MPU. The output in the app is somethink like this: "A: ; ; ". Can you please help me in this issue? Thanks in advance.

    回覆刪除
    回覆
    1. Hi:

      Can you read some register(e.g., Who_Am_I) to check the MPU6050 board and I2C Bus is workable?
      I think we need to check the hardware is ok or not first.

      Have a nice day.

      刪除