CSEc: The program is stuck while CSEC_DRV_GenerateRND function

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

CSEc: The program is stuck while CSEC_DRV_GenerateRND function

887 Views
ZEROOO
Contributor IV

Hi

    When using the CSEc module CSEC_DRV_GenerateRND function to generate random numbers, the program will get stuck at the position where the command is sent. What is the specific reason for this phenomenon?

ZEROooo_0-1685343256504.pngZEROooo_1-1685343293434.png

 

 

Labels (1)
0 Kudos
8 Replies

874 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @ZEROOO 

I saw something similar when the device was not partitioned yet. Was the CSEc enabled by partition on this device?

What is the content of FSTAT, FCSESTAT0 and FERSTAT registers?

Do you use EEPROM at the same time?

Regards,

Lukas

0 Kudos

844 Views
ZEROOO
Contributor IV

Hi

    I am sure that the CSEc module has been started, because I executed CSEC_DRV_GenerateRND directly after initializing the driver module, which can generate random numbers normally. I don't quite understand what you said about using eeprom, we configured flexram to simulate eeprom, is there any problem.

Partition code:

status = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x3, 0x3, 0x1, false, true);
 
ZEROooo_0-1685409479522.pngZEROooo_1-1685409484104.pngZEROooo_2-1685409489274.png

 

 

 

0 Kudos

835 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Ok, there's nothing wrong in the registers.

Regarding CSEc and EEE:

lukaszadrapa_0-1685432699263.png

 Also the device can't run in high speed mode:

lukaszadrapa_1-1685432736387.png

 Notice that SDK drivers do not check if EEE/flash operation is running when CSEc functions are going to be executed. I was already asking for this but it is not implemented yet. Currently it is up to user to check this.

Regards,

Lukas

0 Kudos

814 Views
ZEROOO
Contributor IV

Hi

    CSE_PRAM cannot be accessed because of insufficient permissions. How to set access permissions?

0 Kudos

821 Views
ZEROOO
Contributor IV

Hi

    This problem is urgent, please provide help.I would like to know if calling CSEC_DRV_GenerateRND generates random numbers to determine whether partitioning is successful. If checking CSE_PRAM is always "can not access" and "skipped", is this normal? How to determine partitioning is successful?

ZEROooo_0-1685496861858.png

 

0 Kudos

829 Views
ZEROOO
Contributor IV

Hi Lukas,

    I assume that if the CSEc command conflicts with other memory operations, the corresponding register will report a failure.There is code in the SDK to detect if the EEE/flash operation is executing.CSEC_DRV_GenerateRND can be called directly after initialization. If it is placed in a periodic task, it will get stuck.

 

/*!
* @brief Waits for the completion of a CSEc command.
*
* This function waits for the completion of a CSEc command.
*/
static inline void CSEC_WaitCommandCompletion(void)
{
while ((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) == 0U)
{
/* Wait until the CCIF flag is set */
}
}

 

 

0 Kudos

801 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

The problem is that CSEC functions check only if another CSEC function is running using SW flag cmdInProgress. It does not check CCIF bit:

lukaszadrapa_0-1685513193546.png

CCIF flag is checked after triggering of the command. So, this function will not recognize if another flash operation is running. That's what I was talking about.

I would try to call CSEC_WaitCommandCompletion() function before calling the function to be sure all flash operations are finished. You can also try to disable interrupts for test purposes.

0 Kudos

788 Views
ZEROOO
Contributor IV

Hi

    I have tried this, checking the CCIF bit before executing the command, but I still have problems writing to the command header, and turning off the interrupt doesn't help.Are there any other lines of inquiry.

ZEROooo_0-1685514743810.png

 

0 Kudos