Basic example showing how to use a M24LR64 EEPROM with the STM32746G_DISCOVERY board. This EEPROM can be found on the additional ANT7-M24LR-A daughter board.
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.
Revision 3:508424185673, committed 2019-11-20
- Comitter:
- Jerome Coutant
- Date:
- Wed Nov 20 13:56:28 2019 +0100
- Parent:
- 2:fec4ab60a7fd
- Commit message:
- Update with STM32Cube_FW_F7_V1.15.0
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Wed Nov 20 13:56:28 2019 +0100 @@ -0,0 +1,2 @@ +BUILD +mbed-os/
--- a/BSP_DISCO_F746NG.lib Thu Jun 08 13:26:04 2017 +0000 +++ b/BSP_DISCO_F746NG.lib Wed Nov 20 13:56:28 2019 +0100 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#56384bddaba5 +https://mbed.org/teams/ST/code/BSP_DISCO_F746NG/#1050c589b2ad
--- a/EEPROM_DISCO_F746NG.lib Thu Jun 08 13:26:04 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://developer.mbed.org/teams/ST/code/EEPROM_DISCO_F746NG/#71d257cea6b2
--- a/main.cpp Thu Jun 08 13:26:04 2017 +0000 +++ b/main.cpp Wed Nov 20 13:56:28 2019 +0100 @@ -1,56 +1,42 @@ #include "mbed.h" -#include "EEPROM_DISCO_F746NG.h" - -EEPROM_DISCO_F746NG eep; +#include "stm32746g_discovery_eeprom.h" -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]; + // 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; + printf("\n\nEEPROM demo started\n"); + printf("NB: you have to connect the RF EEPROM ANT7-M24LR-A to CN1 connector of STM32746G-Discovery board\n"); // Check initialization - if (eep.Init() != EEPROM_OK) { - led_red = 1; + if (BSP_EEPROM_Init() != EEPROM_OK) { error("Initialization FAILED\n"); } else { - pc.printf("Initialization PASSED\n"); + printf("Initialization PASSED\n"); } // Write buffer - if (eep.WriteBuffer(WriteBuffer, WRITE_READ_ADDR, BUFFER_SIZE) != EEPROM_OK) { - led_red = 1; + if (BSP_EEPROM_WriteBuffer(WriteBuffer, WRITE_READ_ADDR, BUFFER_SIZE) != EEPROM_OK) { error("Write buffer FAILED\n"); } else { - pc.printf("Write buffer PASSED\n"); + 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; + if (BSP_EEPROM_ReadBuffer(ReadBuffer, WRITE_READ_ADDR, &bytes_rd) != EEPROM_OK) { 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); + printf("Read buffer PASSED\n"); + printf("Buffer read = [%s]\n", ReadBuffer); + printf("Bytes read = %d\n", bytes_rd); } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Wed Nov 20 13:56:28 2019 +0100 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#699372421a3b388fe568e9be85b1a985749a438f
--- a/mbed.bld Thu Jun 08 13:26:04 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://mbed.org/users/mbed_official/code/mbed/builds/86740a56073b \ No newline at end of file