??? 03/19/09 02:55 Read: times |
#163622 - I appear to be doing it right, but doesn't work! |
ARGG, I have an I2C EEPROM from Microchip that I'm trying get programmed. The link to the datasheet is here:
http://ww1.microchip.com/downloads...21189f.pdf I have been trying to get data into it and out of it. It is kind of odd how they want you to do the reading of it. I'm doing page writes (12bit address). So you send the address/control byte, high order address, low order address, data1 - dataN. To do a page read, you have to transmit the address/control byte, high order address, low order address, and then send the receive command since the transmit is supposed to "latch" the starting address of the byte your trying to start from and count in how many bytes by auto increment using the ACK. I've done the simulation, and my transmit function has worked flawless for over a year, and the rest of my I2C devices all respond as they should, so clearly without a doubt, my transmit function is 100% The receive simulation is pulling the exact data that was stored at the EEPROM locations, so I know that I'm setting the right values and its receiving all the data. So I'm sitting here scratching my head as to what the heck I'm doing wrong!!!!!! Please Please.....can someone take a peek, I've been fighting this for a few days now, and not getting any traction since everything appears in order. Here are the two send receive functions with the validation of the simulator interface. So that tells me that I don't need to post the entire I2C file and its header. If someone needs it, then I'll post it up. Here are the two functions and the results of it. Thanks again for any comments. void Memory_Save(void){ uchar x; uint temp1_dec; ulong temp1_odo; temp1_dec = Odo_Decimal[0]; temp1_odo = Odo_Count[0]; I2C_Bus_Speed[0] = 0; //Set I2C to 100Khz for SAA1064 limits //External eeprom Odo transmit_bytes[0] = 0x00; //High address transmit_bytes[1] = 0x00; //Low address for (x = 0 ;x<4; x++){ //Save Main Odo Data transmit_bytes[x+2] = temp1_odo; temp1_odo = temp1_odo >> 8;} //32 bit data move LONG bytes 0-3 MAX_NUMBYTE_TX[0] = 5; //Send 6 Bytes of data (N+1) Send_I2C_Data(0x50); //Transmit data to odo void Memory_Restore (void){ uchar x; Odo_Count[0] = 0; Odo_Decimal[0] = 0; I2C_Bus_Speed[0] = 0; //Set I2C to 100Khz for SAA1064 limits //External EEPROM Main Odo transmit_bytes[0] = 0x00; //High address transmit_bytes[1] = 0x00; //Low address MAX_NUMBYTE_TX[0] = 1; //Send 2 Bytes of data (N+1) Send_I2C_Data(0x50); //Transmit EEPROM address to read from A12 - A0 MAX_NUMBYTE_RX[0] = 3; //Number of bytes to receive (N+1) Receive_I2C_Data(0x51); for (x = 3 ;x != 0xFF; x--){ //Restore Main Odo Value Odo_Count[0] = Odo_Count[0] |= receive_bytes[x]; if (x!=0)Odo_Count[0] = Odo_Count[0] << 8;} //32 bit (4 Bytes) } //data move LONG byte 0-3 ![]() ![]() |
Topic | Author | Date |
I appear to be doing it right, but doesn't work! | 01/01/70 00:00 | |
try another manufacturer | 01/01/70 00:00 | |
Hardware | 01/01/70 00:00 | |
single byte | 01/01/70 00:00 | |
no.......... | 01/01/70 00:00 | |
what I meant | 01/01/70 00:00 | |
I try the byte write | 01/01/70 00:00 | |
This is drivng me out of my tree!!!!! | 01/01/70 00:00 | |
Can you publish your schematics? | 01/01/70 00:00 | |
Yes, as soon as I get my laptop up, in about 2 hours | 01/01/70 00:00 | |
Here is EEPROM section attached to MPU | 01/01/70 00:00 | |
decoupling caps | 01/01/70 00:00 | |
Power supply is quite | 01/01/70 00:00 | |
Using the wrong address? | 01/01/70 00:00 | |
Hal, Good catch, but my code....![]() | 01/01/70 00:00 | |
Looking at datasheet for Atmel | 01/01/70 00:00 |