Jump to content
43oh

Energia + CC3200 + I2C + MLX90614


Recommended Posts

I have a project using an MLX90614 that I have prototyped on an Arduino. Now I want to move to the CC3200 to add WiFi support. I've been fighting with the I2C for a few days now and could use some help.

 

A few notes:

  • The built-in I2C sensors (BMA222 and TMP006) work fine in the default configuration.
  • The max speed for the MLX90614 is 100 KHz, but the default for the CC3200 is 400 KHz
  • The MLX90614 is technically SMBus, but it works flawlessly with the Wire library on a standard Arduino.

I have modified the Wire library in the hardware/cc3200 folder to call MAP_I2CMasterInitExpClk(I2C_BASE, F_CPU, false) instead of MAP_I2CMasterInitExpClk(I2C_BASE, F_CPU, true). According to the code in driverlib/i2c.c, this should cause the bus to run at 100 KHz. This change does not make the MLX90614 work, but it does cause the other two sensors (BMA222 and TMP006) stop functioning properly. (The TMP006 fails to be recognized, and the BMA222 returns incorrect data - x, y, and z all seem to show the x value or the y value... not sure which.)

 

After searching the web and this forum, this I've gotten this far but now run into a dead end.

 

Does anybody have experience with I2C on the CC3200 with Energia and a slower-speed bus?  I'd like to avoid rewriting my project in CCS if possible.

 

Thanks much!

 

-Nathan

 

Link to post
Share on other sites

Quick clarification about what is "not" working:

 

With the MLX90614 on the I2C bus running at 100 KHz, I seem to be getting back 0xFF for everything.

 

Also, here's some info that I came across regarding this.

https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/t/537475

 

I have already ensured that I'm not sending a stop bit when requesting the register value. Here's the relevant code from the Adafruit MLX90614 library:

uint16_t Adafruit_MLX90614::read16(uint8_t a) {
  uint16_t ret;

  Wire.beginTransmission(_addr); // start transmission to device 
  Wire.write(a); // sends register address to read from
  Wire.endTransmission(false); // end transmission (no stop bit)
  
  Wire.requestFrom(_addr, (uint8_t)3);// send data n-bytes read
  ret = Wire.read(); // receive DATA
  ret |= Wire.read() << 8; // receive DATA

  uint8_t pec = Wire.read();

  return ret;
}
Also, I pulled this exact sensor from the CC3200 project and reattached it to an Arduino running the same code, and received valid values. Moved back to the CC3200 LaunchXL and I'm getting pure 0xFF again.

 

-Nathan

Link to post
Share on other sites

The breakout board I'm using (GY-906) supposedly uses the 3.3v version MLX90614ESF-BAA-000-TU-ND, and appears to have built-in 10k pullups for SDA and SCL, as well as a voltage regulator to allow it to use either 3.3v or 5v.

 

I have been using the 5v pin of the LaunchXL to power the sensor. I tried using VCC (3.3v) instead, but received much the same results. I also tried adding my own 10k pullups, but that had not effect either.

 

Today I'm not getting 0xFF 100% of the time. Still the results are usually 0xFF, but when I get other values they seem pretty random. The sensor still works properly when plugged into the Arduino project (without any extra pullups, 5v).

Link to post
Share on other sites

Thanks for the suggestion. I've tried with 5K pull-ups and 1K pull-ups, using the VCC 3.3v power supply to power the sensor. The 1K resistors seemed to maybe give the best results, allowing me to sometimes read the correct value for the occasional byte, though most of the time the value still showed 0xFF for each byte. Unfortunately, I don't currently have an oscilloscope to help with debugging.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...