I have read it five times, but I need glasses : I don't where are the technical informaion for I2C access, especially adress of the slave, memory use adress for use directly mbed library.
The device is delivered with all bits in the user memory array set to 1 so I have written the follow code, and connected the pull-up resistor on my I2C mbed pins connection. But nothing happen. The code stay on the line ??
DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
int main() {
I2C i2c(p9, p10);
pc.printf("Starting....")
wait(1);
int add = 0x0A;
char Tab[1];
i2c.start();
int statuw = i2c.read(add, Tab, 1, true);
i2c.stop();
pc.printf("Done !");
int rep = Tab[0];
pc.printf("Value : %F \n\r", rep);
}
Thanks for your help!
GM
Hello everybody !
I tried to configure an access to an eeprom witch use I2C bus interface.
ST M24LR16E, datasheet http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00031737.pdf
I have read it five times, but I need glasses : I don't where are the technical informaion for I2C access, especially adress of the slave, memory use adress for use directly mbed library.
I think :
Slave adress 1010 = 0x0A
1 Kbit EEPROM sector = 0x00
The device is delivered with all bits in the user memory array set to 1 so I have written the follow code, and connected the pull-up resistor on my I2C mbed pins connection. But nothing happen. The code stay on the line ??
<<code>>
DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
int main() {
I2C i2c(p9, p10);
pc.printf("Starting....")
wait(1);
int add = 0x0A;
char Tab[1];
i2c.start();
int statuw = i2c.read(add, Tab, 1, true);
i2c.stop();
pc.printf("Done !");
int rep = Tab[0];
pc.printf("Value : %F \n\r", rep);
}
<</code>>
Thanks for your help!
GM
I read this morning the datasheet. And in the table 2, device adress to read is
0b10101111=0xAF and 0b10101110 = 0xAE to write. Isnt't it ?
I looking for a 0 ack statut byte for a simple write operation through i2c. so i tried the following :
I2C i2c(p28, p27);
pc.printf("Started... ");
for (int cc = 0x00 ; cc <= 0xFF; cc++){
for (int add=0x0000; add <=0xFFFF; add++) {
const char crc[1]={cc};
i2c.start();
int stb1 = i2c.write(add, crc, 2, true);
i2c.stop();
pc.printf(".");
if (stb1==0){
pc.printf("Statut for %X and %X: %X \n\r", add, cc, stb1);
}
}
}
But with not fine results !
Thank you for the reply !
I read this morning the datasheet. And in the table 2, device adress to read is
0b10101111=0xAF and 0b10101110 = 0xAE to write. Isnt't it ?
I looking for a 0 ack statut byte for a simple write operation through i2c. so i tried the following :
<<code>>
I2C i2c(p28, p27);
pc.printf("Started... ");
for (int cc = 0x00 ; cc <= 0xFF; cc++){
for (int add=0x0000; add <=0xFFFF; add++) {
const char crc[1]={cc};
i2c.start();
int stb1 = i2c.write(add, crc, 2, true);
i2c.stop();
pc.printf(".");
if (stb1==0){
pc.printf("Statut for %X and %X: %X \n\r", add, cc, stb1);
}
}
}
<</code>>
But with not fine results !
Sorry for the delay! I have had a look at the datasheet now. It would suggest to me that a generic 24xx16 eeprom lib should work, see here for one
http://mbed.org/users/bborredon/code/eeprom/wiki/Homepage
Three out of the four LSBits are used for passwords, so may i suggest that you get a simple program working first, then you can go forward and write the rest of your lib when you have a better understanding of the device. If you need help with using BBorrendon's code I can probably help further.
Sorry for the delay! I have had a look at the datasheet now. It would suggest to me that a generic 24xx16 eeprom lib should work, see here for one
http://mbed.org/users/bborredon/code/eeprom/wiki/Homepage
Three out of the four LSBits are used for passwords, so may i suggest that you get a simple program working first, then you can go forward and write the rest of your lib when you have a better understanding of the device. If you need help with using BBorrendon's code I can probably help further.
Important Information for this Arm website
This site uses cookies to store information on your computer.
By continuing to use our site, you consent to our cookies.
If you are not happy with the use of these cookies, please review our
Cookie Policy
to learn how they can be disabled.
By disabling cookies, some features of the site will not work.
Access Warning
You do not have the correct permissions to perform this operation.
Hello everybody !
I tried to configure an access to an eeprom witch use I2C bus interface. ST M24LR16E, datasheet http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00031737.pdf
I have read it five times, but I need glasses : I don't where are the technical informaion for I2C access, especially adress of the slave, memory use adress for use directly mbed library.
I think : Slave adress 1010 = 0x0A 1 Kbit EEPROM sector = 0x00
The device is delivered with all bits in the user memory array set to 1 so I have written the follow code, and connected the pull-up resistor on my I2C mbed pins connection. But nothing happen. The code stay on the line ??
Thanks for your help!
GM