STM32F439xx HAL User Manual
Defines | Functions | Variables
stm32f4xx_hal_nor.c File Reference

NOR HAL module driver. This file provides a generic firmware to drive NOR memories mounted as external device. More...

#include "stm32f4xx_hal.h"

Go to the source code of this file.

Defines

#define NOR_CMD_ADDRESS_FIRST   (uint16_t)0x0555
#define NOR_CMD_ADDRESS_FIRST_CFI   (uint16_t)0x0055
#define NOR_CMD_ADDRESS_SECOND   (uint16_t)0x02AA
#define NOR_CMD_ADDRESS_THIRD   (uint16_t)0x0555
#define NOR_CMD_ADDRESS_FOURTH   (uint16_t)0x0555
#define NOR_CMD_ADDRESS_FIFTH   (uint16_t)0x02AA
#define NOR_CMD_ADDRESS_SIXTH   (uint16_t)0x0555
#define NOR_CMD_DATA_READ_RESET   (uint16_t)0x00F0
#define NOR_CMD_DATA_FIRST   (uint16_t)0x00AA
#define NOR_CMD_DATA_SECOND   (uint16_t)0x0055
#define NOR_CMD_DATA_AUTO_SELECT   (uint16_t)0x0090
#define NOR_CMD_DATA_PROGRAM   (uint16_t)0x00A0
#define NOR_CMD_DATA_CHIP_BLOCK_ERASE_THIRD   (uint16_t)0x0080
#define NOR_CMD_DATA_CHIP_BLOCK_ERASE_FOURTH   (uint16_t)0x00AA
#define NOR_CMD_DATA_CHIP_BLOCK_ERASE_FIFTH   (uint16_t)0x0055
#define NOR_CMD_DATA_CHIP_ERASE   (uint16_t)0x0010
#define NOR_CMD_DATA_CFI   (uint16_t)0x0098
#define NOR_CMD_DATA_BUFFER_AND_PROG   (uint8_t)0x25
#define NOR_CMD_DATA_BUFFER_AND_PROG_CONFIRM   (uint8_t)0x29
#define NOR_CMD_DATA_BLOCK_ERASE   (uint8_t)0x30
#define NOR_MASK_STATUS_DQ5   (uint16_t)0x0020
#define NOR_MASK_STATUS_DQ6   (uint16_t)0x0040

Functions

HAL_StatusTypeDef HAL_NOR_Init (NOR_HandleTypeDef *hnor, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming)
 Perform the NOR memory Initialization sequence.
HAL_StatusTypeDef HAL_NOR_DeInit (NOR_HandleTypeDef *hnor)
 Perform NOR memory De-Initialization sequence.
__weak void HAL_NOR_MspInit (NOR_HandleTypeDef *hnor)
 NOR MSP Init.
__weak void HAL_NOR_MspDeInit (NOR_HandleTypeDef *hnor)
 NOR MSP DeInit.
__weak void HAL_NOR_MspWait (NOR_HandleTypeDef *hnor, uint32_t Timeout)
 NOR MSP Wait for Ready/Busy signal.
HAL_StatusTypeDef HAL_NOR_Read_ID (NOR_HandleTypeDef *hnor, NOR_IDTypeDef *pNOR_ID)
 Read NOR flash IDs.
HAL_StatusTypeDef HAL_NOR_ReturnToReadMode (NOR_HandleTypeDef *hnor)
 Returns the NOR memory to Read mode.
HAL_StatusTypeDef HAL_NOR_Read (NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData)
 Read data from NOR memory.
HAL_StatusTypeDef HAL_NOR_Program (NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData)
 Program data to NOR memory.
HAL_StatusTypeDef HAL_NOR_ReadBuffer (NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData, uint32_t uwBufferSize)
 Reads a half-word buffer from the NOR memory.
HAL_StatusTypeDef HAL_NOR_ProgramBuffer (NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData, uint32_t uwBufferSize)
 Writes a half-word buffer to the NOR memory.
HAL_StatusTypeDef HAL_NOR_Erase_Block (NOR_HandleTypeDef *hnor, uint32_t BlockAddress, uint32_t Address)
 Erase the specified block of the NOR memory.
HAL_StatusTypeDef HAL_NOR_Erase_Chip (NOR_HandleTypeDef *hnor, uint32_t Address)
 Erase the entire NOR chip.
HAL_StatusTypeDef HAL_NOR_Read_CFI (NOR_HandleTypeDef *hnor, NOR_CFITypeDef *pNOR_CFI)
 Read NOR flash CFI IDs.
HAL_StatusTypeDef HAL_NOR_WriteOperation_Enable (NOR_HandleTypeDef *hnor)
 Enables dynamically NOR write operation.
HAL_StatusTypeDef HAL_NOR_WriteOperation_Disable (NOR_HandleTypeDef *hnor)
 Disables dynamically NOR write operation.
HAL_NOR_StateTypeDef HAL_NOR_GetState (NOR_HandleTypeDef *hnor)
 return the NOR controller state
HAL_NOR_StatusTypeDef HAL_NOR_GetStatus (NOR_HandleTypeDef *hnor, uint32_t Address, uint32_t Timeout)
 Returns the NOR operation status.

Variables

static uint32_t uwNORMemoryDataWidth = NOR_MEMORY_8B

Detailed Description

NOR HAL module driver. This file provides a generic firmware to drive NOR memories mounted as external device.

Author:
MCD Application Team
  ==============================================================================
                     ##### How to use this driver #####
  ==============================================================================       
    [..]
      This driver is a generic layered driver which contains a set of APIs used to 
      control NOR flash memories. It uses the FMC/FSMC layer functions to interface 
      with NOR devices. This driver is used as follows:
    
      (+) NOR flash memory configuration sequence using the function HAL_NOR_Init() 
          with control and timing parameters for both normal and extended mode.
            
      (+) Read NOR flash memory manufacturer code and device IDs using the function
          HAL_NOR_Read_ID(). The read information is stored in the NOR_ID_TypeDef 
          structure declared by the function caller. 
        
      (+) Access NOR flash memory by read/write data unit operations using the functions
          HAL_NOR_Read(), HAL_NOR_Program().
        
      (+) Perform NOR flash erase block/chip operations using the functions 
          HAL_NOR_Erase_Block() and HAL_NOR_Erase_Chip().
        
      (+) Read the NOR flash CFI (common flash interface) IDs using the function
          HAL_NOR_Read_CFI(). The read information is stored in the NOR_CFI_TypeDef
          structure declared by the function caller.
        
      (+) You can also control the NOR device by calling the control APIs HAL_NOR_WriteOperation_Enable()/
          HAL_NOR_WriteOperation_Disable() to respectively enable/disable the NOR write operation  
       
      (+) You can monitor the NOR device HAL state by calling the function
          HAL_NOR_GetState() 
    [..]
     (@) This driver is a set of generic APIs which handle standard NOR flash operations.
         If a NOR flash device contains different operations and/or implementations, 
         it should be implemented separately.

     *** NOR HAL driver macros list ***
     ============================================= 
     [..]
       Below the list of most used macros in NOR HAL driver.
       
      (+) NOR_WRITE : NOR memory write data to specified address

  
Attention:

© COPYRIGHT(c) 2017 STMicroelectronics

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file stm32f4xx_hal_nor.c.