MPC5748G: Does the ENET device appear as user or supervisor to the MPU?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MPC5748G: Does the ENET device appear as user or supervisor to the MPU?

ソリューションへジャンプ
1,958件の閲覧回数
peter_vranken
Contributor IV

Dear Support Team,

 

In my project, the Ethernet driver (ENET0) works well as long as I turn the MPU off. Otherwise I get a bus error on frame Rx (EIR[EBERR]=1). My RTOS uses the MPU with checking process ID and supervisor/user (i.e., problem state). Most likely, my problem sits in the specification of the access rules. To revise them, I would like to know if the ENET's DMA appears as a supervisor or as a user to the MPU? (Where to find this information?)

As I'm anyway reviewing the MPU settings, could you please tell me the same for the normal, common DMA?

 

Thanks a lot and kind regards,

Peter

0 件の賞賛
返信
1 解決策
1,922件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @peter_vranken 

this table from section "21.1 System Memory Protection Unit (SMPU) configuration" is important:

lukaszadrapa_0-1696308733300.png

Regards,

Lukas

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
1,698件の閲覧回数
JackChen2022
Contributor I

I had a problem similar to yours, EBERR problem during ENET initialization, seems to be unable to apply for send buffer descriptor. I want to know how you turn off the MPU function, I'm going to verify; How did you solve the problem

0 件の賞賛
返信
1,674件の閲覧回数
peter_vranken
Contributor IV

Hi Jack,


You ask how to turn the MPU off: this lets me think that our problems are not the same. In my project, the MPU is required and the task to solve was to define a memory region such that the ENET driver can fill it but user processes should not be able to touch the same memory area. The rules one has to formulate for granting or prohibiting access to some RAM depend on the privilege level of the code execution (or "executor", respectively) and this caused my question. The answer -- the MPU sees the ENET device as a user -- let to this modification of the MPU configuration: https://github.com/PeterVranken/DEVKIT-MPC5748G/blob/master/samples/safe-RTOS/code/system/RTOS/rtos_..., l.200, commit https://github.com/PeterVranken/DEVKIT-MPC5748G/commit/47ccfdb335518a64e1aee807eaddd51ba2cc0fdf.


However, if you don't want the MPU to operate, then, most likely, it doesn't; the MPU is off by default and out of reset, so if you didn't explicitly enable it in your startup code then it is not working and all RAM access is allowed, to normal code and as well to the ENET's DMA.


You probably will have to look for other possible reasons for seeing the bus error. Maybe your destination address is out of bounds, e.g., a NULL pointer, pointing to an address range, where no RAM sits at all. Maybe you disregarded the alignment of the destination address. For Rx frames, it needs to be 64 Byte aligned. See Reference Manual, section 42.6.14.1, pp.1670ff.

Kind regards,

Peter

0 件の賞賛
返信
1,669件の閲覧回数
JackChen2022
Contributor I
Thank you very much for your reply. Maybe our questions are different.
I have confirmed that the MPU module function of the device has been turned off, but the EBERR problem will occur when ENET is initialized to enable receiving or sending buffer descriptors, and the register RDSR and TDSR values will be reset to zero.
0 件の賞賛
返信
1,795件の閲覧回数
peter_vranken
Contributor IV

Meanwhile, I continued my experiments on this issue and it turned out that Ethernet0 as bus master no. 5 is considered a user to the MPU. The user access bits rwx need to be configured 110b to allow frame Rx and Tx by the device's DMA. It is not sufficient to set the supervisor bits.

Peter

0 件の賞賛
返信
1,923件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @peter_vranken 

this table from section "21.1 System Memory Protection Unit (SMPU) configuration" is important:

lukaszadrapa_0-1696308733300.png

Regards,

Lukas

0 件の賞賛
返信