Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

MSP430G2335 Interfacing with a DS1307

$
0
0

For the past 4 hours I've been trying to troubleshoot a I2C communication between my MSP430G2335 and a DS1307 (powered from a external 5V PSU). This is the code I'm using (it uses alanbarr I2C library):

#include <msp430g2553.h>
#include "i2c.h"

void main() {
	WDTCTL = WDTPW + WDTHOLD;  // Disable WDT.
	BCSCTL1 = CALBC1_1MHZ;     // 1MHz clock.
	DCOCTL = CALDCO_1MHZ;
	BCSCTL2 &= ~(DIVS_3);      // SMCLK = DCO = 1MHz.


	i2cSetupPins();//0x68
	i2cSetupTx(0x68);
	i2cTransmit(0, 1);
	i2cSetupRx(0x68);
	char t[100];
	i2cReceive(t, 1); // Nothing. Just for testing.
}

The problem is that all I get is this:

ST5C78q.png

 

Then apparently the CPU hangs (since nothing happens). So, anyone got any idea why that's happening? (by the way, yes, I have the 10k pullup resistors)

 

PS: It's 2am and I just rage quitted this, so you guys are my last hope.


Viewing all articles
Browse latest Browse all 2077

Trending Articles