STM3210E_EVAL_FSMC_NOR_Private_Functions
[STM3210E_EVAL_FSMC_NOR]

More...

Functions

NOR_Status NOR_EraseBlock (uint32_t BlockAddr)
 Erases the specified Nor memory block.
NOR_Status NOR_EraseChip (void)
 Erases the entire chip.
NOR_Status NOR_GetStatus (uint32_t Timeout)
 Returns the NOR operation status.
void NOR_Init (void)
 Configures the FSMC and GPIOs to interface with the NOR memory.
NOR_Status NOR_ProgramBuffer (uint16_t *pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite)
 Writes a half-word buffer to the FSMC NOR memory.
void NOR_ReadBuffer (uint16_t *pBuffer, uint32_t ReadAddr, uint32_t NumHalfwordToRead)
 Reads a block of data from the FSMC NOR memory.
uint16_t NOR_ReadHalfWord (uint32_t ReadAddr)
 Reads a half-word from the NOR memory.
void NOR_ReadID (NOR_IDTypeDef *NOR_ID)
 Reads NOR memory's Manufacturer and Device Code.
NOR_Status NOR_Reset (void)
 Returns the NOR memory to Read mode and resets the errors in the NOR memory Status Register.
NOR_Status NOR_ReturnToReadMode (void)
 Returns the NOR memory to Read mode.
NOR_Status NOR_WriteBuffer (uint16_t *pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite)
 Writes a half-word buffer to the FSMC NOR memory.
NOR_Status NOR_WriteHalfWord (uint32_t WriteAddr, uint16_t Data)
 Writes a half-word to the NOR memory.

Detailed Description


Function Documentation

NOR_Status NOR_EraseBlock ( uint32_t  BlockAddr  ) 

Erases the specified Nor memory block.

Parameters:
BlockAddr,: address of the block to erase.
Return values:
NOR_Status,: The returned value can be: NOR_SUCCESS, NOR_ERROR or NOR_TIMEOUT

Definition at line 210 of file stm3210e_eval_fsmc_nor.c.

References ADDR_SHIFT, Bank1_NOR2_ADDR, BlockErase_Timeout, NOR_GetStatus(), and NOR_WRITE.

Referenced by main().

NOR_Status NOR_EraseChip ( void   ) 

Erases the entire chip.

Parameters:
None 
Return values:
NOR_Status,: The returned value can be: NOR_SUCCESS, NOR_ERROR or NOR_TIMEOUT

Definition at line 228 of file stm3210e_eval_fsmc_nor.c.

References ADDR_SHIFT, ChipErase_Timeout, NOR_GetStatus(), and NOR_WRITE.

NOR_Status NOR_GetStatus ( uint32_t  Timeout  ) 

Returns the NOR operation status.

Parameters:
Timeout,: NOR progamming Timeout
Return values:
NOR_Status,: The returned value can be: NOR_SUCCESS, NOR_ERROR or NOR_TIMEOUT

< Poll on NOR memory Ready/Busy signal ----------------------------------

< Read DQ6 and DQ5

< If DQ6 did not toggle between the two reads then return NOR_Success

Definition at line 397 of file stm3210e_eval_fsmc_nor.c.

References Bank1_NOR2_ADDR, GPIO_Pin_6, GPIO_ReadInputDataBit(), GPIOD, NOR_ERROR, NOR_ONGOING, NOR_SUCCESS, NOR_TIMEOUT, RESET, and status.

Referenced by NOR_EraseBlock(), NOR_EraseChip(), NOR_ProgramBuffer(), and NOR_WriteHalfWord().

void NOR_Init ( void   ) 

Configures the FSMC and GPIOs to interface with the NOR memory.

This function must be called before any write/read operation on the NOR.

Parameters:
None 
Return values:
None 

< NOR Data lines configuration

< NOR Address lines configuration

< NOE and NWE configuration

< NE2 configuration

< Configure PD6 for NOR memory Ready/Busy signal

< Enable FSMC Bank1_NOR Bank

Definition at line 104 of file stm3210e_eval_fsmc_nor.c.

References ENABLE, FSMC_NORSRAMTimingInitTypeDef::FSMC_AccessMode, FSMC_AccessMode_B, FSMC_NORSRAMTimingInitTypeDef::FSMC_AddressHoldTime, FSMC_NORSRAMTimingInitTypeDef::FSMC_AddressSetupTime, FSMC_NORSRAMInitTypeDef::FSMC_AsynchronousWait, FSMC_AsynchronousWait_Disable, FSMC_NORSRAMInitTypeDef::FSMC_Bank, FSMC_Bank1_NORSRAM2, FSMC_NORSRAMInitTypeDef::FSMC_BurstAccessMode, FSMC_BurstAccessMode_Disable, FSMC_NORSRAMTimingInitTypeDef::FSMC_BusTurnAroundDuration, FSMC_NORSRAMTimingInitTypeDef::FSMC_CLKDivision, FSMC_NORSRAMInitTypeDef::FSMC_DataAddressMux, FSMC_DataAddressMux_Disable, FSMC_NORSRAMTimingInitTypeDef::FSMC_DataLatency, FSMC_NORSRAMTimingInitTypeDef::FSMC_DataSetupTime, FSMC_NORSRAMInitTypeDef::FSMC_ExtendedMode, FSMC_ExtendedMode_Disable, FSMC_NORSRAMInitTypeDef::FSMC_MemoryDataWidth, FSMC_MemoryDataWidth_16b, FSMC_NORSRAMInitTypeDef::FSMC_MemoryType, FSMC_MemoryType_NOR, FSMC_NORSRAMCmd(), FSMC_NORSRAMInit(), FSMC_NORSRAMInitTypeDef::FSMC_ReadWriteTimingStruct, FSMC_NORSRAMInitTypeDef::FSMC_WaitSignal, FSMC_WaitSignal_Disable, FSMC_NORSRAMInitTypeDef::FSMC_WaitSignalActive, FSMC_WaitSignalActive_BeforeWaitState, FSMC_NORSRAMInitTypeDef::FSMC_WaitSignalPolarity, FSMC_WaitSignalPolarity_Low, FSMC_NORSRAMInitTypeDef::FSMC_WrapMode, FSMC_WrapMode_Disable, FSMC_NORSRAMInitTypeDef::FSMC_WriteBurst, FSMC_WriteBurst_Disable, FSMC_NORSRAMInitTypeDef::FSMC_WriteOperation, FSMC_WriteOperation_Enable, FSMC_NORSRAMInitTypeDef::FSMC_WriteTimingStruct, GPIO_Init(), GPIO_InitStructure, GPIO_InitTypeDef::GPIO_Mode, GPIO_Mode_AF_PP, GPIO_Mode_IN_FLOATING, GPIO_InitTypeDef::GPIO_Pin, GPIO_Pin_0, GPIO_Pin_1, GPIO_Pin_10, GPIO_Pin_11, GPIO_Pin_12, GPIO_Pin_13, GPIO_Pin_14, GPIO_Pin_15, GPIO_Pin_2, GPIO_Pin_3, GPIO_Pin_4, GPIO_Pin_5, GPIO_Pin_6, GPIO_Pin_7, GPIO_Pin_8, GPIO_Pin_9, GPIO_InitTypeDef::GPIO_Speed, GPIO_Speed_50MHz, GPIOD, GPIOE, GPIOF, GPIOG, RCC_APB2Periph_GPIOD, RCC_APB2Periph_GPIOE, RCC_APB2Periph_GPIOF, RCC_APB2Periph_GPIOG, and RCC_APB2PeriphClockCmd().

Referenced by main().

NOR_Status NOR_ProgramBuffer ( uint16_t *  pBuffer,
uint32_t  WriteAddr,
uint32_t  NumHalfwordToWrite 
)

Writes a half-word buffer to the FSMC NOR memory.

This function must be used only with S29GL128P NOR memory.

Parameters:
pBuffer,: pointer to buffer.
WriteAddr,: NOR memory internal address from which the data will be written.
NumHalfwordToWrite,: number of Half words to write. The maximum allowed value is 32 Half words (64 bytes).
Return values:
NOR_Status,: The returned value can be: NOR_SUCCESS, NOR_ERROR or NOR_TIMEOUT

< Initialize variables

< Issue unlock command sequence

< Write Write Buffer Load Command

< Load Data into NOR Buffer

< Store last loaded address & data value (for polling)

Definition at line 293 of file stm3210e_eval_fsmc_nor.c.

References ADDR_SHIFT, NOR_GetStatus(), NOR_WRITE, and Program_Timeout.

void NOR_ReadBuffer ( uint16_t *  pBuffer,
uint32_t  ReadAddr,
uint32_t  NumHalfwordToRead 
)

Reads a block of data from the FSMC NOR memory.

Parameters:
pBuffer,: pointer to the buffer that receives the data read from the NOR memory.
ReadAddr,: NOR memory internal address to read from.
NumHalfwordToRead : number of Half word to read.
Return values:
None 

< while there is data to read

< Read a Halfword from the NOR

Definition at line 350 of file stm3210e_eval_fsmc_nor.c.

References ADDR_SHIFT, Bank1_NOR2_ADDR, and NOR_WRITE.

Referenced by main().

uint16_t NOR_ReadHalfWord ( uint32_t  ReadAddr  ) 

Reads a half-word from the NOR memory.

Parameters:
ReadAddr,: NOR memory internal address to read from.
Return values:
Half-word read from the NOR memory

Definition at line 333 of file stm3210e_eval_fsmc_nor.c.

References ADDR_SHIFT, Bank1_NOR2_ADDR, and NOR_WRITE.

void NOR_ReadID ( NOR_IDTypeDef NOR_ID  ) 

Reads NOR memory's Manufacturer and Device Code.

Parameters:
NOR_ID,: pointer to a NOR_IDTypeDef structure which will hold the Manufacturer and Device Code.
Return values:
None 

Definition at line 192 of file stm3210e_eval_fsmc_nor.c.

References ADDR_SHIFT, NOR_IDTypeDef::Device_Code1, NOR_IDTypeDef::Device_Code2, NOR_IDTypeDef::Device_Code3, NOR_IDTypeDef::Manufacturer_Code, and NOR_WRITE.

Referenced by main().

NOR_Status NOR_Reset ( void   ) 

Returns the NOR memory to Read mode and resets the errors in the NOR memory Status Register.

Parameters:
None 
Return values:
NOR_SUCCESS 

Definition at line 382 of file stm3210e_eval_fsmc_nor.c.

References ADDR_SHIFT, Bank1_NOR2_ADDR, NOR_SUCCESS, and NOR_WRITE.

NOR_Status NOR_ReturnToReadMode ( void   ) 

Returns the NOR memory to Read mode.

Parameters:
None 
Return values:
NOR_SUCCESS 

Definition at line 369 of file stm3210e_eval_fsmc_nor.c.

References Bank1_NOR2_ADDR, NOR_SUCCESS, and NOR_WRITE.

Referenced by main().

NOR_Status NOR_WriteBuffer ( uint16_t *  pBuffer,
uint32_t  WriteAddr,
uint32_t  NumHalfwordToWrite 
)

Writes a half-word buffer to the FSMC NOR memory.

Parameters:
pBuffer,: pointer to buffer.
WriteAddr,: NOR memory internal address from which the data will be written.
NumHalfwordToWrite,: number of Half words to write.
Return values:
NOR_Status,: The returned value can be: NOR_SUCCESS, NOR_ERROR or NOR_TIMEOUT

< Transfer data to the memory

Definition at line 266 of file stm3210e_eval_fsmc_nor.c.

References NOR_ONGOING, NOR_SUCCESS, NOR_WriteHalfWord(), and status.

Referenced by main().

NOR_Status NOR_WriteHalfWord ( uint32_t  WriteAddr,
uint16_t  Data 
)

Writes a half-word to the NOR memory.

Parameters:
WriteAddr,: NOR memory internal address to write to.
Data,: Data to write.
Return values:
NOR_Status,: The returned value can be: NOR_SUCCESS, NOR_ERROR or NOR_TIMEOUT

Definition at line 247 of file stm3210e_eval_fsmc_nor.c.

References ADDR_SHIFT, Bank1_NOR2_ADDR, NOR_GetStatus(), NOR_WRITE, and Program_Timeout.

Referenced by NOR_WriteBuffer().

STM32F10x Standard Peripherals Library: Footer

 

 

 

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