I’m a beginner of develop NXP product.
When I run the OTA_S32K144_Use_Case_WS Demo program in the AN12323 document using the S32K144 EVB Board, the following error occurs.
(The details of each error when executed on 2 sets of PCs with different OS environments are are as follows.)
I would like to be provided with a development environment that can operate normally and detailed explanations about the process or provided with the firmware (binary file) that runs normally.
I am looking forward to your help.
Environment:
已解决! 转到解答。
Hi @HSByun
as I can see on the first screenshot, the device is already partitioned but in different way than what is configured in S32K144_Memory_Partition_Debug_RAM. This example configures:
FTFC->FCCOB[6] = 0x0A; /* FCCOB5 = 0x0A, 16K data flash, 48k EEPROM backup */
But I can see in FCFG1 that whole FlexNVM is already allocated for EEPROM backup flash. So, someone obviously already enabled the Emulated EEPROM and maybe also CSEc on this device.
Step 1: Try to run mass erase (Erase All Blocks Unsecure command). You can add this code to project S32K144_Memory_Partition, to function configure_part_CSEc() before running partition comnmand:
while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) != FTFC_FSTAT_CCIF_MASK); /* Wait until any ongoing flash operation is completed */
FTFC->FSTAT = (FTFC_FSTAT_FPVIOL_MASK | FTFC_FSTAT_ACCERR_MASK); /* Write 1 to clear error flags */
FTFC->FCCOB[3] = 0x49; /* FCCOB0 = 0x49, Erase All Blocks Unsecure command */
FTFC->FSTAT = FTFC_FSTAT_CCIF_MASK; /* Start command execution by writing 1 to clear CCIF bit */
while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) != FTFC_FSTAT_CCIF_MASK); /* Wait until ongoing flash operation is completed */
flash_error_status = FTFC->FSTAT; /* Read the flash status register for any Execution Error */
If it is successful, it should work now. If not, the CSEc was obviously enabled. To remove the partition, you need to know MASTER_ECU_KEY. If you don't know it, you need to use new device.
In case that example projects from application note AN5401 or from SDK were used, you can try to run:
1. Project 5_Resetting_flash_to_the_factory_state from AN5401:
https://www.nxp.com/webapp/Download?colCode=AN5401&location=null
https://www.nxp.com/webapp/Download?colCode=AN5401SW&location=null
2. This project from SDK:
c:\NXP\S32DS.3.4\S32DS\software\S32SDK_S32K1XX_RTM_4.0.2\examples\S32K144\driver_examples\system\csec_keyconfig\
... with this macro set to '1':
/* Set this macro-definition to 1 if you want to reset all the keys */
#define ERASE_ALL_KEYS 1
If one of these projects was used in the past with no modification of MASTER_ECU_KEY then this will disable the CSEc, so you can start over. If you are not successful with this, it will be necessary to use new device.
Regards,
Lukas
Hi @HSByun
the projects from AN12323 were created in S32DS 2018 R1, so I would recommend to use this version. I did quick test on my side and I can successfully load this project to S32K144 EVB via OpenSDA.
Did you try to load another project to your board? Maybe you can create only new empty project in S32DS 2018 R1 to see if it is working.
Also I would recommend to update Pemicro drivers, I guess that this could help:
https://www.pemicro.com/downloads/download_file.cfm?download_id=53
Regards,
Lukas
Hi, Lukas
Thank you for your kind help.
Unfortunately, When I run (click debug button) the program, I get the following error.
Could I receive the program that worked normally?
The hello_s32k144 project works normally.
(Blue LED turns on when SW2 on the EVB Board is pressed)
Regards,
HSByun.
There's obviously no problem with the project itself. The error message shows that there's some problem with data flash. Was CSEc enabled on your board? It could be the reason.
Also could you double check if this flash algorithm is selected in debug configuration?
Regards,
Lukas
Hi @HSByun
could you show me content of FCFG1 register? It's in SIM module.
And can you check end of FlexRAM memory? I mean address 0x1400_0FFF and lower. If CSEc is enabled, the end of FlexRAM is allocated for keys and then it's not visible in memory map - it's hidden and it can be accessed only by CSEc.
Regards,
Lukas
Hi, Lukas
When S32K144_Memory_Partition_Debug_RAM is executed, the FCFG1 register value is as follows.
FCFG1 value is 0xFF 32 40 00
End of FlexRAM memory could not be checked.
If you tell me how to check in more detail, I will check it.
Instead, it is said that 4KB is correct for the following data.
Regards,
HSByun.
Hi @HSByun
as I can see on the first screenshot, the device is already partitioned but in different way than what is configured in S32K144_Memory_Partition_Debug_RAM. This example configures:
FTFC->FCCOB[6] = 0x0A; /* FCCOB5 = 0x0A, 16K data flash, 48k EEPROM backup */
But I can see in FCFG1 that whole FlexNVM is already allocated for EEPROM backup flash. So, someone obviously already enabled the Emulated EEPROM and maybe also CSEc on this device.
Step 1: Try to run mass erase (Erase All Blocks Unsecure command). You can add this code to project S32K144_Memory_Partition, to function configure_part_CSEc() before running partition comnmand:
while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) != FTFC_FSTAT_CCIF_MASK); /* Wait until any ongoing flash operation is completed */
FTFC->FSTAT = (FTFC_FSTAT_FPVIOL_MASK | FTFC_FSTAT_ACCERR_MASK); /* Write 1 to clear error flags */
FTFC->FCCOB[3] = 0x49; /* FCCOB0 = 0x49, Erase All Blocks Unsecure command */
FTFC->FSTAT = FTFC_FSTAT_CCIF_MASK; /* Start command execution by writing 1 to clear CCIF bit */
while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) != FTFC_FSTAT_CCIF_MASK); /* Wait until ongoing flash operation is completed */
flash_error_status = FTFC->FSTAT; /* Read the flash status register for any Execution Error */
If it is successful, it should work now. If not, the CSEc was obviously enabled. To remove the partition, you need to know MASTER_ECU_KEY. If you don't know it, you need to use new device.
In case that example projects from application note AN5401 or from SDK were used, you can try to run:
1. Project 5_Resetting_flash_to_the_factory_state from AN5401:
https://www.nxp.com/webapp/Download?colCode=AN5401&location=null
https://www.nxp.com/webapp/Download?colCode=AN5401SW&location=null
2. This project from SDK:
c:\NXP\S32DS.3.4\S32DS\software\S32SDK_S32K1XX_RTM_4.0.2\examples\S32K144\driver_examples\system\csec_keyconfig\
... with this macro set to '1':
/* Set this macro-definition to 1 if you want to reset all the keys */
#define ERASE_ALL_KEYS 1
If one of these projects was used in the past with no modification of MASTER_ECU_KEY then this will disable the CSEc, so you can start over. If you are not successful with this, it will be necessary to use new device.
Regards,
Lukas