During nand flash erase, uart interrupt doesn't work properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-18 12:23 AM
Dear all
During nand flash erase, uart interrupt doesn't work properly. (same SysTick_Handler)
Let me know why this is happening.
nand flash erase source :
for(Addr.Plane=0;Addr.Plane<2;Addr.Plane++)
{
for(Addr.Block=0;Addr.Block<2048;Addr.Block++)
{
HAL_NAND_Erase_Block(&hnand1, &Addr);
}
}
Thanks
- Labels:
-
FMC-FSMC
-
STM32Cube MCU Packages
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-18 4:56 AM
The exact cause might depend on the flash chip model and the FMC configuration, so the following is just my speculation.
I think that the flash chip holds the NWAIT line low during the erase operation, blocking the external memory bus, which would in turn block the internal bus as soon as HAL_NAND_Erase_Block() starts polling the status register of the flash. When the internal bus is blocked, the MCU can't fetch more instructions, so interrupt handlers cannot be executed.
I would reimplement the erase function without HAL, and check the NWAIT line before trying to read the status register from flash. Even if the NWAIt pin is configured in alternate function mode, reading the pin state through GPIOx->IDR should work. Look up the signal interface in the flash datasheet, and check the pins to see when it's safe to issue the read status command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-18 5:18 PM
This is nand flash configration :
Can you check config?
​
/** Perform the NAND1 memory initialization sequence
*/
hnand1.Instance = FSMC_NAND_DEVICE;
/* hnand1.Init */
hnand1.Init.NandBank = FSMC_NAND_BANK3;
hnand1.Init.Waitfeature = FSMC_NAND_PCC_WAIT_FEATURE_ENABLE;
hnand1.Init.MemoryDataWidth = FSMC_NAND_PCC_MEM_BUS_WIDTH_8;
hnand1.Init.EccComputation = FSMC_NAND_ECC_ENABLE;
hnand1.Init.ECCPageSize = FSMC_NAND_ECC_PAGE_SIZE_2048BYTE;
hnand1.Init.TCLRSetupTime = 0;
hnand1.Init.TARSetupTime = 0;
/* hnand1.Config */
hnand1.Config.PageSize = 2048;
hnand1.Config.SpareAreaSize = 64;
hnand1.Config.BlockSize = 64;
hnand1.Config.BlockNbr = 2048;
hnand1.Config.PlaneNbr = 2;
hnand1.Config.PlaneSize = 2048;
hnand1.Config.ExtraCommandEnable = DISABLE;
/* ComSpaceTiming */
ComSpaceTiming.SetupTime = 2;
ComSpaceTiming.WaitSetupTime = 4;
ComSpaceTiming.HoldSetupTime = 3;
ComSpaceTiming.HiZSetupTime = 2;
/* AttSpaceTiming */
AttSpaceTiming.SetupTime = 2;
AttSpaceTiming.WaitSetupTime = 4;
AttSpaceTiming.HoldSetupTime = 3;
AttSpaceTiming.HiZSetupTime = 2;
​
if (HAL_NAND_Init(&hnand1, &ComSpaceTiming, &AttSpaceTiming) != HAL_OK)
{
Error_Handler( );
}
​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-19 1:27 AM
No, I can't, for two reasons.
- I don't know what kind of flash and MCU are you using, don't have the datasheets.
- HAL functions are too complicated for me to follow, and I have failed to find any documentation so far that explains them in sufficient depth for troubleshooting.
You can however read the FMC register values after HAL_NAND_Init() and check their values against the reference manual and the NAND datasheet.
