Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BSP_DISCO_F746NG
This example shows how to read and write data in RF EEPROM. The I2C EEPROM memory (M24LR64) is available on separate daughter board ANT7-M24LR-A, which is not provided with the STM32746G-Discovery board. To use this driver you have to connect the ANT7-M24LR-A to CN1 connector of STM32746G-Discovery board.
Diff: main.cpp
- Revision:
- 0:d5bffd99efd3
- Child:
- 3:508424185673
diff -r 000000000000 -r d5bffd99efd3 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Jan 05 09:03:01 2016 +0000
@@ -0,0 +1,56 @@
+#include "mbed.h"
+#include "EEPROM_DISCO_F746NG.h"
+
+EEPROM_DISCO_F746NG eep;
+
+DigitalOut led_green(LED1);
+DigitalOut led_red(LED2);
+
+Serial pc(USBTX, USBRX);
+
+#define BUFFER_SIZE ((uint32_t)32)
+#define WRITE_READ_ADDR ((uint32_t)0x0000)
+
+int main()
+{
+ // 12345678901234567890123456789012
+ uint8_t WriteBuffer[BUFFER_SIZE+1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345";
+ uint8_t ReadBuffer[BUFFER_SIZE+1];
+ uint16_t bytes_rd;
+
+ pc.printf("\n\nEEPROM demo started\n");
+ led_red = 0;
+
+ // Check initialization
+ if (eep.Init() != EEPROM_OK) {
+ led_red = 1;
+ error("Initialization FAILED\n");
+ } else {
+ pc.printf("Initialization PASSED\n");
+ }
+
+ // Write buffer
+ if (eep.WriteBuffer(WriteBuffer, WRITE_READ_ADDR, BUFFER_SIZE) != EEPROM_OK) {
+ led_red = 1;
+ error("Write buffer FAILED\n");
+ } else {
+ pc.printf("Write buffer PASSED\n");
+ }
+
+ // Read buffer
+ bytes_rd = BUFFER_SIZE;
+ if (eep.ReadBuffer(ReadBuffer, WRITE_READ_ADDR, &bytes_rd) != EEPROM_OK) {
+ led_red = 1;
+ error("Read buffer FAILED\n");
+ } else {
+ ReadBuffer[BUFFER_SIZE] = '\0';
+ pc.printf("Read buffer PASSED\n");
+ pc.printf("Buffer read = [%s]\n", ReadBuffer);
+ pc.printf("Bytes read = %d\n", bytes_rd);
+ }
+
+ while(1) {
+ led_green = !led_green;
+ wait(1);
+ }
+}