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

defining MPU in SES insted of Keil - Target options

Hello,

I have two quastions

(1)

     I am trying to run nrf5-mpu-simple written by , but there are just Keil's examples on Github and I am working in SES. There is written : Define your MPU in Keil's "Target Options -> C/C++". Use define "MPU9255", "MPU9150", or "MPU60x0". But how can I do the same thing in SES? I tried define it as is shown in attached printscreen, but it had error saying : "too many filenames given. Type cc1 --help for sage". So how can I do this right?

(2)

Also planning to migrate to SDK15.2 with these drivers, so the question is, what changes should I do? I read on infocenter that the drivers changed a bit, so I think it will be necesary to overwrite the nrf_mpu_twi driver where the old TWI API is used and also GPIO library for interrupts (not using yet, but planning). And what should be changed in config.h when migrating to SDK15.2?

using SDK 14.2, https://github.com/Martinsbl/nrf5-mpu-examples , nRF52832 with SES and MPU6050

thank you

Parents Reply Children
  • Thank you for your answer. It compiled, but crashed on some error in hardfault handler. Anyway, I wanted run this example just to demonstrate myself if it works and see basics of how it works. I really want to move to sdk15.2 and run mpu6050 with driver provided by Nordic which is placed in sdk. I understand basically how it works, but I have one question. I just want read gyro data from register and do some basic setup but I don't understand how to write values to registers. For example , here in attached screen shot from mpu register map, there is register 26 (decimal) and there are numbers you can write the numbers to make required setup. Please, can you guide me a bit, how to do this with mpu6050 driver provided in sdk15.2 using function "bool mpu6050_register_write(uint8_t register_address, const uint8_t value)

    Thanks a lot

  • how to do this with mpu6050 driver provided in sdk15.2 using function "bool mpu6050_register_write(uint8_t register_address, const uint8_t value)

    What does the documentation for the driver tell you?

    infocenter.nordicsemi.com/.../group__nrf__drivers__mpu6050.html

  • I have read it already, but problem is that don't know in which format and how to pass data to function. Let me explain you, there is written in attached screen I sended that bits 0 to 2 in register 26  are responsible for lowpass filter. There is that when you pass number 7 to these bits, it will do some setup, if you pass 6 another setup... So may I pass data to this register by array format? Like this uint8_t data[8] {0,0,0,0,0,1,1,1} ? Is it right? 

    Thanks 

  • Go on - the description seems perfectly clear to me:

    Parameters

    [in] register_address Register address to start writing to
    [in] value Value to write to register

    What's unclear about that?

    If you want to write the value X to register R, you just do:

    success = mpu6050_register_write( R, X );

    Simples!

    The value you write is a single byte.

  • Thanks for answer. I tried it, but it was eventually better to use that library I attached in my first question. It is working but i do not understand this part of code in printing  function. What are these "/033[3;1H" ?

    err_code = app_mpu_read_gyro(&gyro_values);
                APP_ERROR_CHECK(err_code);
                int16_t sampleX = (gyro_values.x+700)*0.07;
                int32_t average = 0;
                average = calculate_ema(average,sampleX);
     
                NRF_LOG_INFO("\033[3;1HSample # %d\r\nX:", sampleX); 

    thanks

Related