Issue writing in DDR4 with Linux

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

Issue writing in DDR4 with Linux

1,466件の閲覧回数
luipaegom
Contributor I

I am using the following board S32G-VNP-RDB3. I have Linux installed and I would like to write and read from the DDR4 memory which is on the board. I have the S32G2 Memory Map excel file provided by NXP to check what physical addresses are being used by the MCU to interface with the DDR4. The thing is that when I run my .c code from the addresses 0x8_0000_0000 to 0x8_1000_0000 and try to write there, at some point my OS crashes and I have to restart the board. I have checked on Linux with cat proc/iomem that this chunk is not reserved and it should be free. 

I also realized that when I try to write 64 KiB of data it works but it does not when I go for example to 1 MB.

Ps: I am using /dev/mem and mmap function

0 件の賞賛
返信
7 返答(返信)

1,323件の閲覧回数
chenyin_h
NXP Employee
NXP Employee

Hello, @luipaegom 

Thanks for your reply.

My suggestion is to ignore these description related with DDR1.

Sorry for your inconvenience.

 

BR

Chenyin

0 件の賞賛
返信

1,362件の閲覧回数
chenyin_h
NXP Employee
NXP Employee

Hello, @luipaegom 
Thanks for your reply.

From my understanding, it means that the same physical address of DDR could be accessed by the host from alternative address space, for example, the first 1G bytes of DDR could be accessed via “0x80000000-0xBFFFFFFF” and alternatively "0x800000000-0x83FFFFFFF".

 

BR

Chenyin

0 件の賞賛
返信

1,332件の閲覧回数
luipaegom
Contributor I

Hi @chenyin_h ,

Thanks for your answer; now it is more clear. I now have another question about the .xls file. There are in the bottom some memory addresses referring to DDR_1 and previously I have seen that there are others referring to DDR_0. What is the difference between them? As far as I have checked in the datasheets of my board, there is only one DDR in the memory.

Best,

0 件の賞賛
返信

1,382件の閲覧回数
chenyin_h
NXP Employee
NXP Employee

Hello, @luipaegom 

Thanks for your reply.

1. According to the note at the bottom of the xls file, the "always mirror" means mirrored on both "mode 1+1" and "Mode 2+0", while  "mirror in mode 2 + 0"  means the address only mirrored on "mode 2+0".

2. According to the same xls, 0x8_0000_0000 to 0x8_1000_0000 is mirrored to the ddr(0-1G), access these address would access the same with 0x80000000-0xBFFFFFFF, from my understanding, while Linux booted, some of address that from the beginning would be reserved for kernel use, thus not every chunk of RAM could be accessed by the user.

In summary, I suggest modifying your code to test with 0x810000000-0x820000000, to check if there are still issues existed.

 

BR

Chenyin

0 件の賞賛
返信

1,378件の閲覧回数
luipaegom
Contributor I

HI @chenyin_h ,

Thanks for your answer, I understand better what is happening. Just to check with you, when in the .xls file the term "mirror" appears, does it mean that the DDR4 controller is accessing two different addresses?

 

0 件の賞賛
返信

1,439件の閲覧回数
chenyin_h
NXP Employee
NXP Employee

Hello, @luipaegom 

Thanks for the post.

May I know which version BSP is used during your test? you were referring the S32G2 Memory Map excel file? not the one for S32G3?

 

BR

Chenyin

0 件の賞賛
返信

1,423件の閲覧回数
luipaegom
Contributor I

Hi,

I was using the wrong Excel file (S3G2 instead of S3G3) for the memory address map, but despite that I don't fix my problem because the addresses displayed in both for the DDR4 are the same. 

I was also wondering, what does "always mirrored" and "mirror in mode 2 + 0" mean?

0 件の賞賛
返信