S32K358 IPCF mem size calculation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K358 IPCF mem size calculation

Jump to solution
2,022 Views
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.

Tags (2)
0 Kudos
Reply
1 Solution
1,853 Views
nxf78987
NXP Employee
NXP Employee

Hello @Iota,

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

nxf78987_0-1701743561886.png

Best regards,

Dan

View solution in original post

0 Kudos
Reply
10 Replies
1,403 Views
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 Kudos
Reply
1,391 Views
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 Kudos
Reply
1,367 Views
nxf45396
NXP Employee
NXP Employee

for S32k3xx will be in next release

OCV
879 Views
AndreasStolze
Contributor IV

Hi @nxf45396 

any news when the update will drop?

BR
Andreas

0 Kudos
Reply
1,950 Views
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,945 Views
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 Kudos
Reply
1,925 Views
nxf78987
NXP Employee
NXP Employee

Hello @Iota,

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

nxf78987_0-1701256152641.png

Best regards,

Dan

0 Kudos
Reply
1,914 Views
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 Kudos
Reply
1,378 Views
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 Kudos
Reply
1,854 Views
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 Kudos
Reply