Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

AnSa_1225656
Contributor

I am using interrupts in FreeRTOS to read data from USB and pass to UART (Using as software USB/UART bridge in one configuration).  I need to be able to control a DTR pin based on USB_GetLineControl(), but I am not sure how to detect a change in its status via an interrupt.  What interrupt will fire when this status changes?

0 Likes
1 Solution
RodolfoGL
Employee

This request goes through EP0, so yes, you could use the EP_0_ISR_ExitCallback(). But this function executes on any EP0 interrupt.

There is a more specific function that is executed when there is a class request (your case). Refer to the function USB_DispatchClassRqst in USB_cls.c.

In the end of the function, you can write code between this lines:

/* `#START USER_DEFINED_CLASS_CODE` Place your Class request here */

/* `#END` */

Or you can implement the USB_DispatchClassRqst_Callback() function and define the USBUART_DISPATCH_CLASS_RQST_CALLBACK. 

View solution in original post

4 Replies
Ekta
Moderator
Moderator

Hello @AnSa_1225656 ,

Could you please confirm if you are asking where can the USB_GetLineControl() function be called to know if there is a change in status?
According to my understanding  you want to detect if a DTR signal is present using the function USB_GetLineControl() and based on the status control a DTR pin.

You can try calling this USB_GetLineControl() function in the USBUART_EP_0_ISR_ExitCallback() ISR.

You can refer to the Macro Callback section of the USBFS datasheet to find more details regarding how to use this ExitCallback function.

Kindly let me know if this is what you were looking for.

Thanks 
Ekta

0 Likes
AnSa_1225656
Contributor

Specifically, I want to know which interrupt(s) will fire when there is a change in DTR status.  Are you saying that the EP_0_ISR_ExitCallback() will fire whenever the line control register is changed?  If so, then I think you have answered my question.

-Andy

0 Likes
RodolfoGL
Employee

This request goes through EP0, so yes, you could use the EP_0_ISR_ExitCallback(). But this function executes on any EP0 interrupt.

There is a more specific function that is executed when there is a class request (your case). Refer to the function USB_DispatchClassRqst in USB_cls.c.

In the end of the function, you can write code between this lines:

/* `#START USER_DEFINED_CLASS_CODE` Place your Class request here */

/* `#END` */

Or you can implement the USB_DispatchClassRqst_Callback() function and define the USBUART_DISPATCH_CLASS_RQST_CALLBACK. 

View solution in original post

AnSa_1225656
Contributor

OK, thank you both Ekta and RodolfoGL for your answers.  SOunds like I wnat the more specific USB_DispatchClassRqst  for my  purposes.

0 Likes