Forum Rule: Always post complete source code & details to reproduce any issue!
Page 10 of 10 FirstFirst ... 8 9 10
Results 226 to 242 of 242

Thread: MPU-9250 Teensy Library

  1. #226
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,380
    My TD 1.44 download dated 9/19/2018 give a splash of just 1.44 - not beta?

    As for the Amazon 9250's - minor name change on the silkscreen between the two - but all else looks the same on pin labels and parts location and type. Let me know when you get your hooked up Mike and I'll give mine try if possible. The ASYNC/DMA SPI seems like it would be helpful when getting 100-1000 updates a second! SPI faster and if the DMA engine does the work ASYNC then no wait when the INT arrives … then the data arrives … repeat.

    It has been some time - and not used or updated - but I was getting 1 Mhz or faster on i2c - though there was some anomaly I noted with leaving the update speed set I never resolved … maybe that was a side effect of the HIGH speed.

  2. #227
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,596
    Never mind I know what I did. Better let Mr S. know.

    but I was getting 1 Mhz or faster on i2c - though there was some anomaly I noted with leaving the update speed set I never resolved
    I remember, I was too but now I seem to be having a problem. Not sure what happened. Would like to track it down though. Just very strange because it seemed to be working in prior versions.

    I do remember we use to see spikes in the data periodically, don't know if that is related or not. What really got me was the temperature spikes dropping like that when I ran the filters.

  3. #228
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    580
    Whoa, this is bizarre. Works great for me on Arduino 1.8.5 with Teensyduino 1.44, but not with 1.8.7...

  4. #229
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,380
    Quote Originally Posted by brtaylor View Post
    Whoa, this is bizarre. Works great for me on Arduino 1.8.5 with Teensyduino 1.44, but not with 1.8.7...
    Odd - they went to the parallel core building? What else I'm not sure. Maybe try a different compile Optimize and rebuild?

  5. #230
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    580
    Quote Originally Posted by brtaylor View Post
    Whoa, this is bizarre. Works great for me on Arduino 1.8.5 with Teensyduino 1.44, but not with 1.8.7...
    NEVERMIND...forgot that I had de-soldered some resistors and had to jumper a few more things than normal. Works fine on a fresh 1.8.7 with Teensyduino 1.44 install on Windows 10.

  6. #231
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,596
    NEVERMIND...forgot that I had de-soldered some resistors and had to jumper a few more things than normal. Works fine on a fresh 1.8.7 with Teensyduino 1.44 install on Windows 10.
    Ok, but not sure what that means when I am dealing with a normal breakout board. Are you using your board or a breakout board? Just curious I am not having a problem with Wire when using Kris Winer's library.

  7. #232
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    580
    I'm using the breakout board from Embedded Masters:
    https://octopart.com/emsensr-mpu9250...sters-75645249

    To get SPI to work on that breakout there are a couple 0 Ohm resistors that need to be de-soldered, which I did. The thing is that then, you need to remember to tie nCS to power for I2C to work properly.

    If you can send some photos of your setup that might help diagnose what's going on.

  8. #233
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,596
    To get SPI to work on that breakout there are a couple 0 Ohm resistors that need to be de-soldered, which I did. The thing is that then, you need to remember to tie nCS to power for I2C to work properly.
    Oh, ok now I understand what you were talking about. I have that board as well and modified it to use SPI. Didn't know all I had to do to I2C to work again was to tie nCS to power. Glad I asked.

    Still have to figure out why I am having issues with other breakout boards.

    TEMP CALC WRONG IN LIBRARY. By the way when I was working with the temp calc noticed you had the calculation wrong:
    IS:
    Code:
    _t = ((((float) _tcounts) - _tempOffset)/_tempScale) + _tempOffset;
    SHOULD BE:
    Code:
     _t = ((float) _tcounts / _tempScale) + _tempOffset)

  9. #234
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,596
    Hi Brian - on the embedded masters 9250 breakout board I seem to remember you also had to connect vdio to vdd and FSYNC to ground is that correct?

    EDIT: THANKS FOR THE FAST RESPONSE

  10. #235
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    580
    Yes, correct.

  11. #236
    Junior Member
    Join Date
    May 2020
    Posts
    15
    Hello everybody,

    I want to read the BMI160 with teensy3.6.
    I get the code from hanyazou and get the following error: Wire.endTransmission() failed.

    How can it set the sda, scl pin configuration in the BMI160Gen.cpp oder .h?
    Do you have an idea?

  12. #237
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    580
    Quote Originally Posted by Siggi88 View Post
    Hello everybody,

    I want to read the BMI160 with teensy3.6.
    I get the code from hanyazou and get the following error: Wire.endTransmission() failed.

    How can it set the sda, scl pin configuration in the BMI160Gen.cpp oder .h?
    Do you have an idea?
    Seems like this deserves its own thread.

  13. #238
    Junior Member
    Join Date
    Aug 2019
    Posts
    10
    Hello,

    I try to use the brian taylor library for the mpu9250 (the library have been downloaded using the arduino library manager)
    I try to use the library with a basic blue mpu9250 board like this one : https://www.robot-maker.com/shop/cap...0-spi-217.html on a teensy 4.0 board.



    I connect :
    MPU9250 TO Teensy 4.0
    VCC 5V ( the mpu board have a 3.3V converter integrated)
    GND GND
    SCL/SCLK 13
    SDA/SDI 11
    AD0/SDO 12
    NCS 10
    FSYNC GND

    Other MPU9250 pins are left unconnected.

    I use the Basic SPI code to make a simple test.


    Code:
    /*
    Basic_SPI.ino
    Brian R Taylor
    brian.taylor@bolderflight.com
    
    Copyright (c) 2017 Bolder Flight Systems
    
    Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
    and associated documentation files (the "Software"), to deal in the Software without restriction, 
    including without limitation the rights to use, copy, modify, merge, publish, distribute, 
    sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all copies or 
    substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
    BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
    DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    */
    
    #include "MPU9250.h"
    
    // an MPU9250 object with the MPU-9250 sensor on SPI bus 0 and chip select pin 10
    MPU9250 IMU(SPI,10);
    int status;
    
    void setup() {
      // serial to display data
      Serial.begin(115200);
      while(!Serial) {}
    
      // start communication with IMU 
      status = IMU.begin();
      if (status < 0) {
        Serial.println("IMU initialization unsuccessful");
        Serial.println("Check IMU wiring or try cycling power");
        Serial.print("Status: ");
        Serial.println(status);
        while(1) {}
      }
    }
    
    void loop() {
      // read the sensor
      IMU.readSensor();
      // display the data
      Serial.print(IMU.getAccelX_mss(),6);
      Serial.print("\t");
      Serial.print(IMU.getAccelY_mss(),6);
      Serial.print("\t");
      Serial.print(IMU.getAccelZ_mss(),6);
      Serial.print("\t");
      Serial.print(IMU.getGyroX_rads(),6);
      Serial.print("\t");
      Serial.print(IMU.getGyroY_rads(),6);
      Serial.print("\t");
      Serial.print(IMU.getGyroZ_rads(),6);
      Serial.print("\t");
      Serial.print(IMU.getMagX_uT(),6);
      Serial.print("\t");
      Serial.print(IMU.getMagY_uT(),6);
      Serial.print("\t");
      Serial.print(IMU.getMagZ_uT(),6);
      Serial.print("\t");
      Serial.println(IMU.getTemperature_C(),6);
      delay(100);
    }
    The output I have on the serial monitor is :

    IMU initialization unsuccessful

    Check IMU wiring or try cycling power

    Status: -2




    Can someone confirm me that the librarie I try to use can be used on a teensy4.0?
    I read in another thread that status = - 2 was a " spi problem "... Does I need to rewrite some code to make it working?
    Can someone help me to figure what step is wrong in my experiment?

    Thank you in advance

    Best regards.

  14. #239
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    580
    The library has not been updated for Teensy 4.x. There has been a fork and a PR to incorporate the necessary updates, but I haven't managed to test it yet (still haven't taken my Teensy 4 out of the package...). The PR is here, if you would like to give it a go:
    https://github.com/bolderflight/MPU9250/pull/64

  15. #240
    Junior Member
    Join Date
    Aug 2019
    Posts
    10
    Quote Originally Posted by brtaylor View Post
    The library has not been updated for Teensy 4.x. There has been a fork and a PR to incorporate the necessary updates, but I haven't managed to test it yet (still haven't taken my Teensy 4 out of the package...). The PR is here, if you would like to give it a go:
    https://github.com/bolderflight/MPU9250/pull/64
    Thank you for this fast reply.
    I will give it a try and come back with my result.

  16. #241
    Junior Member
    Join Date
    Aug 2019
    Posts
    10
    With the modification made, now the status is 1 as expected and basic spi as well as interrupt spi seems to work well.
    Thank you!

    Note : I only added the
    #if defined(__IMXRT1062__)
    #else
    #endif
    part in the .cpp file.

    I don't know what is the "int readSensorCounts(int16_t* rawValues);" modification in the .h file ...

    Best regards.

  17. #242
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    580
    Quote Originally Posted by Mike118 View Post
    With the modification made, now the status is 1 as expected and basic spi as well as interrupt spi seems to work
    I don't know what is the "int readSensorCounts(int16_t* rawValues);" modification in the .h file ...
    IIRC, some people wanted access to the raw counts from the sensor data instead of the float values.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •