cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4: WIP Bit Never zeros out in function: sFLASH_WaitForWriteEnd

Rogers.Gary
Senior II
Posted on October 12, 2015 at 22:02

Hi,

The Micron M25P128 flash seems to be writing and reading OK. As clive1 suggested, the SPI flash functionality is written in the Std Peripheral examples, so I am using that.

When I execute the call to: sFLASH_EraseSector, this function calls:

 sFLASH_WaitForWriteEnd

which waits for the read status register's WIP bit to go low. Well, it never happens. It just sits there.....and spins.

How long should a call to sFLASH_EraseSector take?

The function sFLASH_WaitForWriteEnd  is pasted below.

Thanks,

Gary

*****************************************************************

void sFLASH_WaitForWriteEnd(void)

{

  uint8_t flashstatus = 0;

  /*!< Select the FLASH: Chip Select low */

  sFLASH_CS_LOW();

  /*!< Send ''Read Status Register'' instruction */

  sFLASH_SendByte(sFLASH_CMD_RDSR);

  /*!< Loop as long as the memory is busy with a write cycle */

  do

  {

    /*!< Send a dummy byte to generate the clock needed by the FLASH

    and put the value of the status register in FLASH_Status variable */

    flashstatus = sFLASH_SendByte(sFLASH_DUMMY_BYTE);

  }

  while ((flashstatus & sFLASH_WIP_FLAG) == SET); /* Write in progress */

  /*!< Deselect the FLASH: Chip Select high */

  sFLASH_CS_HIGH();

}
1 REPLY 1
Posted on October 13, 2015 at 03:35

Can we keep stuff that's ostensibly about the same problem arc in one thread. Thanks.

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F4%20ST%20Example%20SPI%20Not%20Functioning%20-%20Sector%20Erase&currentviews=3]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FSTM32F4%20ST%20Example%20SPI%20Not%20Functioning%20-%20Sector%20Erase¤tviews=3

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..