nkopp 0 Posted November 12, 2016 Share Posted November 12, 2016 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 Quote Link to post Share on other sites
nkopp 0 Posted November 12, 2016 Author Share Posted November 12, 2016 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 Quote Link to post Share on other sites
chicken 630 Posted November 12, 2016 Share Posted November 12, 2016 Are you sure your sensor works with 3.3V power and logic? Looking at the product page for the MLX90614, there seem to be separate versions for 3 and 5V supply voltage. https://www.melexis.com/en/product/MLX90614/Digital-Plug-Play-Infrared-Thermometer-TO-Can Quote Link to post Share on other sites
nkopp 0 Posted November 13, 2016 Author Share Posted November 13, 2016 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). Quote Link to post Share on other sites
dubnet 238 Posted November 13, 2016 Share Posted November 13, 2016 10K pullups may not be strong enough. You may want to try using something in the range of 3-5K and see if that yields better results. Quote Link to post Share on other sites
nkopp 0 Posted November 13, 2016 Author Share Posted November 13, 2016 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. Quote Link to post Share on other sites
Rei Vilo 695 Posted November 13, 2016 Share Posted November 13, 2016 To run the I Quote Link to post Share on other sites
nkopp 0 Posted November 14, 2016 Author Share Posted November 14, 2016 To run the I Quote Link to post Share on other sites
Rei Vilo 695 Posted November 14, 2016 Share Posted November 14, 2016 Have you tried the E2E forum at http://e2e.ti.com? The implementation of I Quote Link to post Share on other sites
nkopp 0 Posted November 15, 2016 Author Share Posted November 15, 2016 Another update: I've tested an equivalent demo using Code Composer Studio, and everything worked properly for both 400KHz and 100KHz speeds. So, it seems that the issue is with Energia. Quote Link to post Share on other sites
Rei Vilo 695 Posted November 15, 2016 Share Posted November 15, 2016 Please open a ticket at the Energia GitHub repository: https://github.com/energia/Energia/issues. 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.