Find GPIF2 mirror state IDs

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

cross mob
KaFu_3122371
Level 1
Level 1
First like given 10 sign-ins 5 questions asked

Is there a way to know what state IDs are assigned to mirror states in the FX3's GPIF2 state machine (the value returned by CyU3PGpifGetSMState)?

0 Likes
1 Solution

Hello,

I would like to add to my previous post.

From the source code of CyU3PGpifGetSMState() API, it is found that it accesses bits 31:24 of  GPIF_WAVEFORM_CTRL_STAT register (refer FX3 TRM Section 10)  for current state.

When the CPU interrupt is triggered from the mirror state The 31 bit of GPIF_WAVEFORM_CTRL_STAT register is set to 1.

For example: If the CPU interrupt is in State 3 (which has mirror states)

The current state bits [31:24] of  GPIF_WAVEFORM_CTRL_STAT would be 0x83 (128 + state no.)

You can call CyU3PGpifGetSMState() API in the GPIF callback and get the ID into a variable and later get it printed in the for{} loop.

Please share the GPIF state machine files (.cyfx) so that i can help you better (for the case where there are more one mirror state  of that state)

Regards,

Rashi

Regards,
Rashi

View solution in original post

0 Likes
4 Replies
lock attach
Attachments are accessible only for community members.
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Yes, the GPIF state IDs can be read using CyU3PGpifGetSMState API.

For using this API you can call this API as shown:

uint8_t SMState =0;

CyU3PGpifGetSMState (&SMState);

CyU3PDebugPrint (4, "\n\rAplnStrt:SMState = 0x%x", SMState);

Note: To get the state id from some callback (eg: DMA Callback) function, you can call this API in that function and set an event there(refer attachment). Then in the for{} loop track that event to get the state printed. It is recommended not to use debug prints in the call back functions.

Regards,

Rashi

Regards,
Rashi
0 Likes

My problem is that I have INTR_CPU action in multiple states, and I want to be able to differentiate between the states that interrupted the CPU. However if I modify the state machine such that I can know which state interrupted the CPU in some other way, the mirror ID that I get with that modified state machine is different from the mirror ID that I get without such modification.

0 Likes
lock attach
Attachments are accessible only for community members.

Hello,

Please find the attached firmware. I have registered a GPIF callback. In the call back you get the current state. You can parse the current state as per the  header file (Refer attachment).

You assign different variables for different cases and increment them when there is a call back. I have used counter as variable for the example firmware.

Please let me know if this helps

Regards,

Rashi

Regards,
Rashi
0 Likes

Hello,

I would like to add to my previous post.

From the source code of CyU3PGpifGetSMState() API, it is found that it accesses bits 31:24 of  GPIF_WAVEFORM_CTRL_STAT register (refer FX3 TRM Section 10)  for current state.

When the CPU interrupt is triggered from the mirror state The 31 bit of GPIF_WAVEFORM_CTRL_STAT register is set to 1.

For example: If the CPU interrupt is in State 3 (which has mirror states)

The current state bits [31:24] of  GPIF_WAVEFORM_CTRL_STAT would be 0x83 (128 + state no.)

You can call CyU3PGpifGetSMState() API in the GPIF callback and get the ID into a variable and later get it printed in the for{} loop.

Please share the GPIF state machine files (.cyfx) so that i can help you better (for the case where there are more one mirror state  of that state)

Regards,

Rashi

Regards,
Rashi
0 Likes