Hi,
I set up a binary for S32K358 with the Eth_43_GMAC_TS_T40D34M30I0R0 Driver and get an unhandled exception durring Start-Up in the Init of the driver .
The exception appears at the beginning of the DMA Initializing (See chapter 75.16.1 of S32K3xx Reference Manual, Rev. 5, 09/2022) in Gmac_Ip_InitDMA() after the software reset is provided. The highlevel-code looks like this:
Base = Gmac_apxBases[Instance];
/* Provide a software reset. */
Base->DMA_MODE |= GMAC_DMA_MODE_SWR_MASK;
In lowlevel this instructions are swapped. I think this happens due to compiler optimizations of the GreenHills-Compiler. But I am not realy sure if this is the problem here.
Now the question is, why this is happening? Do I need to configure the DMA at another point (for example in the Mcu module?). Or does the problem lie elsewhere?
Please help me at this point.
Thank you!
Hello @BenjaminKubitschek,
The GHS Compiler/Linker/Assembler Options can be found in the release notes of the drivers.
For example, optimization level:
Other possibility is that the module is not clocked.
What kind of exception is it?
Bus fault or Usage fault?
Can you read the Configurable Fault Status Register (CSFR) in the handler?
BR, Daniel
Hi @danielmartynek,
the deactivation of the compiler optimization brought the execution in the "correct" order, but the exception still appears, so it is not the the problem here.
I do not know which register you men with the CSFR. Is it a special function register or where can I finde it? When I search in the RM for "CSFR" I do not finde a entry. I am still a bit inexperienced with working on hardware and therefore need to have your support again here.
I think the problem here is that a register is loaded which is not initialized. In assembler the code, where the exception appears is:
ldr r2,[r3,#0x00]
in r3 there is the Adress 0x4048500 present, which is the adress of the DMA_MODE register. The debugger isnt able to read the value here with the message "Can not acces target memory".
Is it possible that there is a access lock for this registers? Or is it that this memory space has to be initialized explicitly beforehand?
I think the module is clocked (I am not sure how to prove it). I configured two reference points in the MCU module:
- EMAC_CLK_TS as Module Reference Clock (40 MHz)
- FIRC_CLK as Time Stamp Reference Clock
and referenced them in the eth-module-configuration. I also made sure that the Mcu_InitClock() is called before the init of the ethernet driver.
Thank you for you reply, I hope this additional infos, can help by supporting me. I look forward to an answer
BR,
Benny
Hi Benny,
Just regarding the register.
CSFR is a register of the core, it is similar to CM4 on S32K1xx:
https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447
Hi @danielmartynek,
thank you for reply, I am now able to finde the register-content:
The MMFSR Reg of the CFSR is set here (at 0xE000ED28):
The DACCVIOL and the MMARVALID Flag are set after the exception.
As MMARVALIG is the indicator, that the MMFAR register holds the address which triggered the MemManage fault, I looked for the adress at 0xE000ED34 with the following content:
0x40485000
This also fits with my last message: This is the DMA_MODE register, which I am not able to read with the debugger. So my guess is that this area is not initalized.
How do you see it? What is needed here to solve the problem?
BR,
Benny