MemAcc works in Data Flash but not in Code Flash

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

MemAcc works in Data Flash but not in Code Flash

Jump to solution
1,702 Views
FelixR
Contributor III

Hello there smart people,

we are currently developing our bootloader for the S32K324 and use theMemAcc with the underlying Mem_43_INFLS driver from the S32K3_S32M27x Real-Time Drivers ASR R21-11 Version 4.0.0 P19 driver package.

There I noticed that the MemAcc_Write() function works flawlessly as long as I write data into the Data-Flash section. As soon as I have a code flash section that I want to write to the drive does write between 16-Byte and 128-Byte of data before resulting in a Hardfault.

I allready checked the HFSR and it states an FORCED Hardfault and the BFSR does show an IMPRECISERR.

The memoryaddress I try to write is th 0x440000 - 0x442000. a codeflash section wich is aligned to the 8k sector boundary and after flashing still uninitialized. So it contains only 0xFF.

I try to switch to the C40 Driver for a testrun and there the Flash didn't accept any data while the driver returned STATUS_SUCCESS. But here a hardfault didn't happen.

Does anybody has an Idea how I can further debug my problem?

0 Kudos
Reply
1 Solution
1,642 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @FelixR,

If you have the MEM_43 code in the same block as the one you program, there will be RWW issues.

The code should be placed in either another flash block or SRAM.

Refer to the User Manual MEM_43 driver.

danielmartynek_1-1724666029254.png

 

BR, Daniel

 

 

 

 

View solution in original post

4 Replies
1,643 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @FelixR,

If you have the MEM_43 code in the same block as the one you program, there will be RWW issues.

The code should be placed in either another flash block or SRAM.

Refer to the User Manual MEM_43 driver.

danielmartynek_1-1724666029254.png

 

BR, Daniel

 

 

 

 

1,614 Views
FelixR
Contributor III
I did find the solution for my error which occured only during ISRs.

The Driversetting wasn't the problem with loading the write function into the SRAM. The problem was that while I was writing into my C-Flash block 0 an ISR was triggerted. The Code of the ISR was placed inside this C-Flash Block 0, resulting in a RWW error.

This explains why it was working inside other Flashblocks and while interrupts were disabled but not while the interrupts were enabled.
1,635 Views
FelixR
Contributor III

Hey @danielmartynek,

I thought so too that there might be a RWW error when targeting errors inside the same Code-Flash block. But that is not the case.

I tested writing Data into the C-Flash Block 3 while the Code was executed inside the C-Flash Block 0. There also the HardFault happened.

Also I tested the Settings you highlighted inside your picture. This also didn't help and the HardFault was still present.

I checked the Stack-Trace before the HardFault was called and noticed, that the CAN Error-Interrupt somehow takes part in this.

FelixR_0-1724672418518.png

Now, removing the CAN-Error Interrupts did solve my problem. Now the C-Flash can be written. But how is this related? This Code executed inside this error Interrupt is also not inside the C-Flash Block 3 I'm trying to write?

0 Kudos
Reply
1,671 Views
FelixR
Contributor III
I just tested again to check all status registers.
The BFSR does not show an imprecise error, it shows an IBUSERR.
Also the DFSR shows a 9, indicating a Domain fault on Section.
0 Kudos
Reply