Jump to content
Sign in to follow this  
ckd

Interfacing BMG250 with TM4C1294XL

Recommended Posts

I am working on TM4C1294XL board and through Energia platform. I am trying to get the outputs from BMG250 shuttle board. I am pasting the code below but I believe the code has no fault. I have doubts about the connections to the shuttle board. I am getting -1 (when dividing outputs by 256) in all the three axis. I am sharing the schematic pdf that has information about the shuttle board connections. I have connected as given in the file but I have the following doubts:

1. How can set the pmu_status to normal gyroscope as it is mentioned in the datasheet as only readable? And when I read the pmu_status to know the current mode, I only get a 0 as the output and no output comes for the three axis.

2. In the schematic pdf, it can be seen that there are multiple SDO, SCL etc. Should I connect them to each other or use only one of them?

Somebody help me out.

Code :-

#include "Wire.h"

#define pmu_status 0x03
#define data 0x12
#define gyr_config 0x42
#define gyr_range 0x43
#define offset 0x74
#define dataReadyStatus 0x1B
#define X_axis_dataX0 0x12
#define X_axis_dataX1 0x13
#define Y_axis_dataY0 0x14
#define Y_axis_dataY1 0x15
#define Z_axis_dataZ0 0x16
#define Z_axis_dataZ1 0x17
#define command 0x7E

int gyrAddress=0x68;
long X0,X1,Y0,Y1,Z0,Z1;
long X_out,Xg,Y_out,Yg,Z_out,Zg;

void setup() {
  Wire.setModule(0);
  Wire.begin();
  Serial.begin(115200);

  Wire.beginTransmission(gyrAddress);
  Wire.write(gyr_config);
  Wire.write(0x28);
  Wire.write(command);
  Wire.write(0x15);
  Wire.write(gyr_range);
  Wire.write(0x00);
  Wire.endTransmission();

}

void loop() {
  Wire.beginTransmission(gyrAddress);
  Wire.write(X_axis_dataX0);
  Wire.write(X_axis_dataX1);
  Wire.endTransmission();
  Wire.requestFrom(gyrAddress,2);
  if(Wire.available()<=2)
  {
    X0 = Wire.read();
    X1 = Wire.read();

    X1 = X1<<8;
    X_out = X0+X1;
    Xg = (X_out)/1.0;
  }

  Wire.beginTransmission(gyrAddress);
  Wire.write(Y_axis_dataY0);
  Wire.write(Y_axis_dataY1);
  Wire.endTransmission();
  Wire.requestFrom(gyrAddress,2);
  if(Wire.available()<=2)
  {
    Y0 = Wire.read();
    Y1 = Wire.read();

    Y1 = Y1<<8;
    Y_out = Y0+Y1;
    Yg = (Y_out)/1.0;
  }

  Wire.beginTransmission(gyrAddress);
  Wire.write(Z_axis_dataZ0);
  Wire.write(Z_axis_dataZ1);
  Wire.endTransmission();
  Wire.requestFrom(gyrAddress,2);
  if(Wire.available()<=2)
  {
    Z0 = Wire.read();
    Z1 = Wire.read();

    Z1 = Z1<<8;
    Z_out = Z0+Z1;
    Zg = (Z_out)/1.0;
  }

  Serial.print("Xg = ");
  Serial.print(Xg);
  Serial.print("\t");
  Serial.print("Yg = ");
  Serial.print(Yg);
  Serial.print("\t");
  Serial.print("Zg = ");
  Serial.println(Zg);

  delay(200);
}

 

SCHEMATIC1 _ BMG250.pdf

Share this post


Link to post
Share on other sites

Hi @ckd

I don't know that anyone is using this device with the TM4C1294 or Energia.  Have you tried searching for Arduino libraries and porting them or at least looking at how they have implemented?

Share this post


Link to post
Share on other sites
15 minutes ago, Fmilburn said:

Hi @ckd

I don't know that anyone is using this device with the TM4C1294 or Energia.  Have you tried searching for Arduino libraries and porting them or at least looking at how they have implemented?

Thank you for your reply.

Yes I have gone through the implementation of the BMG160 with arduino. That is why I think the code is not having any fault. The problem is that Bosch has implanted the BMG250 IC on a shuttle board and there is not much information about it on the internet apart from the schematic that I have attached above. There has to be some problem either with the shuttle board connections or I am missing something to initialize. I am checking on the later part.

Share this post


Link to post
Share on other sites

I am just guessing on the schematic.  It looks like pins 15-18 on the shuttle_con go to U1, the BMI160.  I suspect you need to make your connections from the LaunchPad to pins 4-7.

Share this post


Link to post
Share on other sites
1 hour ago, Fmilburn said:

I am just guessing on the schematic.  It looks like pins 15-18 on the shuttle_con go to U1, the BMI160.  I suspect you need to make your connections from the LaunchPad to pins 4-7.

Thank you,

I connected it to pin 4-6 as pin 7 is of no use as it is already connected to the VDDIO. If you see fig. 33 on page 62 of the datasheet, it can be seen that VDDIO is connected to SCL and SDA through resistors. I do not know the value of these resistors. But in table 26, page 51 it is given the value of resistors for VDDIO pull-up to be 100K ohm. But when I connect the resistors I get the value 0 in all three axis. Currently I have connected VDDIO and SDA and SCL without any resistors in between.

BMG250-datasheet.pdf

Share this post


Link to post
Share on other sites

Section 4.1.3 of the BMG250 datasheet says

Quote

4.1.3 I2C Interface
The I2C bus uses SCL (= SCx pin, serial clock) and SDA (= SDx pin, serial data input and output)
signal lines. Both lines are connected to V DDIO externally via pull-up resistors so that they are
pulled high when the bus is free.

I do not see any pullup resistors on the schematic in the first post.  

I have attached a screen grab of one of my circuits for reference.

Are they installed in your circuit?

43oh - Screenshot from 2018-05-16 14-38-38.png

Share this post


Link to post
Share on other sites
10 hours ago, zeke said:

Section 4.1.3 of the BMG250 datasheet says

I do not see any pullup resistors on the schematic in the first post.  

I have attached a screen grab of one of my circuits for reference.

Are they installed in your circuit?

43oh - Screenshot from 2018-05-16 14-38-38.png

Hi zeke!

I tried by pulling up the SCL and SDA pins of BMG250, it did not work. But point is that I have already pulled up I2C pins (of tm4c1294xl board) that are coming to BMG250. I thought pulling up these pins would not be needed.

Moreover, there is no pin defined as SDO on the shuttle board (refer rightmost fig in the schematic) which is used to set the address of the device. I am just relying on the schematic given above and connections written in red (I don't know if they are right).

Share this post


Link to post
Share on other sites

@ckd,

Extra pullups on the SDA and SCL lines will make things worse, so don't do that.

On the J1 (SHUTTLE_COM) connector, there are assignments for the I2C signals: SCL (Pin 18) and SDA (PIN 17).  There should be only one set of pullup resistors on those lines. If they are on the ARM board then that is okay. If they are not installed then they need to be installed.

As a quick test, use your voltmeter and measure the value of the SCL and SDA lines with no traffic on them. Are they the same value as VDD? 

If yes, then that is a good sign the resistors are installed.

If no, then that is a good sign the resistors are not installed.

If possible, wire up your logic analyzer to SCL and SDA and record some I2C bus traffic. See if your logic analyzer software can interpret the information properly.

If you do not have a logic analyzer then use your oscilloscope and attempt to see signals transitioning between a low and high signal value.

Side note: I have to do this very same process to a project that I am working on right now. Fingers crossed, we will both get our circuits running!

Share this post


Link to post
Share on other sites

@zeke

I also hope that we both get it working. But for the time being I have shifted to another sensor as I have mailed to the Bosch with my doubts and waiting for their response.

Share this post


Link to post
Share on other sites

@Rei Vilo

That is a pretty significant small detail!!! 

I have had a few moments to reflect on my software and it is so strange to realize that I too had to add in delay to get my i2c routines working.

I was writing an i2c command to my device and then attempting to read a byte response from it. It was not working.

For debugging, I inserted a 5000 cycle delay between the command write and the data read so I could see the action on my logic analyzer. 

It had the side effect of making my transaction succeed!

And now you have shown us the exact same thing with the Bosch sensor!

Bravo!

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×