Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

I2C problem

2006-03-09 by Sutton Mehaffey

I'm still having a bit of trouble getting correct status from LPC2148
interfacing with a Serial RAM chip.  And, I don't know why.  This is
supposed to be pretty straight forward.  I don't know why I'm having
trouble here.  I know that different chips require slightly different
packets.  Here's my short code and results.  Any clues?

Disregarding the setup of PCONP and other registers:


I2C0CONSET = 0x20;     // start command

// I2C0STAT now reads 0x08 - so we started I2C

// RAM chip ID is 1010000x with the last three 0s being device select
// Read (1) or Write (0) is the last bit - RAM_WRITE_ADDR = 0xA0

I2C0DAT = RAM_WRITE_ADDR;   // write Slave ID and Write bit (0xA0)
I2C0CONSET = 0x04;	    // Set AA bit for ACK
I2C0CONCLR = 0x18;          // clear STA and SI bits

// I2C0STAT now reads 0x18 - so device responded

// I want to read data from an arbitrary address 0x5555
// Datasheet says to send MSB then LSB

I2C0DAT = 0x55;         // MSB of address to read from
I2C0CONSET = 0x04;	// Set AA bit for ACK
I2C0CONCLR = 0x08;      // clear SI bit

// I2C0STAT now reads 0x08

Shouldn't this status read 0x28 so I can send LSB?  Is it aborting and
giving me a START status again?  If so, what's the reason?

Sutton

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.