S32K358 IPCF mem size calculation

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

S32K358 IPCF mem size calculation

跳至解决方案
1,089 次查看
Iota
Contributor II

Hello NXP community,

I am interested in how the IPCF shared memory need is calculated correctly.

The project has 0x15000 of shared RAM assigend to c0 and c2 in the linker file and in the IPCF config shared mem size.

Further I created two channels with one buffer pool each. The pool of the first channel contains 18 buffers with size 4. The pool of the second channel should contain 1220 buffers of size 34.

All in all this is 18*4+1220*34=41552 raw bytes of data (0xA250).

This is way less than the available 0x15000 but still the init of the shared mem (ipc_shm_init) fails returning -2 (IPC_SHM_E_NOMEM).

When I reduce the number of buffers of the pool of the second channel to 459 (instead of 1220) it is working fine. 460 will fail again. But the total raw data is then limited to only 18*4+459*34=15678 (0x3D3E) leaving a hole of 0x112C2 bytes.

It is not possible that the configuration needs such an amount of mem space, is it? Is it a bug? What am I missing?

Note: the focus of the attached project is the configuration of IPCF not the code which is simply the example code. Breakpoint at the line of "err = ipc_shm_init(&ipcf_shm_instances_cfg);" stepping over and evaluating the error code.

Thanks in advance.

标记 (2)
0 项奖励
1 解答
920 次查看
nxf78987
NXP Employee
NXP Employee

Hello @Iota,

Sorry for my wrong calculation. This is the correct calculation.

nxf78987_0-1701743561886.png

Best regards,

Dan

在原帖中查看解决方案

0 项奖励
9 回复数
470 次查看
nxf45396
NXP Employee
NXP Employee

for new versions of IPCF you can use the defines from ipc_ip_cfg_defines.h

#define IPC_SHM_MEM_SIZE_IPCF_INSTANCE0 0x
#define IPC_SHM_MEM_SIZE_IPCF_INSTANCE1 0x

OCV
0 项奖励
458 次查看
AndreasStolze
Contributor IV

Thanks for the reply @nxf45396 


Since what version this define will be generated? We're currently using 4.1.0 for the S32K3 and I am not getting these defines.
AFAIK 4.1.0 is the latest one available for S32K3?

BR
Andreas

0 项奖励
434 次查看
nxf45396
NXP Employee
NXP Employee

for S32k3xx will be in next release

OCV
1,017 次查看
nxf78987
NXP Employee
NXP Employee

Hello @Iota,

This is the IPCF memory size layout.

nxf78987_0-1701238587427.pngnxf78987_1-1701238605849.png

You can refer to the above images to calculate IPCF mem size.

Best regards,

Dan

1,012 次查看
Iota
Contributor II

@nxf78987 thank you for the memory size layout.

Using this for my configuration results in the following:

16 + ( 19 × 8 ) + [ring channel 0]

16 + ( 19 × 8 ) + [ring pool 0]

18 × 4 + [data]

16 + ( 460 × 8 ) + [ring channel 1]

16 + ( 460 × 8 ) + [ring pool 0]

459 × 34 [data]

= 23382 (0x5B56)

But this is still far away from 0x15000 and the init still fails. Do you see another point in my project that could fail during initialization with return value -2?

0 项奖励
992 次查看
nxf78987
NXP Employee
NXP Employee

Hello @Iota,

Maybe, you calculated wrong. This is the right calculation.

nxf78987_0-1701256152641.png

Best regards,

Dan

0 项奖励
981 次查看
Iota
Contributor II

Hello Dan @nxf78987,

Thank you for the detailed information. If the calculation is correct and more than enough shared mem size is allocated via the IPCF config - what could be the root cause of the ipc_shm_init function returning IPC_SHM_E_NOMEM?

I think it is in managed_channel_init where it checks if pool fits into the shared memory. But this should be the case so there should not be any reason to return the error here...

0 项奖励
445 次查看
nxf78987
NXP Employee
NXP Employee

Hello @Iota,

Before call ipc_shm_init function(), the share memory must be cleared.

Did you to do that?

Best regards,

Dan

0 项奖励
921 次查看
nxf78987
NXP Employee
NXP Employee

Hello @Iota,

Sorry for my wrong calculation. This is the correct calculation.

nxf78987_0-1701743561886.png

Best regards,

Dan

0 项奖励