2009-03-27 02:17 AM
Set FLASH_INTM after first Flash-Op
2009-03-25 09:02 PM
Hello,
I try to initialize my Flash. I've learned to do this from RAM. But after this, it should be possible to set INTM in FLASH->CR0?! The following code prints: count = 4 thus I have to write 4x the Register CR0. Why? Thanks, SteffenCode:
FLASH_SectorErase(FLASH_B1); int c=0; while( !(FLASHR->CR0 & FLASH_INTM_Mask) ) { FLASHR->CR0 |= FLASH_INTM_Mask; c++; } printf(''count=%dn'',c); ... __ramfunc void FLASH_SectorErase(u32 Xsectors) { FLASH_WaitForLastTask(); FLASHR->CR0 |= FLASH_SER_Mask; FLASHR->CR1 |= (Xsectors & 0x000300FF); FLASHR->CR0 |= FLASH_WMS_Mask; if ( !(FLASHR->CR0 & FLASH_INTM_Mask) ){ FLASH_WaitForLastTask(); // Does'nt work with ISR !?? } __ramfunc void FLASH_WaitForLastTask(void) { while (FLASHR->CR0&(FLASH_LOCK | FLASH_BSYA0 | FLASH_BSYA1)){ } }2009-03-27 02:17 AM
Hello,
the problem is solved. In the flash.h the FLASH_LOCK, FLASH_BSYAx are numeric, not bits. Therefore I've tested the wrong bits in CR0.:-[ Greetings, Steffen