STM32F030C6开启WWDG 片内flash写异常
STM32F030C6开启WWDG在循环写片内flash时触发复位,使用了HAL库,系统启动后配置了WWDG,配置如下:Wwdg.Instance = WWDG;
Wwdg.Init.Prescaler = WWDG_PRESCALER_8;
Wwdg.Init.Window = 0x40;
Wwdg.Init.Counter = 0x7F;
Wwdg.Init.EWIMode = WWDG_EWI_ENABLE;
HAL_WWDG_Init(&Wwdg);
HAL_NVIC_SetPriority(WWDG_IRQn, 1, 0);
HAL_NVIC_EnableIRQ(WWDG_IRQn);
在不操作写片内flash时,系统运行正常(GPIO读写,WWDG都运作正常);
但如果执行一段循环写片内flash(反复擦写),极大概率会触发复位;
如果不开启WWDG,同样的flash写操作是没问题的。
请教各位,这是片内flash操作影响到WWDG的中断操作吗?还是哪里配置出问题了?
看门狗计数时间和芯片擦写的时间是不是超了 优化flash操作 可能是,Flash操作时间过长,没有及时喂狗。 问题应该如楼上各位所说的那样
在STM32F0的 Reference manual中,关于flash擦写操作有这么一段话:
On the contrary, during a program/erase operation to the Flash memory, any attempt to readthe Flash memory will stall the bus. The read operation will proceed correctly once the program/erase operation has completed. This means that code or data fetches cannot be made while a program/erase operation is ongoing.
也就是说在擦写过程中,中断程序是无法执行的
擦写过程需触发喂狗中断失败,导致系统复位。
如果flash擦写操作时间小于喂狗超时时间,可以在擦写前先手动喂狗,确保擦写flash过程无需触发喂狗中断。
感谢各位的回复,此贴已结。 对flash操作时间过长。你可以不开启看门狗,测试下对flash的操作时间 datasheet 上面有烧录时间的参数,根据楼主的烧录模式可以估算出大致执行时间,留出足够的余量就行:)
页:
[1]