Announcements

Ever wondered how you could apply Infineon products in a sustainable way? Join us at OktoberTech Asia Pacific and get inspired Click here to register for FREE.

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

USB superspeed peripherals Forum Discussions

ankitvats846
Level 2
10 replies posted 10 sign-ins 5 questions asked
Level 2

I Load the GPIF configuration for Slave FIFO sync mode.

And start GPIF state machine by using this api CyU3PGpifSMStart(RESET, ALPHA_RESET);

Whole configuration is done like 

###### See GPIF_config.PNG  ##### 

Now I need the RESET the GPIF configuration.

###  see attach file GPIF_reset.PNG ###

I try these api

1) Is this correct ??

2) How to change the State of GPIF by using CyU3PGpifSMSwitch() ??

                          comment : CyU3PGpifSMSwitch() is successful but state is not changed ?

3) If GPIF state change to RESET and then change to IDEAL, Is equivalent to GPIF RESET ??

My requirement is to RD/WR the register from FPGA with RESET whenever user wants.

0 Likes
1 Solution
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

Please let me know which state machine is used for your application. Is it the default slave fifo state machine? If not, then can you please share your state machine for us to check?

The state machine could switch depending on the control signals to the GPIF II interface at any point of time, so can you try using the API CyU3PGpifSMSwitch () as below:

CyU3PGpifSMSwitch (257, IDLE, 257, ALPHA_RESET, 0x100);

After this, you can drive a GPIO from the IDLE state to understand if the state machine actually switched or not. Otherwise, there are chances that the state machine might have already switched to another state when the API CyU3PGpifGetSMState () is called. Please try this and let me know the result. 

If the GPIF state is changed to RESET and IDLE, then it just switches the GPIF II state machine. The DMA buffers and endpoint memory will still have the data that was collected previously.

 

Best Regards,
Jayakrishna

View solution in original post

0 Likes
9 Replies
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

Please let me know which state machine is used for your application. Is it the default slave fifo state machine? If not, then can you please share your state machine for us to check?

The state machine could switch depending on the control signals to the GPIF II interface at any point of time, so can you try using the API CyU3PGpifSMSwitch () as below:

CyU3PGpifSMSwitch (257, IDLE, 257, ALPHA_RESET, 0x100);

After this, you can drive a GPIO from the IDLE state to understand if the state machine actually switched or not. Otherwise, there are chances that the state machine might have already switched to another state when the API CyU3PGpifGetSMState () is called. Please try this and let me know the result. 

If the GPIF state is changed to RESET and IDLE, then it just switches the GPIF II state machine. The DMA buffers and endpoint memory will still have the data that was collected previously.

 

Best Regards,
Jayakrishna
0 Likes
ankitvats846
Level 2
10 replies posted 10 sign-ins 5 questions asked
Level 2

1)  The state machine is used for your application.  #### see GPIF_state.PNG  ###

CyU3PGpifWaveData CyFxGpifWavedata[] = {
{{0x1E086001,0x000302C4,0x80000000},{0x00000000,0x00000000,0x00000000}},
{{0x4E080302,0x00000300,0x80000000},{0x1E086006,0x000302C4,0x80000000}},
{{0x1E086001,0x000302C4,0x80000000},{0x4E040704,0x20000300,0xC0100000}},
{{0x4E080302,0x00000300,0x80000000},{0x1E086001,0x000302C4,0x80000000}},
{{0x00000000,0x00000000,0x00000000},{0x00000000,0x00000000,0x00000000}},
{{0x00000000,0x00000000,0x00000000},{0x3E738705,0x00000300,0xC0100000}},
{{0x00000000,0x00000000,0x00000000},{0x5E002703,0x2003030C,0x80000000}},
{{0x00000000,0x00000000,0x00000000},{0x4E040704,0x20000300,0xC0100000}}
};

2)  I use this api  CyU3PGpifSMSwitch (257, IDLE, 257, ALPHA_RESET, 0x100) but the state always be 0 (              (RESET)  ####  see RESET_FX3_logs   ####

                                          RESET_FX3_LOGS   :::::      1) Print the current state 

                                                                                               2) print return status of CyU3PGpifSMSwitch (257, IDLE, 257, ALPHA_RESET, 0x100)      

                                                                                               3) again print the state.

My FX3 Firmware behavior    :     If State is IDEAL (1)  after power ON the board. Able to access the FPGA 

                                                                 but if the state is RESET(0) after power ON . unable to access / change the state.

In slave mode , state can be changed???

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

From the snapshot of the state machine shared, I understand that you are making use of the default slave fifo state machine. Please correct me if my understanding is wrong.

Is it possible to share the complete firmware for us to check? Have you started the state machine before performing the CyU3PGpifSMSwitch () or have you switched it before starting the state machine?

Regarding your following question:

"In slave mode , state can be changed???"

>> I understand that you want to bring the state to IDLE. As you might be knowing, for Slave FIFO interface, FX3 acts as Slave and FPGA acts as master. So, FPGA can assert the control signals properly to switch the state machine back to the IDLE state. It is not necessary to switch the state using the API from FX3 firmware. Also, changing the state from the firmware could disturb the ongoing transfers. Please let me why do you want to switch the state from the firmware. By default, at the end of each transfer from/to FPGA, the state machine should be in the IDLE state. When the state machine is in the IDLE state, you can access the FPGA registers.

Best Regards,
Jayakrishna
0 Likes
ankitvats846
Level 2
10 replies posted 10 sign-ins 5 questions asked
Level 2

Yes, default slave fifo state machine in use.

Yes, State machine is start by performing CyU3PGpifSMStart(RESET, ALPHA_RESET) before performing the CyU3PGpifSMSwitch ()  

NO , switching is done before.

Yes, FPGA  as master can RESTART  the FX3 and again enumeration is done in Host machine. So to avoid this , we came up with the solution to Only RESET GPIF Interface from FX3 

For reset Interface , two api I try   

1) CyU3PGpifDisable ( CyFalse );           // stop the rd/wr

2) CyU3PGpifSMStart(RESET, ALPHA_RESET);   // able rd/wr   if  use in sequence with 2 sec            delay

BUT RD/WR not happened most of times.

then I try to switch the State .

I share the main file  " cyfx3_Corvette.zip " Here u find .

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

Based on my understanding, you would like to restart the application without re-enumerating the device. Please correct me if my understanding is wrong. If my understanding is correct, then you can try using the following approach:

1. Send a vendor command to the FX3 device

2. Inside the vendor command, check if the flag glIsApplnActive is set or not.

3. If it is set, then call the function CyFxSlFifoApplnStop () and then CyFxSlFifoApplnStart ()

4. If it is not set, then just call the function CyFxSlFifoApplnStart ().

The implementation of same is given below:

if (glIsApplnActive)
{
CyFxSlFifoApplnStop ();
}
/* Start the Application. */
CyFxSlFifoApplnStart ();

Please try this and let me know if it is an acceptable solution or not.

Best Regards,
Jayakrishna
0 Likes
ankitvats846
Level 2
10 replies posted 10 sign-ins 5 questions asked
Level 2

Once can you explain more about  this  CyU3PGpifSMSwitch (257, IDLE, 257, ALPHA_RESET, 0x100)

Which fromState 257 pointing to and  where is the resource (0-255) to decode the state ?

what is ALPHA_RESET and why it used ?

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

fromState 257 is actually an INVALID state. If an Invalid state is used as fromState in CyU3PGpifSMSwitch (), then the state machine will immediately switch to the toState.

The state numbers of each state can be found inside the .h file generated by the GPIF II Designer if the design does not make use of mirror states. But, if the design makes use of mirror states, then please use the following thread to decode the state numbers of the mirror states:

https://community.infineon.com/t5/USB-superspeed-peripherals/Find-GPIF2-mirror-state-IDs/m-p/141430

ALPHA_RESET represents the Initial values for alpha outputs. These are loaded into the alpha registers when GPIF execution starts(first WAVEFORM_SWITCH) is set. The GPIF II designer takes care of generating this parameter so that the user can use it as such.

Best Regards,
Jayakrishna
0 Likes
ankitvats846
Level 2
10 replies posted 10 sign-ins 5 questions asked
Level 2

Hi I try this,  this  stops the ongoing transfer. Need to unplug/plug the USB cable means re-enumerating the Device.

Why CyU3PGpifSMSwitch (257, IDLE, 257, ALPHA_RESET, 0x100) not able to change the state ??

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

I was not able to understand the following statement in your previous response:

"Hi I try this,  this  stops the ongoing transfer. Need to unplug/plug the USB cable means re-enumerating the Device."

Can you please elaborate it so that I can understand it?

Also, please confirm that you are supplying interface clock to FX3 from FPGA when the API CyU3PGpifSMSwitch () is called. In addition to this, please drive a GPIO in the toState by adding an action in the state machine and then probe this GPIO to confirm if the state was actually reached or not instead of using the API CyU3PGpifGetSMState ().

Best Regards,
Jayakrishna
0 Likes