[SOLVED] Code works in eeprom at24c04 that not works in at24c32n

Status
Not open for further replies.

speedEC

Full Member level 6
Joined
Apr 1, 2011
Messages
337
Helped
23
Reputation
46
Reaction score
21
Trophy points
1,298
Activity points
4,324
TinyRTC Module. DS1307 works OK with the same code.

CODE WORKS IN EEPROM AT24C04 THAT NOT WORKS IN AT24C32N. I have changed the Address of the EEPROM only. (A4 for 24C04 - 1010010 & R/W). (A0 for 24C32N - 1010000 & R/W; since all A0, A1, A2 are GNDed). WP pin also grounded.


Code:
EEPROM_ADDR = 0x00;
	
	I2C_Master_Start();
	I2C_Master_Write(0xA0 | ((EEPROM_ADDR>>7) & 0x0E)); 
	I2C_Master_Write((unsigned char)EEPROM_ADDR & 0xFF);
	I2C_Master_Write((unsigned char)0x41);
	I2C_Master_Stop();
	__delay_ms(100);
	
	EEPROM_ADDR = 0x00;
	
	I2C_Master_Start();
	I2C_Master_Write(0xA0 | ((EEPROM_ADDR>>7) & 0x0E));
	I2C_Master_Write((unsigned char)EEPROM_ADDR & 0xFF);
	I2C_Master_RepeatedStart(); //re Start condition
	I2C_Master_Write(0xA1);
	
	strData[0] = I2C_Master_Read(1); // ACK
	strData[1] = 0x00;
	
	I2C_Master_Stop(); // STOP
	__delay_ms(100);

Am I missing anything?
thank you.
 

AT24C04 using 8 bit address, AT24C32N using 16 bit address
Thank you. problem solved. I am using TinyRTC Module which consists of both DS1307 (RTC) and AT24C32N. So do we need to use 8 bit addressing for DS1307 (RTC) and 16 bit addressing for AT24C32N?

thank you.
 

Hi,

Global answer:
How to communicate with devices is written in the according datasheets.

There´s no way around reading the datasheets.

Klaus
 

A thing to beware, is speed grade (and actual speed) differences.
I've played with other EEPROMs and have found them in grades
anywhere from 75nS to 300nS (this is old school parallel I/O stuff,
used to make a poor man's arbitrary waveform generator). I had
a tube of parts that just would not work right because they were
too slow for the cycle time.

That might look like software malfunction if it was at all close,
or a total fail if grossly slow.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…