USE GPIF to forwards GPIO to USB3 in both directions

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,

   

I am trying to use the CYUSB3KIT-0003 FX3 to forwards GPIO to USB3 through GPIF.

   

I created two DMA channels :

   
        
  • One from USB3 channel 1 ( INPUT 0x01) to GPIF PIB BLOCK 0 .
  •     
  • One from GPIF PIB BLOCK 4 to USB3 channel 1 (OUTPUT 0x81).
  •    
   

Next I have the configuration for my GPIF state machine where I wait for a DMA request on thread0 and write the data on the corresponding DATA_BUS (8bits). After writing I jump to another state where I compare (with the action CMP_DATA) the value of one bit on the databus that I come to write.  Indeed, I want to read back my data bus value to the USB3 channel OUTPUT only when I receive from my USB3 channel INPUT a packet with the bit 5 at 1.

   

Can I compare the value of the databus using CMP_DATA with the value databus value I come to set ?

   

I don't know if the mistake come from my state model or my DMA configuration.

   

Below how are configured my DMA channels :

   

        dmaCfg.prodSckId = CY_U3P_UIB_SOCKET_PROD_1;
        dmaCfg.consSckId = (CyU3PDmaSocketId_t)CyU3PDmaGetSckId (CY_U3P_PIB_IP_BLOCK_ID, 0);
        apiRetStatus = CyU3PDmaChannelCreate (&glChHandleUSBIn,
                                              CY_U3P_DMA_TYPE_AUTO, &dmaCfg);

   


        dmaCfg.prodSckId = (CyU3PDmaSocketId_t)CyU3PDmaGetSckId (CY_U3P_PIB_IP_BLOCK_ID, 4);
        dmaCfg.consSckId = CY_U3P_UIB_SOCKET_CONS_1;
        apiRetStatus = CyU3PDmaChannelCreate (&glChHandleUSBOut,
                                              CY_U3P_DMA_TYPE_AUTO, &dmaCfg);

   

The state machine attached.

   

 

   

I hope I was clear enough.

   

Thank you by advance.

0 Likes
2 Replies
Anonymous
Not applicable

Hi,

   

Yes, this is feasible. You can proceed with your design.

   

Regards,

   

- Madhu Sudhan

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

Thank you Madhu Sudhan for your reply.

   

Unfortunatly I didn't find a way to do it... The write works but I never receive read data...

   

I tried to test a simple loop that read/write byte by byte on the databus. But I am still stuck...

   

I made a new state machine with only 3 states : DMA_WAIT WRITE READ.

   

On the DMA_WAIT state I have a simple transition, when a DMA_RDY_TH0 occurs I jump to WRITE.

   

On WRITE I have one action (DR_DATA). Because I juste want to write on byte, I unchecked "Update new value from data source" and "Repeat actions until next transition". The unique transition is a Logic_one that goes to READ.

   

On Read I have 2 actions : IN_DATA and COMMIT because I only want to read 8bytes and send the value on the USB3 socket. I also unchecked the ''Repeat actions until next transition". I set a DMA_RDY_TH0 transition to go back to WRITE and a ! DMA_RDY_TH0 to go to DMA_WAIT.

   

The first byte is well write on the data bus, but after I have nothing more (no read and write after) .... I can't read data, or write more...

   

Could you explain where I am wrong please ?

0 Likes