PSoC6 interrupt configuration on PSoC Creator

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

cross mob
lock attach
Attachments are accessible only for community members.
HIEN
Employee
Employee
25 sign-ins First solution authored 100 replies posted

I have tried to implement the interrupt on PSoC6 BLE pioneer kit, but the interrupt of PWM is not occurred. I confirmed GPIO interrupt occurred.

I attach my sample project as a reference.

My questions are:

a) What is needed to occur the interrupt?

    a-1) Is the configuration of PWM correct?

b) What is the API to clear the interrupt flag? I can't find it.

Please let me know.

1 Solution
ArvindK_86
Employee
Employee
10 sign-ins 5 sign-ins 10 solutions authored

Hi,

Couple of things to consider:

1. The interrupt wasn't triggering as it wasn't enabled properly. Please replace the NVIC_EnableIRQ() code with the following:

//NVIC_EnableIRQ(PWM_INT_INTR_CORTEXM0P_SRC); // < Incorrect

NVIC_EnableIRQ(PWM_INT_cfg.intrSrc); // < Recommended way to use

//NVIC_EnableIRQ(PWM_INT__INTC_CORTEXM0P_MUX); // < Also works

It's better to use the Creator generated structure element .intrSrc so that it automatically reflects the interrupt assignment changes you might do using the Interrupts DWR configuration GUI window. This is defined in the auto-generated file 'cyfitter_sysint_cfg.c' (you need not modify any of this code):

/* File Name: cyfitter_sysint_cfg.c */

/* PWM_INT */

    const cy_stc_sysint_t PWM_INT_cfg = {

        .intrSrc = (IRQn_Type)PWM_INT__INTC_CORTEXM0P_MUX,

        .cm0pSrc = (cy_en_intr_t)PWM_INT__INTC_NUMBER,

        .intrPriority = PWM_INT__INTC_CORTEXM0P_PRIORITY

    };

2. The configuration is PWM is fine. The ISR just needed a statement to clear the PWM's interrupt state. This is done by adding this line (somewhere early) inside the ISR function:

PWM_ClearInterrupt(CY_TCPWM_INT_ON_CC_OR_TC); /**< Clear Interrupt on TC or CC */

I'm sorry that I couldn't attach the complete project as I don't currently have the same version as yours

Please do give these changes a try and let me know if you still have issues.

Cheers,

Arvind

View solution in original post

0 Likes
7 Replies
ArvindK_86
Employee
Employee
10 sign-ins 5 sign-ins 10 solutions authored

Hi,

Couple of things to consider:

1. The interrupt wasn't triggering as it wasn't enabled properly. Please replace the NVIC_EnableIRQ() code with the following:

//NVIC_EnableIRQ(PWM_INT_INTR_CORTEXM0P_SRC); // < Incorrect

NVIC_EnableIRQ(PWM_INT_cfg.intrSrc); // < Recommended way to use

//NVIC_EnableIRQ(PWM_INT__INTC_CORTEXM0P_MUX); // < Also works

It's better to use the Creator generated structure element .intrSrc so that it automatically reflects the interrupt assignment changes you might do using the Interrupts DWR configuration GUI window. This is defined in the auto-generated file 'cyfitter_sysint_cfg.c' (you need not modify any of this code):

/* File Name: cyfitter_sysint_cfg.c */

/* PWM_INT */

    const cy_stc_sysint_t PWM_INT_cfg = {

        .intrSrc = (IRQn_Type)PWM_INT__INTC_CORTEXM0P_MUX,

        .cm0pSrc = (cy_en_intr_t)PWM_INT__INTC_NUMBER,

        .intrPriority = PWM_INT__INTC_CORTEXM0P_PRIORITY

    };

2. The configuration is PWM is fine. The ISR just needed a statement to clear the PWM's interrupt state. This is done by adding this line (somewhere early) inside the ISR function:

PWM_ClearInterrupt(CY_TCPWM_INT_ON_CC_OR_TC); /**< Clear Interrupt on TC or CC */

I'm sorry that I couldn't attach the complete project as I don't currently have the same version as yours

Please do give these changes a try and let me know if you still have issues.

Cheers,

Arvind

0 Likes
HIEN
Employee
Employee
25 sign-ins First solution authored 100 replies posted

Hi Arvind-san,

I confirmed the interrupt operation with adding the following codes:

-  NVIC_EnableIRQ(PWM_INT_INTR_CORTEXM0P_MUX);

- PWM_ClearInterrupt(CY_TCPWM_INT_ON_CC_OR_TC);

(I can't use the recommended code of NVIC enable)

I have been using PSoC Creator 4.1.0.2015 that is provided on this community because this is an environment that the customer can use it currently.

The package is "PSoC 6 complete documentsand tools Rev 1.1 April 6th 2017.zip".

The environment is not same, so the auto-generated contents are also different.

Thanks and best regards,

hien

0 Likes
ArvindK_86
Employee
Employee
10 sign-ins 5 sign-ins 10 solutions authored

I confirmed the interrupt operation with adding the following codes:

-  NVIC_EnableIRQ(PWM_INT_INTR_CORTEXM0P_MUX);

- PWM_ClearInterrupt(CY_TCPWM_INT_ON_CC_OR_TC);

That's good.

(I can't use the recommended code of NVIC enable)

Yes, my bad.. In my version the name of the structure is called PWM_INT_cfg, in yours I think it should be PWM_INT_cfg_cm0p. You can check the cyfitter_sysint_cfg.c for the correct one. Please don't worry too much about the change in names, once the latest version of Creator 4.1 is out, members on the forum should be able to help make any necessary changes.

0 Likes

Hi,

Is PSoC Creator for PSoC6 available to download? Could you tell me where?

Stanislav

0 Likes
Anonymous
Not applicable

Stanislav,

The latest PSoC Creator 4.1 is not yet available for download. We plan to release on our web, cypress.com in the next couple of weeks and also a tool that will reveal PSoC 6 parts to this community in the same time frame. Apologies for the delay and thanks for your patience!

0 Likes

Well....from what was told here, I feel like a few users already have the new PSoC Creator. Did I misunderstand something?

Also, you're not saying "a couple of weeks" for the first time. Do I misunderstand what is a couple? Or do you have some problems which cause the delay?

Stanislav

0 Likes

I guess only special users got "beta" releases of the new versions of Creator for testing and maybe bug hunting, so when Creator is ready it is released for all.

Do not despair , we all are waiting for the release of Creator and PSoC6 documentation.