3 Replies Latest reply on May 16, 2020 11:29 AM by AashitaR_11

    USB interrupts

    ClWa_4687991

      The USB will be configured for serial port emulation.  Instead of polling for data available, I'd like to get an interrupt (or callback).  Is there a way to do this and what are the functions?

       

      Thanks

        • 1. Re: USB interrupts
          AashitaR_11

          Hi,

           

          USBFS component has a USBFS_episr.c file generated after you build your project. This file contains ISR pertaining to each end point. Each ISR can be modified with custom code to perform any task. You can find the c file by following the below steps -

           

          1. Build the project.

          2. Go to the USBFS folder of Generated Source.

          3. Click on the USBFS_episr.c file.

           

          Also, Can you please share your project or explain what exactly does your project do? It will help us to understand the issue properly.

           

          Best Regards,

          Aashita

          • 2. Re: USB interrupts
            ClWa_4687991

            I can edit the USB_ebisr.c file. However;  whenever a Clean and Build Project is done, my changes are lost when the file is regenerated.  How does one preserve edits?

             

            The project entails real-time operation that includes non-USB functions and runs with FreeRtos.  Polling drains resources. It is preferable to have interrupts trigger on USB events.

             

            Thanks

            • 3. Re: USB interrupts
              AashitaR_11

              Hi,

               

              You can skip the code generation in the build settings by following this path - Project-> Build settings -> Skip Code Generation -> True. This will help you retain the changes whenever build project is done.

               

              Also, for each endpoint in the USB_episr.c file there is a section where the user can put his custom code. The code in this section is not erased on clean and build. I have attached the image below for your reference.

              You can add your code in this part of file.

               

              Thanks,

              Aashita

              1 of 1 people found this helpful