Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 25 of 25

Thread: IMU teensy 3.6

  1. #1

    IMU teensy 3.6

    I cannot get any reading from the imu using this code below. I can get reading from it from other boards but when i switched to the teensy 3.6 it now will not work any help is much appreciated




    #include <Wire.h>

    #include "SparkFun_BNO080_Arduino_Library.h"
    BNO080 myIMU;

    #define BNO_ADDRESS (0x4A) // device address when SA0 Pin 17 = GND; 0x4B SA0 Pin 17 = VDD
    #define N_RST (24) // N_RST pin of BNO080
    void setup()
    {
    Serial.begin(115200);
    Serial.println();
    Serial.println("BNO080 Read Example");

    Wire.begin();

    myIMU.begin();

    //Wire.setClock(400000); //Increase I2C data rate to 400kHz
    //---------------------------------------------------------------
    digitalWrite(N_RST, LOW); // Reset pulse active low
    pinMode(N_RST, OUTPUT);
    delay(100); // not clear how long this must be. reset probably not needed at all
    digitalWrite(N_RST, HIGH);
    //-------------------------------------------------------------------
    myIMU.enableAccelerometer(50); //Send data update every 50ms

    Serial.println(F("Accelerometer enabled"));
    Serial.println(F("Output in form x, y, z, in m/s^2"));

    //------------------------------------------------------------------------
    Wire.beginTransmission(BNO_ADDRESS);
    while (Wire.endTransmission() != 0); //wait until device is responding (32 kHz XTO running)
    Serial.println("BNO found");

    delay(200); //needed to accept feature command; minimum not tested
    //--------------------------------------------------------------------------
    }

    void loop()
    {
    //Look for reports from the IMU
    if (myIMU.dataAvailable() == true)
    {
    float x = myIMU.getAccelX();
    float y = myIMU.getAccelY();
    float z = myIMU.getAccelZ();

    Serial.print(x, 2);
    Serial.print(F(","));
    Serial.print(y, 2);
    Serial.print(F(","));
    Serial.print(z, 2);
    Serial.print(F(","));

    Serial.println();
    }
    }

  2. #2
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    339
    You mean the setup runs fine and finds the board ("BNO found"), but the main loop never prints anything (so myIMU.dataAvailable() returns false)?

  3. #3
    Click image for larger version. 

Name:	nodata.JPG 
Views:	17 
Size:	74.4 KB 
ID:	20592

    this is all i get

    im using the i2c wiring with 2.2k pu resistors on the sda and scl wires. ive had it working and printing imu values from a adafruit board, but i really need to use the teensy board from here out its a much better platform for me.

    this is the imu im using:
    FSM30x-Datasheet.pdf

  4. #4
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    277
    So it does not want to communicate over I2C.

    Did the exact same sketch listed above run on other boards? If so, which boards?

    I see this line: #define N_RST (24) // N_RST pin of BNO080, shouldn't that be: #define N_RST 24 (without brackets).
    I would comment out the 4 reset lines anyway, since they are also not in Sparkfun's example code at https://github.com/sparkfun/SparkFun...awReadings.ino
    Also pinMode(N_RST, OUTPUT); should come before digitalWrite(N_RST, LOW);.

    For testing, I would comment out these 4 lines:
    Code:
    Wire.beginTransmission(BNO_ADDRESS);
    while (Wire.endTransmission() != 0); //wait until device is responding (32 kHz XTO running)
    Serial.println("BNO found");
    
    delay(200); //needed to accept feature command; minimum not tested
    Did you hookup the board according to this diagram?

    Click image for larger version. 

Name:	Capture.PNG 
Views:	8 
Size:	166.0 KB 
ID:	20594

    Both PS0 and PS1 pins should be connected to GND to select I2C communication. PS1 is pulled-up at the FSM30x board.

    Paul

  5. #5
    Click image for larger version. 

Name:	IMG_1585.jpg 
Views:	14 
Size:	181.5 KB 
ID:	20595

    i have PS0 and PS1 conected to ground, and i commented out the lines you suggested and changes. still does prints no values. I commented out the NRST lines but they were necessary for it to work on a adafruit board and different code. I originally only had the PS0 pin grounded when it was working on the adafruit board as well. but as i said above, i added PS1 to ground currently and still does nothing

  6. #6
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    277
    I'm looking at the photo you attached and it looks like there is more electronics attached to the Teensy 3.6 than just the FSM30x board, correct?
    For example, on the T3.6, the SDA & SCL wires are white & yellow but on the FSM30x board these wires are orange & green.
    If so, could you temporarily remove all the other stuff and just test with the FSm30x board and the Sparkfun example sketch [and post a photo again]?

    Paul

  7. #7
    Quote Originally Posted by PaulS View Post
    I'm looking at the photo you attached and it looks like there is more electronics attached to the Teensy 3.6 than just the FSM30x board, correct?
    For example, on the T3.6, the SDA & SCL wires are white & yellow but on the FSM30x board these wires are orange & green.
    If so, could you temporarily remove all the other stuff and just test with the FSm30x board and the Sparkfun example sketch [and post a photo again]?

    Paul
    no there's nothing else attached, the wires go from male to female and whatever is out of the pic just loops back around to where its supposed to go.

    i re wired with all consistent colors so you can see where they are going to, PS0, PS1 are orange, NRST= blue, power = red, black = gnd, yellow = scl, white = sda.

    its not allowing me to upload a pic yet i'll try again in a minute

  8. #8
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    277
    Just found out that the FSM30x board default I2C address is 0x4A [pin SA0 is pulled-down on the board].
    The Sparkfun library uses default 0x4B, see https://github.com/sparkfun/SparkFun...uino_Library.h. You may want to change that to 0x4A [line 42].

    For a basic hardware/software test, I would start with the most simple example first: https://github.com/sparkfun/SparkFun...tionVector.ino.

    Paul

  9. #9
    Quote Originally Posted by PaulS View Post
    Just found out that the FSM30x board default I2C address is 0x4A [pin SA0 is pulled-down on the board].
    The Sparkfun library uses default 0x4B, see https://github.com/sparkfun/SparkFun...uino_Library.h. You may want to change that to 0x4A [line 42].

    For a basic hardware/software test, I would start with the most simple example first: https://github.com/sparkfun/SparkFun...tionVector.ino.

    Paul

    look above at the code i posted i already changed it to 4A

  10. #10
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    277
    I'm not sure the #define works as intended with the brackets around 0x4A, perhaps try #define BNO_ADDRESS 0x4A ?
    And are you sure that
    Code:
    Wire.beginTransmission(BNO_ADDRESS);
    while (Wire.endTransmission() != 0); //wait until device is responding (32 kHz XTO running)
    Serial.println("BNO found");
    works OK?

    Paul

  11. #11
    Quote Originally Posted by PaulS View Post
    I'm not sure the #define works as intended with the brackets around 0x4A, perhaps try #define BNO_ADDRESS 0x4A ?
    And are you sure that
    Code:
    Wire.beginTransmission(BNO_ADDRESS);
    while (Wire.endTransmission() != 0); //wait until device is responding (32 kHz XTO running)
    Serial.println("BNO found");
    works OK?

    Paul
    no, it has always been 0x4A still does not work

    tried without the bracketsClick image for larger version. 

Name:	err.JPG 
Views:	5 
Size:	27.8 KB 
ID:	20596

    but now says error BNO not found at "default" address. so it must not be changing the address the 0x4A?

  12. #12
    Quote Originally Posted by PaulS View Post
    I'm not sure the #define works as intended with the brackets around 0x4A, perhaps try #define BNO_ADDRESS 0x4A ?
    And are you sure that
    Code:
    Wire.beginTransmission(BNO_ADDRESS);
    while (Wire.endTransmission() != 0); //wait until device is responding (32 kHz XTO running)
    Serial.println("BNO found");
    works OK?

    Paul
    so i am finding that when i hook any i2c device to the teensy 3.6 and use the i2c scanner its not finding anything. what am i missing with the 3.6 board that it wont find anything?

    EDIT.... I moved to pins 17 and 16 on the teeensy board, and now the scanner will scan for items on i2c but it will not return back anything valid. just says unknown error at 0xxx addresses. it will not find the address of the i2c device connected, but is scanning.
    Last edited by Fox95; 06-13-2020 at 10:47 PM.

  13. #13
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,552
    Know this is late advice but are you sure you have SDA attached to pin 18 and SCL attached to pin 19? Its a bit hard to tell by the photo you attached. If the scanner is not returning anything 2 things - pwr is not connected correctly or you have SDA/SCL reversed.

  14. #14
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    277
    so i am finding that when i hook any i2c device to the teensy 3.6 and use the i2c scanner its not finding anything. what am i missing with the 3.6 board that it wont find anything?
    Strange. I would focus on getting the I2C-scanner to work on pins 19 & 18.
    Can you check for waveforms on pins 19 & 18 on the Teensy 3.6 when running the scanner? Also check for waveforms on the I2C pins of the FSm30x board.
    For what it's worth: I had bad experiences with the cheapo flywires [a.k.a. Mini-PV or DuPont wires] with the molded round connector housings - pin oxidation, broken wires, etc. I threw them all away and only use flywires with a square housing with crimped connectors.

    Paul

  15. #15
    Quote Originally Posted by PaulS View Post
    Strange. I would focus on getting the I2C-scanner to work on pins 19 & 18.
    Can you check for waveforms on pins 19 & 18 on the Teensy 3.6 when running the scanner? Also check for waveforms on the I2C pins of the FSm30x board.
    For what it's worth: I had bad experiences with the cheapo flywires [a.k.a. Mini-PV or DuPont wires] with the molded round connector housings - pin oxidation, broken wires, etc. I threw them all away and only use flywires with a square housing with crimped connectors.

    Paul
    i cannot get the 3.6 to find any i2c devices at all, i have moved several i2c devices to the 3.6 that are known to work on other boards and that have internal pull up resistors(adafruit) and they will not show up on the 3.6 on any of the pins for scl sda

    is there any type of firmware updates that may be necessary for the 3.6 or known bugs that may solve this problem.

  16. #16
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,552
    I have used the T3.6 with a variety of different i2c devices with out any problem. Right now i am using IDE1.8.12 and TD1.52 (latest version).

    Out of curiosity which I2Cscanner are you using PJRC has its own that works well with the Teensies and other boards. A couple of other scanners have issues with Arduino and/or Teensy boards. I can not find a link to the official version but here is the one i am using. You may want to give it a try before you go crazy.
    Attached Files Attached Files

  17. #17
    Quote Originally Posted by mjs513 View Post
    I have used the T3.6 with a variety of different i2c devices with out any problem. Right now i am using IDE1.8.12 and TD1.52 (latest version).

    Out of curiosity which I2Cscanner are you using PJRC has its own that works well with the Teensies and other boards. A couple of other scanners have issues with Arduino and/or Teensy boards. I can not find a link to the official version but here is the one i am using. You may want to give it a try before you go crazy.
    thanks for that, tried it just now, still nothing. runs through the whole list of addresses and finds nothing.

    I checked the i2c board with a scope and it works on a adafruit board out outputs a wave pattern as you'd expect, but when same board is connected to the teensy 3.6 pins 18/19 nothing there is no wave patterns. it does have proper power and ground.

  18. #18
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,552
    Are you doubly sure about your connections:
    Device -------- T3.6
    Pwr ------------ 3.3v (remember T3.6 is a 3.3v device)
    GND ----------- Gnd
    SCL ------------ pin 19
    SDA ------------ pin 18

    Have to ask. Usually when I don't find a device with i2cscanner i just swap the connections for SDA/SCL and it finds it.

  19. #19
    Quote Originally Posted by mjs513 View Post
    Are you doubly sure about your connections:
    Device -------- T3.6
    Pwr ------------ 3.3v (remember T3.6 is a 3.3v device)
    GND ----------- Gnd
    SCL ------------ pin 19
    SDA ------------ pin 18

    Have to ask. Usually when I don't find a device with i2cscanner i just swap the connections for SDA/SCL and it finds it.
    yes, just like the pics above, 3.3 volt source on (3rd pin down right next to 23) GND and pin 19 and 18

  20. #20
    Quote Originally Posted by mjs513 View Post
    Are you doubly sure about your connections:
    Device -------- T3.6
    Pwr ------------ 3.3v (remember T3.6 is a 3.3v device)
    GND ----------- Gnd
    SCL ------------ pin 19
    SDA ------------ pin 18

    Have to ask. Usually when I don't find a device with i2cscanner i just swap the connections for SDA/SCL and it finds it.
    I have found the source of problem. thanks for your help. it is working correctly now. there was a issue with the breadboard. so frustrating....

  21. #21
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,552
    ok I am at a total loss here.

    I just hooked up my BNO080 sparkfun sensor and ran I2CScanner and go the following results:
    Code:
    I2C Scanner
    
    Scanning...
    Device found at address 0x4B  (ADS1115,TMP102)
    done

  22. #22
    Quote Originally Posted by mjs513 View Post
    ok I am at a total loss here.

    I just hooked up my BNO080 sparkfun sensor and ran I2CScanner and go the following results:
    Code:
    I2C Scanner
    
    Scanning...
    Device found at address 0x4B  (ADS1115,TMP102)
    done
    it's fixed, im now getting IMU readings.

    on to the next set problems LOL..... what do you know about CAN messaging? haha

  23. #23
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,552
    A little bit

    Head over to this thread: https://forum.pjrc.com/threads/56035...ght=flexcan_t4.

    And if your question is can you send IMU data through CAN messages the answer is yes.

    You can check this out: https://forum.pjrc.com/threads/52906...l=1#post182225

  24. #24
    Quote Originally Posted by mjs513 View Post
    A little bit

    Head over to this thread: https://forum.pjrc.com/threads/56035...ght=flexcan_t4.

    And if your question is can you send IMU data through CAN messages the answer is yes.
    thats what i need to do, I have a waveshare CAN board and I need to send roll, pitch, yaw, and accleration over CAN

  25. #25
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,552
    Quote Originally Posted by Fox95 View Post
    thats what i need to do, I have a waveshare CAN board and I need to send roll, pitch, yaw, and accleration over CAN
    You can check this out: https://forum.pjrc.com/threads/52906...l=1#post182225. Posted this about the same time for the IFCT library. FLEXCAN_T4 wont run on the T3.6 but the IFCT library will

Posting Permissions

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