Skip to main content
David George
Associate III
January 30, 2018
Solved

HAL NAND Config - SpareAreaSize / PageSize values..

  • January 30, 2018
  • 2 replies
  • 1638 views
Posted on January 30, 2018 at 12:52

Hi.

When configuring the HAL_NAND driver you need to set the PageSize and SpareAreaSizes values;

 /* hnand1.Config */

  hnand1.Config.PageSize = 2048;

  hnand1.Config.SpareAreaSize = 64;

  hnand1.Config.BlockSize = 64;

  hnand1.Config.BlockNbr = 1024;

  hnand1.Config.PlaneNbr = 1;

  hnand1.Config.PlaneSize = 1024;

  hnand1.Config.ExtraCommandEnable = ENABLE;

 HAL_NAND_Init(&hnand1, &ComSpaceTiming, &AttSpaceTiming);

Does anyone know if these values are for the

whole device

or just the

page

?

The typedefs in the HAL NAND driver suggest these are large values as they are in kB, so suggesting these are for the whole device. For my device the SpareAreaSize for a page is 64 bytes, so you can't set 0.0625 !!

In stm32f7xx_hal_nand.h:

uint32_t ;      

/*!< NAND memory page (without spare area) size measured in K. bytes */

uint32_t ; 

/*!< NAND memory spare area size measured in K. bytes                */

Thank you!

    This topic has been closed for replies.
    Best answer by David George
    Posted on January 30, 2018 at 12:58

    Kind of found an answer, looked in the actual 'stm32f7xx_hal_nand.h' file in my project and the struct is described differently from the help documentation;

    /**

      * @brief  NAND Memory info Structure definition

      */

    typedef struct

    {

      uint32_t        PageSize;              /*!< NAND memory page (without spare area) size measured in bytes

                                                  for 8 bits adressing or words for 16 bits addressing             */

      uint32_t        SpareAreaSize;         /*!< NAND memory spare area size measured in bytes

                                                  for 8 bits adressing or words for 16 bits addressing             */

     

      uint32_t        BlockSize;             /*!< NAND memory block size measured in number of pages               */

      uint32_t        BlockNbr;              /*!< NAND memory number of total blocks                               */

         

      uint32_t        PlaneNbr;              /*!< NAND memory number of planes                                     */

      uint32_t        PlaneSize;             /*!< NAND memory zone size measured in number of blocks               */

      FunctionalState ExtraCommandEnable;    /*!< NAND extra command needed for Page reading mode. This

                                                  parameter is mandatory for some NAND parts after the read

                                                  command (NAND_CMD_AREA_TRUE1) and before DATA reading sequence.

                                                  Example: Toshiba THTH58BYG3S0HBAI6.

                                                  This parameter could be ENABLE or DISABLE

                                                  Please check the Read Mode sequnece in the NAND device datasheet */

    }NAND_DeviceConfigTypeDef;

    2 replies

    David George
    David GeorgeAuthorBest answer
    Associate III
    January 30, 2018
    Posted on January 30, 2018 at 12:58

    Kind of found an answer, looked in the actual 'stm32f7xx_hal_nand.h' file in my project and the struct is described differently from the help documentation;

    /**

      * @brief  NAND Memory info Structure definition

      */

    typedef struct

    {

      uint32_t        PageSize;              /*!< NAND memory page (without spare area) size measured in bytes

                                                  for 8 bits adressing or words for 16 bits addressing             */

      uint32_t        SpareAreaSize;         /*!< NAND memory spare area size measured in bytes

                                                  for 8 bits adressing or words for 16 bits addressing             */

     

      uint32_t        BlockSize;             /*!< NAND memory block size measured in number of pages               */

      uint32_t        BlockNbr;              /*!< NAND memory number of total blocks                               */

         

      uint32_t        PlaneNbr;              /*!< NAND memory number of planes                                     */

      uint32_t        PlaneSize;             /*!< NAND memory zone size measured in number of blocks               */

      FunctionalState ExtraCommandEnable;    /*!< NAND extra command needed for Page reading mode. This

                                                  parameter is mandatory for some NAND parts after the read

                                                  command (NAND_CMD_AREA_TRUE1) and before DATA reading sequence.

                                                  Example: Toshiba THTH58BYG3S0HBAI6.

                                                  This parameter could be ENABLE or DISABLE

                                                  Please check the Read Mode sequnece in the NAND device datasheet */

    }NAND_DeviceConfigTypeDef;
    Amel NASRI
    Technical Moderator
    January 30, 2018
    Posted on January 30, 2018 at 15:57

    In which help documentation you find the wrong comment?

    -Amel

    To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
    David George
    Associate III
    January 30, 2018
    Posted on January 30, 2018 at 16:03

    Hi.

    I

    was

    looking in '..\STM32Cube_FW_F7_V1.5.0\Drivers\STM32F7xx_HAL_Driver\STM32F756xx_User_Manual.chm', old Cube version.

    I now have used '..\STM32Cube_FW_F7_V1.7.0\Drivers\STM32F7xx_HAL_Driver\STM32F756xx_User_Manual.chm' and the description is different.

    I assume that's the best to use for the STM32F767NIH device.

    The 'hint' inside the FMC NAND Setup dialog in STM32CubeMX however still mentions ' size in K. bytes ' which I think is wrong.

    David

    Jeanne Joly
    Associate
    March 20, 2018
    Posted on March 20, 2018 at 17:33

    Hi

    George.David.002

    ,

    This issue is now fixed in the current CubeMX release.

    Please, upgrade with CubeMX4.25 if not already done.

    BR. Jeanne