configs/stm32f103-minimum: Add AT24 EEPROM support on STM32F103-Minimum board

This commit is contained in:
Alan Carvalho de Assis 2018-01-06 17:10:32 -06:00 committed by Gregory Nutt
parent ed18e427f3
commit 20c11e918f
4 changed files with 84 additions and 0 deletions

View File

@ -5,6 +5,36 @@
if ARCH_BOARD_STM32F103_MINIMUM
config STM32F103MINIMUM_AT24_BLOCKMOUNT
bool "AT24 Serial EEPROM auto-mount"
default n
depends on NSH_ARCHINIT && STM32_I2C1 && MTD_AT24XX
---help---
Automatically initialize the AT24 I2C EEPROM driver when NSH starts.
choice
prompt "AT24 serial EPPROM configuration"
default STM32F103MINIMUM_AT24_FTL
depends on STM32F103MINIMUM_AT24_BLOCKMOUNT
config STM32F103MINIMUM_AT24_FTL
bool "Create AT24 block driver"
---help---
Create the MTD driver for the AT24 and "wrap" the AT24 as a standard
block driver that could then, for example, be mounted using FAT or
any other file system. Any file system may be used, but there will
be no wear-leveling.
config STM32F103MINIMUM_AT24_NXFFS
bool "Create AT24 NXFFS file system"
depends on FS_NXFFS
---help---
Create the MTD driver for the AT24 and mount the AT24 device as
a wear-leveling, NuttX FLASH file system (NXFFS). The downside of
NXFFS is that it can be very slow.
endchoice # AT24 serial EPPROM configuration
config STM32F103MINIMUM_FLASH
bool "MTD driver for external 4Mbyte W25Q32FV FLASH on SPI1"
default n

View File

@ -85,6 +85,12 @@ ifeq ($(CONFIG_MTD_W25),y)
CSRCS += stm32_w25.c
endif
ifeq ($(CONFIG_MTD_AT24XX),y)
ifeq ($(CONFIG_STM32_I2C1),y)
CSRCS += stm32_at24.c
endif
endif
ifeq ($(CONFIG_AUDIO_TONE),y)
CSRCS += stm32_tone.c
endif

View File

@ -188,6 +188,17 @@ int stm32_bringup(void)
}
#endif
#ifdef HAVE_AT24
/* Initialize the AT24 driver */
ret = stm32_at24_automount(AT24_MINOR);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_at24_automount failed: %d\n", ret);
return ret;
}
#endif /* HAVE_AT24 */
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */

View File

@ -44,6 +44,43 @@
#include <nuttx/compiler.h>
#include <stdint.h>
#define HAVE_AT24 1
/* AT24 Serial EEPROM */
#define AT24_I2C_BUS 1 /* AT24C256 connected to I2C1 */
#define AT24_MINOR 0
#if !defined(CONFIG_MTD_AT24XX) || !defined(CONFIG_STM32_I2C1)
# undef HAVE_AT24
#endif
/* Can't support AT24 features if mountpoints are disabled or if we were not
* asked to mount the AT25 part
*/
#if defined(CONFIG_DISABLE_MOUNTPOINT) || \
!defined(CONFIG_STM32F103MINIMUM_AT24_BLOCKMOUNT)
# undef HAVE_AT24
#endif
/* If we are going to mount the AT24, then they user must also have told
* us what to do with it by setting one of these.
*/
#ifndef CONFIG_FS_NXFFS
# undef CONFIG_STM32F103MINIMUM_AT24_NXFFS
#endif
#if !defined(CONFIG_STM32F103MINIMUM_AT24_FTL) && \
!defined(CONFIG_STM32F103MINIMUM_AT24_NXFFS)
# undef HAVE_AT24
#endif
#ifndef HAVE_AT24
#error "HAVE_AT24 is not defined!\n"
#endif
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/