3 Replies Latest reply on Mar 2, 2015 11:35 AM by userc_41571

    Interrupt IN Endpoint Configuration

       Hi all,


      I'm trying to setup an interrupt in endpoint on the FX3 and can't find any examples.  The senario is there are multiple threads running on the cpu, one of them will occasionaly need to post "data avialble" alerts to the host over the interrupt pipe.  Only the CPU and the host are involved in the process (i.e. the other serial ports are not involved).   I've tried to do my homework before posting such a broad question.  I need a few specific questions answered:

      1. What type of socket do you use for an interrupt in endpoint?
        I assume you use a consumer.
      3. How do you configure the dma channel (specifics below)?     
        1. How do you configure the producer/consumer sockets?
            I assume you set the producer to the cpu socket and the consumer to the interrupt if my first assumption is true.
        3. Notification?
          I assume CY_U3P_DMA_CB_PROD_EVENT
        5. DMA Type?
          I assume CY_U3P_DMA_TYPE_MANUAL_OUT, but maybe CY_U3P_DMA_TYPE_AUTO will work since I'm not doing any work in the callback (see question 3).
      5. How and where do you access the dma data buffer?
           I think you use the CyU3PDmaChannelCommitBuffer() command.
           I suppose with the notification set as CY_U3P_DMA_CB_PROD_EVENT the callback will be triggered whenever I call CyU3PDmaChannelCommitBuffer() from wihtin the CPU thread.  
        Or if set the DMA type to 
        CY_U3P_DMA_TYPE_AUTO, does that mean my alert will be sent everytime I call CyU3PDmaChannelCommitBuffer()?

      I haven't finished this setup yet, so please let me know if I'm headed in the correct direction.  If there's anything I can do to clarify please let me know. That includes adjusting the formatting above.  Thanks.

        • 1. Re: Interrupt IN Endpoint Configuration



          Here you are going to send the data from CPU to USB socket (endpoint). So the prod socket must be CPU and cons socket must be a UIB_CONS_SOCKET. When CPU is producer, the channel type must always be MANUL_OUT.


          The notification is optional. There is no need to set the notification to PROD_EVENT. This is because, it is you (CPU) who are filling the buffer in case of MANUAL_OUT channel. So you do not have to get a notification after you fill the buffer.


          You have to use the CyU3PDmaChannelGetBuffer for getting the pointer to a buffer, fill it and use CyU3PDmaChannelCommitBuffer API to send the buffer to PC.


          I have attached a project in which uses interrupt endpoint. This firmware enumertaes FX3 into a HID Mouse device. As soon as you load the firmware into FX3, FX3 becomes a mouse and it continuously sends character "a" to the PC.




          - Madhu Sudhan

          • 2. Re: Interrupt IN Endpoint Configuration

             Hey Madhu that helps a lot.  I'll post again when it is all working.

            • 3. Re: Interrupt IN Endpoint Configuration

               It's all working now thanks!