cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

ZvVe_2582751
New Contributor II

Hello,

In the sample USBFS_UART01 sample, one of the automatically generated sources is:

USBUART_episr.c

I want that my callback will be called upon an interrupt.

Should I modify USBUART_episr.c ?

I also added:

USBUART_EnableSofInt (); to main.c right after:

USBUART_Start

In general, how can I connect a specified interrupt in a device to my code ?

Thank you,

Zvika

0 Likes
1 Solution
AnkitaS_51
Employee

Hi,

Even when there is no active data transmission, the host uses Start of Frame (SOF) tokens to keep devices out of a suspend state.

In the ISR of particular EP you can use API "USBFS_GetEPCount()" which returns the current byte count from the specified USBFS endpoint.

It is dependent on your firmware that you write in callback.

View solution in original post

0 Likes
5 Replies
ZvVe_2582751
New Contributor II

Hello,

Following is a fragment of the generated source.

Should I call my code (e.g giving a semaphore)  between the bold lines ?

Thank you,

Zvika

.....

#if (USBUART_SOF_ISR_ACTIVE)

    /*******************************************************************************

    * Function Name: USBUART_SOF_ISR

    ****************************************************************************//**

    *

    *  Start of Frame Interrupt Service Routine.

    *

    *

    *******************************************************************************/

    CY_ISR(USBUART_SOF_ISR)

    {

    #ifdef USBUART_SOF_ISR_ENTRY_CALLBACK

        USBUART_SOF_ISR_EntryCallback();

    #endif /* (USBUART_SOF_ISR_ENTRY_CALLBACK) */

       /* `#START SOF_USER_CODE` Place your code here */

        /* `#END` */

        USBUART_ClearSieInterruptSource(USBUART_INTR_SIE_SOF_INTR);

    #ifdef USBUART_SOF_ISR_EXIT_CALLBACK

        USBUART_SOF_ISR_ExitCallback();

    #endif /* (USBUART_SOF_ISR_EXIT_CALLBACK) */

    }

#endif /* (USBUART_SOF_ISR_ACTIVE) */

0 Likes
HeLi_263931
Honored Contributor II

You can do that, but then your changes are lost on a clean build.

Better is to use

USBUART_StartEx(&YourISR);

in your main function (with your ISR routine defined with CY_ISR).

0 Likes
ZvVe_2582751
New Contributor II

Hello,

Thank you for your reply.

In USBUART.h there is no declaration for USBUART_StartEx (...)

I tried to call this routine but got a link error.

I'm using Creator 4.0

Best regards,

Zvika

0 Likes
ZvVe_2582751
New Contributor II

Hello,

Thank yo very much for your reply !

I'v noticed that the SOF ISR is called a lot (>1000) even if not a single character is sent from PC to the PSOC.

Can you tell why ?

I want to trigger a task (e.g with Semaphore) upon one or more characters sent to PSOC.

Thank you,

Zvika

0 Likes
AnkitaS_51
Employee

Hi,

Even when there is no active data transmission, the host uses Start of Frame (SOF) tokens to keep devices out of a suspend state.

In the ISR of particular EP you can use API "USBFS_GetEPCount()" which returns the current byte count from the specified USBFS endpoint.

It is dependent on your firmware that you write in callback.

View solution in original post

0 Likes