S32K344 C40 IP Hardware Fault Problem

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

S32K344 C40 IP Hardware Fault Problem

Jump to solution
10,054 Views
mesutkilicmak
Contributor II

Hi All,

I am trying to create custom bootloader app. I reserved 256KB space both bootloader app and parameters from the beginnig of the flash. I need to store boot parameters on the same block with the bootloader code. I tried to use C40 ip but, I am always getting HardFault error. As I learned from "AN13388-S32K3 Memories Guide" I can not write or erase same block while reading(code executing).

I tried some technics like ramcode and ITCM but, I could not be successful.

I do not want to use Data flash. Because HSE firmware uses all of it. 

What is the proper way to do that? Is there any example?

Tags (2)
0 Kudos
Reply
1 Solution
10,037 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @mesutkilicmak,

The below API functions have to be placed into SRAM (".ramcode" section), as show below.

  • C40_Ip_MainInterfaceSectorErase
  • C40_Ip_MainInterfaceSectorEraseStatus
  • C40_Ip_MainInterfaceWrite
  • C40_Ip_MainInterfaceWriteStatus

Then, the core must not access the block from interrupts. The interrupts must be either masked (PRIMASK = 1), or the vector table as well as the ISR() functions and the data the ISR() access must not be in the block.


C40_Ip.h.

Before the declaration:

#if ( 1 == C40_RAM_CODE_ENABLE
/* ram code start */
#define FLS_STOP_SEC_CODE
#include "Fls_MemMap.h"
#define FLS_START_SEC_RAMCODE
#include "Fls_MemMap.h"
#endif

After the declaration.

#if ( 1 == C40_RAM_CODE_ENABLE )
/* ram code end */
#define FLS_STOP_SEC_RAMCODE
#include "Fls_MemMap.h"
#define FLS_START_SEC_CODE
#include "Fls_MemMap.h"
#endif

if #define C40_RAM_CODE_ENABLE 1, the above four flash API functions are placed in the ".ramcode" section.

 

Regards,

Daniel

 

View solution in original post

7 Replies
10,027 Views
mesutkilicmak
Contributor II

Hi @danielmartynek 

Thank you for your answer. Your solution is worked for me.

In addition to your solution I also need to edit this function prototype too.

  • C40_Ip_MainInterfaceHVJobStatus

This function static in C40_Ip.c

I tried on C40 example. It worked fine but, does not worked my app. 

I removed the tick from "Fls Timeout Supervision Enabled" in C40_Ip. Because of the "OsIf_GetElapsed" function used.

I also need to move my functions that uses write and and erase to ramcode.

Regards,

Mesut

10,038 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @mesutkilicmak,

The below API functions have to be placed into SRAM (".ramcode" section), as show below.

  • C40_Ip_MainInterfaceSectorErase
  • C40_Ip_MainInterfaceSectorEraseStatus
  • C40_Ip_MainInterfaceWrite
  • C40_Ip_MainInterfaceWriteStatus

Then, the core must not access the block from interrupts. The interrupts must be either masked (PRIMASK = 1), or the vector table as well as the ISR() functions and the data the ISR() access must not be in the block.


C40_Ip.h.

Before the declaration:

#if ( 1 == C40_RAM_CODE_ENABLE
/* ram code start */
#define FLS_STOP_SEC_CODE
#include "Fls_MemMap.h"
#define FLS_START_SEC_RAMCODE
#include "Fls_MemMap.h"
#endif

After the declaration.

#if ( 1 == C40_RAM_CODE_ENABLE )
/* ram code end */
#define FLS_STOP_SEC_RAMCODE
#include "Fls_MemMap.h"
#define FLS_START_SEC_CODE
#include "Fls_MemMap.h"
#endif

if #define C40_RAM_CODE_ENABLE 1, the above four flash API functions are placed in the ".ramcode" section.

 

Regards,

Daniel

 

2,996 Views
Ali22
Contributor II

Hi, Danielmartynek

What dose"Then, the core must not access the block from interrupts. The interrupts must be either masked (PRIMASK = 1), or the vector table as well as the ISR() functions and the data the ISR() access must not be in the block." mean? Do you mean that vector table and ISR() functions and the data can't be place in the same block with BOOTLOADER and APP, if yes where should vector table and ISR() be place, in the RAM?

Tags (1)
0 Kudos
Reply
2,989 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Ali22,

While the flash controller is programming/erasing some data in a certain block, the block must not be accessed. I don't know how to explain it differently. Search for RWW Read-while-write in the RM.

 

0 Kudos
Reply
4,814 Views
Emguy
Contributor I

Please show sampel code how to place in c40 ip.h

 

0 Kudos
Reply
9,903 Views
WangLeiDevelopment
Contributor I

I find Bootloader project(unified_bootloader_demo_V2.1.exe) use C40_IP driver alsways run to hardware Falut . Then you uart for debug ,find program stoke at erase and write status (specific is inside  C40_Ip_Compare function is C40_Ip_SynchronizeCache)

0 Kudos
Reply
9,878 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @WangLeiDevelopment,

Can you create a new thread for this issue?

 

Thanks,

BR, Daniel

0 Kudos
Reply