energia / Energia

Fork of Arduino for the Texas Instruments LaunchPad's
http://energia.nu
Other
794 stars 672 forks source link

CC3200: Issues with I²C #444

Closed rei-vilo closed 9 years ago

rei-vilo commented 10 years ago

The example provided for the BMA222 works fine.

For the TMP006, there's no example provided.

Reuse the library and sketch from the Educational BoosterPack MK-2 and

capture 2014-08-18 a 11 11 07

#define S0 1

Unfortunately, results are strange.

Temp in C = 397.33 Temp in C = 397.07 Temp in C = 397.11 Temp in C = 397.19 Temp in C = 397.32

Now, trying with other I²C sensors fails.

Both the HMC6352 and the SensorHub BoosterPack return no answer.

rei-vilo commented 10 years ago

I don't have a logic analyser at hand to check the signals and speed.

Any other beta-testers luckier than me?

rei-vilo commented 10 years ago

By default, speed is set to 400 kHz by true in MAP_I2CMasterInitExpClk(I2C_BASE, F_CPU, true) at Wire.cpp line 45.

void TwoWire::begin(void)
{
    MAP_PRCMPeripheralClkEnable(PRCM_I2CA0, PRCM_RUN_MODE_CLK);
    MAP_PinTypeI2C(PIN_01, PIN_MODE_1);
    MAP_PinTypeI2C(PIN_02, PIN_MODE_1);
    MAP_PRCMPeripheralReset(PRCM_I2CA0);
    MAP_I2CMasterInitExpClk(I2C_BASE, F_CPU, true);
}

See 7.2.2.1 Standard and Fast Modes page 167 in CC3200 Technical Reference Manual (swru367a)

So I changed it for false and I continue my explorations...

rei-vilo commented 10 years ago

Even at slow speed 100 kHz, the I²C sensors of the SensorHub BoosterPack don't sent any answer: SHT21, BMP180, TMP006, ISL29023. Neither does the HMC6352.

Obviously, I've removed the J2 and J3 jumpers.

robertinant commented 10 years ago

I just tried this with the Adafruit TMP006 and the example Sketch that comes with it: https://github.com/adafruit/Adafruit_TMP006 Make sure that you comment: Adafruit_TMP006 tmp006; and uncomment Adafruit_TMP006 tmp006(0x41);

Sketch output

Adafruit TMP006 example
Object Temperature: 22.97*C
Die Temperature: 27.31*C
Object Temperature: 26.38*C
Die Temperature: 27.25*C
Object Temperature: 26.75*C
Die Temperature: 27.28*C
Object Temperature: 30.12*C
Die Temperature: 27.22*C
Object Temperature: 26.93*C
Die Temperature: 27.28*C
Object Temperature: 27.31*C
Die Temperature: 27.22*C
Object Temperature: 26.25*C
Die Temperature: 27.22*C
Object Temperature: 24.19*C
Die Temperature: 27.22*C
Object Temperature: 24.64*C
Die Temperature: 27.19*C
Object Temperature: 26.65*C
Die Temperature: 27.19*C
Object Temperature: 24.28*C
Die Temperature: 27.22*C
Object Temperature: 23.73*C
Die Temperature: 27.22*C
Object Temperature: 23.40*C
Die Temperature: 27.22*C
Object Temperature: 23.22*C
rei-vilo commented 10 years ago

No luck!

dafruit TMP006 example mid = 0xFFFF did = 0xFFFF No sensor found

reaper7 commented 10 years ago

adafruit lib works for me too, without any modifications inside Wire lib (oryginal from 13b2) I tested too OLED ssd1306 (i2c) - works OK

rei-vilo commented 10 years ago

Great to know.

spirilis commented 10 years ago

@rei-vilo Can you check the voltage on the I2C lines? Wonder if something's wonky with yours...

rei-vilo commented 10 years ago

I'll check back home next week where I've all my equipment.

rei-vilo commented 10 years ago

I've done a clean build and install of Energia and I²C now reads both the built-in BMA222 and TMP006.

Other sensors tomorrow.

robertinant commented 10 years ago

I just checked this again and with the BMA222 and TMP006. Both of them work for me. I also tested with all the sonsors on the sensorhub boosterpack. All of them work except the BMP180 which seems to be clock stretching and I don't think it is handled correctly in the Wire library for CC3200.

Note that the sensorhub boosterpack has the I2C pins on the legacy pins 14 and 15 whereas the CC3200 has them on the "new standard" pins 9 and 10. Simply blue wiring those pins on the bottom header makes it works.

rei-vilo commented 10 years ago

For the TMP006 on the CC3200, the library from Adafruit works fine but not the library from the Educational BoosterPack MK-2.

On the CC3200, sketch freezes at this instruction being polled

uint8_t tmp006::ready(void)
{
     if (CONVERSION_DONE & readRegister(TMP006_CONFIG_REG))
        return 1;
     else
        return 0;
}

with

#define CONVERSION_DONE     0x0080
#define TMP006_CONFIG_REG          0x02

while the same sketch runs smoothly on the LM4F120 or TM4C123.

Any idea?

reaper7 commented 10 years ago

stalla & tiva connected to cc3200 TMP? or You check this with external TMP006?

CC3200 in http://www.ti.com/lit/ug/swru372/swru372.pdf (page9) have TMP008 ??, maybe is there some difference, maybe e.g. tmp008 do not have DATAREADY register bit? Your schemat in first post is from cc3200?

AdaFruit lib don't check this bit before reading data

rei-vilo commented 10 years ago

Strange, as the schematics mention a TMP006 as illustrated in the first post.

There's a newly launched TMP007 (link) but looking for the TMP008 on TI website throws a 404 error.

rei-vilo commented 9 years ago

This issue was related to #496.

Old I²C libraries weren't updated.

robertinant commented 9 years ago

Is this still an issue then?

rei-vilo commented 9 years ago

No, I just provide the explanation for the records.

robertinant commented 9 years ago

Ok, thanks!

viggi1000 commented 9 years ago

@reaper7 Could I please have your port of the ssd1306?