cancel
Showing results for 
Search instead for 
Did you mean: 

Set FLASH_INTM after first Flash-Op

netz
Associate II
Posted on March 27, 2009 at 10:17

Set FLASH_INTM after first Flash-Op

2 REPLIES 2
netz
Associate II
Posted on March 26, 2009 at 05:02

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,

Steffen

Code:

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)){

}

}

netz
Associate II
Posted on March 27, 2009 at 10:17

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