ckd 0 Posted May 14, 2018 Share Posted May 14, 2018 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 Quote Link to post Share on other sites
Fmilburn 446 Posted May 15, 2018 Share Posted May 15, 2018 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? Quote Link to post Share on other sites
ckd 0 Posted May 15, 2018 Author Share Posted May 15, 2018 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. Quote Link to post Share on other sites
Fmilburn 446 Posted May 15, 2018 Share Posted May 15, 2018 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. Quote Link to post Share on other sites
ckd 0 Posted May 15, 2018 Author Share Posted May 15, 2018 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 Quote Link to post Share on other sites
zeke 693 Posted May 16, 2018 Share Posted May 16, 2018 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? Quote Link to post Share on other sites
ckd 0 Posted May 17, 2018 Author Share Posted May 17, 2018 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? 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). Quote Link to post Share on other sites
zeke 693 Posted May 17, 2018 Share Posted May 17, 2018 @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! Quote Link to post Share on other sites
ckd 0 Posted May 22, 2018 Author Share Posted May 22, 2018 @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. Quote Link to post Share on other sites
Rei Vilo 695 Posted May 22, 2018 Share Posted May 22, 2018 It looks like the I²C implementation requires a specific period between write and read. zeke and tripwire 1 1 Quote Link to post Share on other sites
zeke 693 Posted May 23, 2018 Share Posted May 23, 2018 @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! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.