Jump to content

hansober

Members
  • Content Count

    3
  • Joined

  • Last visited

  1. I'm using the SCL(1) & SDA(1), which are the default. I tested it out with a 16x2 LCD which has a I2C to parallel converter. This is what it looks like when connected to the I2C converter; the SCK line goes low, but SDA remains high. If I leave SDA floating, I get this: Notice that the SDA line remains low, but actually goes high during data transmission for some reason: how is this happening, since I2C is supposed to be open drain?!?
  2. @Rei Vilo. Typo. I'm using the MSP430FR5969 The HDC2010 is a 3.3V IC, so no level converters are needed. The one time it worked, it was connected to the mainboard, which has 1.8k pullups. Now that it is disconnected, what value do you recommend?
  3. I'm trying to connect the HDC2010 temperature sensor to the MSP430FR5969 Launchpad. I'm using the HDC2010 EVM, which consists of a MSP430F5528 (which handles USB communications to the GUI tool) and a HDC2010 (connected over I2C). The portion with the HDC2010 can be broken off from the main board in order to use it with another MCU. I'm attempting to connect it to a MSP430FR5969 Launchpad which has the SHARP Memory LCD (uses SPI) connected to it. I couldn't find a ready made library for the HDC2010 & MSP430, so I copied over some code from the Arduino library. To check whether I was using the HDC2010 correctly, I first used the following code (mostly taken from the HDC2010 lib) and used an Arduino Uno. I used MOSFET level translators (since the Arduino is 5V, HDC2010 is 3.3). I did not break off the HDC2010 section from the main board of the EVM, so the main MSP430F5528 was still connected to the HDC2010, but I guess it was idle. #define ADDR 0x40 #include <Wire.h> //Define Register Map #define TEMP_LOW 0x00 #define TEMP_HIGH 0x01 #define HUMID_LOW 0x02 #define HUMID_HIGH 0x03 #define INTERRUPT_DRDY 0x04 #define TEMP_MAX 0x05 #define HUMID_MAX 0x06 #define INTERRUPT_CONFIG 0x07 #define TEMP_OFFSET_ADJUST 0x08 #define HUM_OFFSET_ADJUST 0x09 #define TEMP_THR_L 0x0A #define TEMP_THR_H 0x0B #define HUMID_THR_L 0x0C #define HUMID_THR_H 0x0D #define CONFIG 0x0E #define MEASUREMENT_CONFIG 0x0F #define MID_L 0xFC #define MID_H 0xFD #define DEVICE_ID_L 0xFE #define DEVICE_ID_H 0xFF float temperature = 0, humidity = 0; void openReg(uint8_t reg) { Wire.beginTransmission(ADDR); // Connect to HDC2010 Wire.write(reg); // point to specified register Wire.endTransmission(); // Relinquish bus control } uint8_t readReg(uint8_t reg) { openReg(reg); uint8_t reading; // holds byte of read data Wire.requestFrom(ADDR, 1); // Request 1 byte from open register Wire.endTransmission(); // Relinquish bus control if (1 <= Wire.available()) { reading = (Wire.read()); // Read byte } return reading; } float readTemp(void) { uint8_t byte[2]; uint16_t temp; byte[0] = readReg(TEMP_LOW); byte[1] = readReg(TEMP_HIGH); temp = (unsigned int)byte[1] << 8 | byte[0]; return (float)(temp) * 165 / 65536 - 40; } void writeReg(uint8_t reg, uint8_t data) { Wire.beginTransmission(ADDR); // Open Device Wire.write(reg); // Point to register Wire.write(data); // Write data to register Wire.endTransmission(); // Relinquish bus control } void setup() { // put your setup code here, to run once: Serial.begin(9600); Wire.begin(); } void loop() { // put your main code here, to run repeatedly: Serial.println(temperature = readTemp()); //Serial.println(humidity = readHumidity()); delay(1000); } This code worked and I got temperature readings. Next, I tried it out on the MSP430FR5969, again, without breaking off the sensor from the mainboard. It didn't work at first, so I checked with a logic analyzer and if I recall correctly, either the SCK or SDA lines wasn't sending any data. However, after sometime it started working properly, and then stopped again. After trying for a couple of hours, I decided to disconnect the HDC2010 from the mainboard, in case the MSP430F5528 was causing some issues. I connected the HDC2010 to the Arduino Uno via the logic level shifter, and the code worked correctly. However, it doesn't work with the MSP430FR5969. I tried out the inbuilt Wire examples, and the logic analyzer reveals that the I2C lines don't seem to be sending data at all (they work fine as GPIO). I'm using pins 9 & 10 on a Rev2.0 launchpad. What's odd is that it worked for a little while & I cannot figure out what I'm doing wrong. This is with a 1.2k ohm pull up on the clock line (2nd row). Without the pull up, the line remains low. The first row shows SDA, but the logic is inverted for some reason, and if I use a 10k pull up, it remains high continuously. I managed to capture this when it worked correctly with the MSP430FR5969: I've read conflicting reports about the actual I2C pins on the MSP430FR5969 launchpad: are they at 9 & 10 (as the board pdf & silkscreen says), or have they been shifted to the same pins as SPI? What's the best way to debug this? Simple I2C sketches don't seem to work for some reason, but it worked correctly for a little while.
×
×
  • Create New...