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

Thread: Read BMI160 senor 6DOF 2 click with Teensy 3.6

  1. #1
    Junior Member
    Join Date
    May 2020
    Posts
    7

    Read BMI160 senor 6DOF 2 click with Teensy 3.6

    Hello everybody,

    I want to read the BMI160 with teensy3.6.
    I get the code from hanyazou (https://github.com/hanyazou/BMI160-Arduino)
    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?

  2. #2
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,099
    @Sigi88
    Unfortunately the library you reference: "hanyazou (https://github.com/hanyazou/BMI160-Arduino) " is setup for the Arduino Curie. I don't see any option that allow you set which pins without editing the library. You would have to edit the lib to change Wire calls to the Wire1, or Wire2 if you want to use other I2C buses? However it looks like its setup for I2C on Wire which would be pins 18 (SDA) and 19(SCL).

    Suggestions make sure your connections are to pins 18 and 19 and make sure your initialization is correct
    Code:
      BMI160.begin(BMI160GenClass::I2C_MODE, bmi160_i2c_addr);
    where for me the
    Code:
    bmi160_i2c_addr = 0x69

  3. #3
    Junior Member
    Join Date
    May 2020
    Posts
    7
    @mjs513 I try it with both channels for the I2c on teensy 3.6 but without success. The attempt with the Arduino Uno was successful.
    I always thought that Arduino's codes on the Teensy were apparently not the libraries.

    Do you know any code examples for i2c that are compatible with the Teensy?

  4. #4
    Junior Member
    Join Date
    May 2020
    Posts
    7
    @mjs513 I don't know how but now I get data from the sensor via pin 18 and 19. Now I want to try to connect 2 sensors.

  5. #5
    Junior Member
    Join Date
    May 2020
    Posts
    7
    In theory, you should be able to read and separate two sensors on the same i2c, right?

  6. #6
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    312
    Yes, if they have different I2C addresses!
    Sometimes you can setup the address via commands, sometimes via jumpers, sometimes not at all.

  7. #7
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,099
    If you look at the I2C schematic on the hanyazou (https://github.com/hanyazou/BMI160-Arduino) you can change from the default address to the BMI160's alt address by connecting SDO/SA0 pin of the BMI160 to 3.3v I believe. But off the top of my head forgot what the alt address is. You would also need to create a separate instance of the second address.

  8. #8
    Junior Member
    Join Date
    May 2020
    Posts
    7
    @mjs513 and XFer thank you. I use another acceleration senor platform (6DOF IMU 2click). So with a scanner code I get two different Ids (0x68 and 0x69)
    With the codes of hanyazou and yours I can only receive the Platform Id 209 / 1D. But it makes no distinction between Ids 0x69 and 0x68. I think I have to expand the libraries to that end.
    I would like to use your (mjs513) and the codes of hanyazou.

  9. #9
    Junior Member
    Join Date
    May 2020
    Posts
    7
    In principle I have to send a request to these divices to receive 0x68 and 0x69 in order to get information from them?

Posting Permissions

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