MemAcc works in Data Flash but not in Code Flash

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MemAcc works in Data Flash but not in Code Flash

跳至解决方案
1,689 次查看
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 项奖励
回复
1 解答
1,629 次查看
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

 

 

 

 

在原帖中查看解决方案

4 回复数
1,630 次查看
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,601 次查看
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,622 次查看
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 项奖励
回复
1,658 次查看
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 项奖励
回复