PSoC 6 PWM+IRQ not working

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.
Anonymous
Not applicable

I have a project where I am trying to use an interrupt-triggered PWM which controls the configuration of the onboard LED and output the results. I have attached my project as a .zip and was hoping for some advice as to what I am doing incorrectly? The main files to look at here are main_cm0p.c and LightControl.c (I don't suspect that the header files are the source of my issues)

I have consulted others with some PSoC 6 experience, and the feedback I received was that this code should work fine. My issue is that after running the code, the LED does not even flash at all.


Am I missing something here? Any and all advice would be greatly appreciated!

1 Solution
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

I have debugged this project, and found below issue:

--'Interrupt Source' in LightTimer is not selected, this causes LightTimerHandler never triggered.

--line#178(LightControl.c): if(cycles == 0 && new_cycles > 0) never reached, this cause PWM A/B/C never started.

--comment lines :LightOutputA_SetCompare0(0) & LightOutputB_SetCompare0(0) & LightOutputC_SetCompare0(0)

in LightControl_Init(), and then RGB LED is lighted.

Please check your code logic and make proper modifying accordingly.

View solution in original post

0 Likes
6 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The interrupt source of the LightTimer component is not configured for Overflow/Underflow.

Bob

0 Likes
Anonymous
Not applicable

I configured the interrupt source for Overflow/Underflow, nothing changed.

0 Likes

You disable the lighttimer and I cannot find a place where you enable it again.

Bob

0 Likes
Anonymous
Not applicable

My apologies, there should be a line of code underneath line 190 in LightControl.c:

LightTimer_Start();

However, adding that still does not solve the issue

0 Likes

Are you sure that line 190 will ever be reached???

Bob

0 Likes
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

I have debugged this project, and found below issue:

--'Interrupt Source' in LightTimer is not selected, this causes LightTimerHandler never triggered.

--line#178(LightControl.c): if(cycles == 0 && new_cycles > 0) never reached, this cause PWM A/B/C never started.

--comment lines :LightOutputA_SetCompare0(0) & LightOutputB_SetCompare0(0) & LightOutputC_SetCompare0(0)

in LightControl_Init(), and then RGB LED is lighted.

Please check your code logic and make proper modifying accordingly.

0 Likes