Confuse by CE223820 example.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
EdHa_4455331
Level 5
Level 5
25 replies posted 25 sign-ins 10 replies posted

In main_cm4.c the registration to connect to a pipe message from CM0 is

/* Register the Message Callback */
Cy_IPC_Pipe_RegisterCallback(CY_IPC_EP_CYPIPE_ADDR,
CM4_MessageCallback,
IPC_CM0_TO_CM4_CLIENT_ID);

Which is what I expect it to be. But in main_cm0.c, the registration to connect to a pipe message from CM4 is

/* Register callback to handle response from CM4 */
Cy_IPC_Pipe_RegisterCallback(CY_IPC_EP_CYPIPE_ADDR,
CM0_MessageCallback,
CY_IPC_EP_CYPIPE_CM4_ADDR);

So why does the CM0 code use CY_IPC_EP_CYPIPE_CM4_ADDR instead of IPC_CM4_TO_CM0_CLIENT_ID? The function definition for Cy_IPC_Pipe_RegisterCallback in the PDL documentations calls for that parameter to be a clientId.  Which sounds more like IPC_CM4_TO_CM0_CLIENT_ID should be used. 

Hello Infineon: Worse still, CY_IPC_EP_CYPIPE_CM4_ADDR is not defined in any of the macros for IPC listed in the PDL documentation, and a workspace wide search doesn't find its definition either. So CE228320 seems to be using a completely undocumented #define for Y_IPC_EP_CYPIPE_CM4_ADDR , so I can't even see what its real value is.

Thanks,

Ed H.

 

 

0 Likes
1 Solution
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @EdHa_4455331

Yes, you are right. I believe the Client ID should have been used in the CM0+ code too. I will raise an internal ticket to look into this issue. The CYPIPE EP address is defined in cy_device.h and is also equal to 1, same as IPC_CM4_TO_CM0_CLIENT_ID which is why it is working. Thank you very much for pointing this out!

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
3 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @EdHa_4455331

Yes, you are right. I believe the Client ID should have been used in the CM0+ code too. I will raise an internal ticket to look into this issue. The CYPIPE EP address is defined in cy_device.h and is also equal to 1, same as IPC_CM4_TO_CM0_CLIENT_ID which is why it is working. Thank you very much for pointing this out!

Thanks and Regards,
Rakshith M B
0 Likes
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

Note that the Client ID needs to be an unique number for each IPC function you register for a given IPC address. Internally, there is an array of callbacks and the client ID is used as an index to access it.

Also note that the Client ID and the Pipe Endpoint are two different things. You could have set any value for the Client ID (as long is set less than the total number of Clients allowed). You can register multiple clients (which are linked to a callback function) to a given Pipe Endpoint Address.

You can even set the same value for the IPC_CM4_TO_CM0_CLIENT_ID and IPC_CM0_TO_CM4_CLIENT_ID. It wouldn't matter, because you registered them for different IPC Endpoints.

In summary:

1) We need 2 IPC Endpoints to use Pipes. One endpoint for the CM0+ and one endpoint to CM4. Each one has their own address:

CM0+ : CY_IPC_EP_CYPIPE_CM0_ADDR

CM4: CY_IPC_EP_CYPIPE_CM4_ADDR

2) For a given endpoint, you can have multiple client IDs. In this example, there is only one Client per endpoint.

CY_IPC_EP_CYPIPE_CM0_ADDR has IPC_CM4_TO_CM0_CLIENT_ID

CY_IPC_EP_CYPIPE_CM4_ADDR has IPC_CM0_TO_CM4_CLIENT_ID

3) Each Client ID is linked to one callback:

IPC_CM4_TO_CM0_CLIENT_ID -> cm0p_msg_callback

IPC_CM0_TO_CM4_CLIENT_ID -> cm4_msg_callback

Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @EdHa_4455331

We recommend referring to the ModusToolbox Code Example for your application - PSoC™ 6 MCU: Dual-CPU IPC pipes. This code example uses the Client ID even in the CM0+ application - cm0p main.c

Hope this helps,

Thanks and Regards,
Rakshith M B
0 Likes