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

PSoC™ 5, 3 & 1 Forum Discussions

AnSa_1225656
Level 4
50 replies posted 25 replies posted 10 replies posted
Level 4

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
250 sign-ins 5 comments on KBA First comment on KBA
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 250 solutions authored 100 likes received 250 sign-ins
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
Level 4
50 replies posted 25 replies posted 10 replies posted
Level 4

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
250 sign-ins 5 comments on KBA First comment on KBA
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. 

AnSa_1225656
Level 4
50 replies posted 25 replies posted 10 replies posted
Level 4

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

0 Likes