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
5,288 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
1 Solution
5,271 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

5 Replies
5,261 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

5,272 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

 

48 Views
Emguy
Contributor I

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

 

0 Kudos
5,137 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
5,112 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @WangLeiDevelopment,

Can you create a new thread for this issue?

 

Thanks,

BR, Daniel

0 Kudos