cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_NOR_MspWait implementation

Nickjmas
Associate III
Posted on March 13, 2017 at 15:44

Hello

I generated a project with Stm32CubeMX with a NOR Flash connected in the FSMC. This NOR Flash has a Ready/Busy signal and the HAL NOR has a function to handle this signal: HA_NOR_MspWait. What can I do, if I want to implement this function without modifying the stm32f4xx_hal_nor.c file?

Best regards!

#fsmc-nor #hal
2 REPLIES 2
Posted on March 13, 2017 at 22:45

> This NOR Flash has a Ready/Busy signal

Can you give a link to its datasheet?

I don't Cube so I don't know how to do this in that environment, but generally you enable the asynchronous WAIT using ASYNCWAIT bit in the respective FSMC_BCRx register. There are several timing considerations which go with this bit, read the WAIT management in asynchronous accesses subchapter of FSMC chapter. And of course, don't forget to connect the NWAIT pin and set it up as appropriate AF in GPIO.

JW

Nickjmas
Associate III
Posted on March 14, 2017 at 10:37

Hi waclawek.jan

the datasheet Flash memory is

https://community.st.com/external-link.jspa?url=http%3A%2F%2Fwww.cypress.com%2Ffile%2F177976%2Fdownload

(S29GL128S). My current MCU is a SMT32F429 with a LCD. The NWAIT's pin is used by the LCD_B2 function of LCD's driver . RY/BY's signal is connected to PC13 (This pin hasn't an alternative function). My idea is manage the wait procedure implementing the HAL_NOR_MspWait function.

In the STM32F10x_StdExamples, there is an example of FSMC NOR without HAL implementation and the management of RD/BY signal. I think in my case, my HAL_NOR_MspWait has contain a code something like this:

NOR_Status NOR_GetStatus(uint32_t Timeout)

{

   uint16_t val1 = 0x00, val2 = 0x00;

   NOR_Status status = NOR_ONGOING;

   uint32_t timeout = Timeout;

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

   while((GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_6) != RESET) && (timeout > 0))

   {

      timeout--;

   }

   timeout = Timeout;

   while((GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_6) == RESET) && (timeout > 0))

   {

   timeout--;

   }

   ...

}

0690X00000606VGQAY.png0690X00000606YrQAI.png

Best regards