stm32_eval_i2c_ee.c File Reference

This file provides a set of functions needed to manage the I2C M24CXX EEPROM memory mounted on STM32xx-EVAL board (refer to stm32_eval.h to know about the boards supporting this memory). More...

#include "stm32_eval_i2c_ee.h"
#include "stm32_eval.h"

Go to the source code of this file.

Functions

void sEE_DeInit (void)
 DeInitializes peripherals used by the I2C EEPROM driver.
void sEE_EnterCriticalSection_UserCallback (void)
 Start critical section: these callbacks should be typically used to disable interrupts when entering a critical section of I2C communication You may use default callbacks provided into this driver by uncommenting the define USE_DEFAULT_CRITICAL_CALLBACK.
void sEE_ExitCriticalSection_UserCallback (void)
 Start and End of critical section: these callbacks should be typically used to re-enable interrupts when exiting a critical section of I2C communication You may use default callbacks provided into this driver by uncommenting the define USE_DEFAULT_CRITICAL_CALLBACK.
void sEE_I2C_DMA_RX_IRQHandler (void)
 This function handles the DMA Rx Channel interrupt Handler.
void sEE_I2C_DMA_TX_IRQHandler (void)
 This function handles the DMA Tx Channel interrupt Handler.
void sEE_Init (void)
 Initializes peripherals used by the I2C EEPROM driver.
uint32_t sEE_ReadBuffer (uint8_t *pBuffer, uint16_t ReadAddr, uint16_t *NumByteToRead)
 Reads a block of data from the EEPROM.
uint32_t sEE_WaitEepromStandbyState (void)
 Wait for EEPROM Standby state.
void sEE_WriteBuffer (uint8_t *pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite)
 Writes buffer of data to the I2C EEPROM.
uint32_t sEE_WritePage (uint8_t *pBuffer, uint16_t WriteAddr, uint8_t *NumByteToWrite)
 Writes more than one byte to the EEPROM with a single WRITE cycle.

Variables

__IO uint16_t sEEAddress = 0
__IO uint8_t sEEDataNum
__IO uint16_t * sEEDataReadPointer
__IO uint8_t * sEEDataWritePointer
__IO uint32_t sEETimeout = sEE_LONG_TIMEOUT

Detailed Description

This file provides a set of functions needed to manage the I2C M24CXX EEPROM memory mounted on STM32xx-EVAL board (refer to stm32_eval.h to know about the boards supporting this memory).

Author:
MCD Application Team
Version:
V4.3.0
Date:
10/15/2010 =================================================================== Note: This driver is intended for STM32F10x families devices only. ===================================================================

It implements a high level communication layer for read and write from/to this memory. The needed STM32 hardware resources (I2C and GPIO) are defined in stm32xx_eval.h file, and the initialization is performed in sEE_LowLevel_Init() function declared in stm32xx_eval.c file. You can easily tailor this driver to any other development board, by just adapting the defines for hardware resources and sEE_LowLevel_Init() function.

Note:
In this driver, basic read and write functions (sEE_ReadBuffer() and sEE_WritePage()) use the DMA to perform the data transfer to/from EEPROM memory (except when number of requested data is equal to 1). Thus, after calling these two functions, user application may perform other tasks while DMA is transferring data. The application should then monitor the variable holding the number of data in order to determine when the transfer is completed (variable decremented to 0). Stopping transfer tasks are performed into DMA interrupt handlers (which are integrated into this driver).

+-----------------------------------------------------------------+ | Pin assignment | +---------------------------------------+-----------+-------------+ | STM32 I2C Pins | sEE | Pin | +---------------------------------------+-----------+-------------+ | . | E0(GND) | 1 (0V) | | . | E1(GND) | 2 (0V) | | . | E2(GND) | 3 (0V) | | . | E0(VSS) | 4 (0V) | | sEE_I2C_SDA_PIN/ SDA | SDA | 5 | | sEE_I2C_SCL_PIN/ SCL | SCL | 6 | | . | /WC(VDD)| 7 (3.3V) | | . | VDD | 8 (3.3V) | +---------------------------------------+-----------+-------------+

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

© COPYRIGHT 2010 STMicroelectronics

Definition in file stm32_eval_i2c_ee.c.

STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32