USB interrupts

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

cross mob
ClWa_4687991
Level 1
Level 1
First like received Welcome!

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 Solution

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.

pastedImage_10.png

You can add your code in this part of file.

Thanks,

Aashita

View solution in original post

3 Replies
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

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

0 Likes

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

0 Likes

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.

pastedImage_10.png

You can add your code in this part of file.

Thanks,

Aashita