Command complete interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Command complete interrupt

Jump to solution
2,700 Views
814420552
Contributor III

Hello,

  when FTFC command comlete will set CCIF =1  and if enable CCIE(Command complete interrupt), then wii trigger Command complete interrupt,  

  My question is that CCIF is always equal to 1, so is it that the interruption will always occur?

 and how to make a FTFC Read Collision Error interrupt? can you geive me a demo code for this?


0 Kudos
1 Solution
2,648 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello 814420552@qq.com,

Regarding CCIE,

Clear the CCIF flag to launch an FTFC command and enable the interrupt after that CCIE = 1.

In the interrupt handler function, disable the interrupt CCIE = 0.

You can generate the FTFC Read Collision Error interrupt by launching an FTFC command on a certain flash block (or partition) and reading some data from the flash block while waiting for the CCIF flag.

Regards,

Daniel

View solution in original post

0 Kudos
5 Replies
2,649 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello 814420552@qq.com,

Regarding CCIE,

Clear the CCIF flag to launch an FTFC command and enable the interrupt after that CCIE = 1.

In the interrupt handler function, disable the interrupt CCIE = 0.

You can generate the FTFC Read Collision Error interrupt by launching an FTFC command on a certain flash block (or partition) and reading some data from the flash block while waiting for the CCIF flag.

Regards,

Daniel

0 Kudos
2,624 Views
814420552
Contributor III

hello,

my  test flow is the following code !!

void EraseFlashSector(void)
{
uint32_t address = 0x00008000;
uint32_t flashData = 0 ;
uint32_t i = 0;

//erase 4KB flash sector (the smallest entity that can be erased)
while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) == 0); // Wait if operation in progress
FTFC->FSTAT = FTFC_FSTAT_ACCERR_MASK | FTFC_FSTAT_FPVIOL_MASK;

FTFC->FCCOB[3] = 0x09; //Erase Flash Sector command (0x09)
FTFC->FCCOB[2] = (address >> 16) & 0xff; //Flash address [23:16]
FTFC->FCCOB[1] = (address >> & 0xff; //Flash address [15:08]
FTFC->FCCOB[0] = address & 0xff; //Flash address [7:0]

FTFC->FSTAT = FTFC_FSTAT_CCIF_MASK; //launch command
while(( FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) == 0)
{

flashData = *(uint32_t *)(0x8000 + 4);

flashData = *(uint32_t *)(0x8000 + 8);

flashData = *(uint64_t *)(0x8000 + 16);

for(i = 0; i< 1024;i++)
{
flashData = *(uint32_t *)(0x8000 + i*4);
}
}//wait for done
}

main ()

{

/* Enable global interrupt */
INT_SYS_EnableIRQGlobal();

FTFC->FCNFG |= 0x40;// enable read conflcit interrupt

INT_SYS_EnableIRQ(Read_Collision_IRQn);

 

EraseFlashSector();

}

 

 

my it can't generate read conflision interrupt !  can you help me?  thanks very much!

0 Kudos
2,647 Views
814420552
Contributor III

hello Daniel,

The code calls are configured in the following order:

step 1:

FLASH_DRV_Program(&flashSSDConfig, 0x10000048, 48, sourceBuffer);

step 2:

FTFC->FERCNFG |= 0x02;//DFDIE enable

then when this above program command completed, it will generate interrupt!

 

because if enable DIFIE firstly  it will Interrupt (CCIF = 1) immediately, the order can't  as the following:

step 1:

FTFC->FERCNFG |= 0x02;//DFDIE enable

step 2:

FLASH_DRV_Program(&flashSSDConfig, 0x10000048, 48, sourceBuffer);

 is  my understanding right?

0 Kudos
2,647 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello 814420552@qq.com,

The FLASH_DRV_Program() function calls the FLASH_DRV_CommandSequence() function that clears the CCIF flag and polls the flag in a loop.

pastedImage_2.png

If you program more than one phrase using the FLASH_DRV_Program() function, at the time the function is complete, the CCIF flag has been cleared and set a few times already.

There is no point in enabling the CCIF interrupt after that function.

You would need to modify the driver as I explained above.

Regards,

Daniel

0 Kudos
2,647 Views
814420552
Contributor III

hello, 

i have got it , thanks very much!

0 Kudos