This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF52 MPU6050 example

Hi, im using nRF 52 DK. I want to interfac mpu6050 by using the example found on this page https://github.com/Martinsbl/nrf5-mpu-examples. I'm particularly using the example linked below, which uses twi. I need to biuld this example and download it on my nRF52 to send the acquired data to my smartphone by using BLE. But I have an error saying that the file app_mpu.h cannot be found (but it is there). How this can be done? Any help would be appreciated! P.S all of this is done using softdevice s132 and SDK 14.2.0.

  • Hi lauraalri,

    Have you followed the tips from the Readme?:

    How to use:

    • All examples are made for SDK 14.2.0. Other SDKs will not work. Download the zip file and extract to "sdk_14.2.0_folder\examples". Or just clone it to the same folder.
    • Define your MPU in Keil's "Target Options -> C/C++". Use define "MPU9255", "MPU9150", or "MPU60x0".
    • Decide whether to use TWI or SPI in Keil's "Target Options -> C/C++" by using defines MPU_USES_SPI or MPU_USES_TWI.
    • Select SPI_ENABLED or TWI_ENABLED in sdk_config.h dependent on your choice above.
    • Remember to define the correct TWI, SPI, and/or interrupt pins. The SPI and TWI pin defines are located in the nrf_drv_mpu_xxi.c files. The GPIOTE interrupt pin is defined in main.c.

    Also you could right click on the folder above Application, press Options for Target '....', go to the C/C++ tab, press on the ... button to the right of include paths, scroll all the way to the bottom & change nrf5-mpu-examples to nrf5-mpu-examples-master. The app_mpu.h file is located inside this nrf5-mpu-examples-master folder. You need to go back 5 folders from the Keil project to reach the nrf5-mpu-examples-master folder, which is why the last line should look like this: ..\..\..\..\..\nrf5-mpu-examples-master (Tips from similar thread)

     

  •  include the path to app_mpu.h file in c/c++ preprocessor.

    Go to "Options for Target":  

    Then "C/C++" tab --> include paths: 

    Include the path where "app_mpu.h" is located: 

    (in my case [... nRF5_SDK_14.2.0_17b948a\examples\nrf5-mpu-examples-master] )

     

     

Related