PSOC4 BLE PWM on non routeble pin

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.
EsFr_4600111
Level 3
Level 3
25 sign-ins 10 replies posted 10 questions asked

Hello 

I have a hw design where i use a CYBLE-222014 and some  PWM controlled LED's.

My problem is that one of my LEDS is hw wired to pin 4.0, which is not routeble from PsoC Creater.

How can i from code make it posible to adjust PWM on PIN  4.0 ? 

 

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

please refer to the attached project about how to change the compare value. From your issue description, you only want to  fade the brightnessss of the LED, it means that you want to led on in less time in a duty cycle. I attached a project to change the compare value. 

It is suggested that you change your design to let the LED in the port0-port3 pin.

View solution in original post

0 Likes
10 Replies
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

Sorry, it is impossible to adjust the pin to PWM line or line_n, because the digital signal connect has two ways, one is dedicated pin, the other is through the DSI, the Port4 can't have the ability.

0 Likes

Hi

Isn't it possible to make a interrupt for each compare and then in this intterupt routine control the led. 

I have tried my self but the interrupt triggers not on compare  

0 Likes
lock attach
Attachments are accessible only for community members.
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

Please refer to the attached project to generate the cc interrupt.

0 Likes
EsFr_4600111
Level 3
Level 3
25 sign-ins 10 replies posted 10 questions asked

0 Likes
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

What do you want to develop? Does the issue have no related to PWM and the dedicated pin?

Or you can detail your questions, maybe we can give you a similar code example. How do you want to adjust the duty cycle of your LED?

If you want to change the compare value and period value, you only need to call the API in the cc interrupt handler just like below codes:

PWM_WriteCompare(PWM_ReadCompare() + BRIGHTNESS_CHANGE);
PWM_WritePeriod(PWM_ReadPeriod() + BRIGHTNESS_CHANGE);

 

 

0 Likes

I will just want to fade the brightnessss of the LED, which is placed on a none routble pin.  On a CYBLE-222014.

I will try to adjust the period as well later. 

But if I only change the compare value, it does not have any inpact on the dutycycle.

  

 

0 Likes

Im not able to got this solution to work.  Which target have you tried this code with. ?

Im using af cyble-222014 

 

0 Likes
lock attach
Attachments are accessible only for community members.
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

please refer to the attached project about how to change the compare value. From your issue description, you only want to  fade the brightnessss of the LED, it means that you want to led on in less time in a duty cycle. I attached a project to change the compare value. 

It is suggested that you change your design to let the LED in the port0-port3 pin.

0 Likes
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

Use the CC interrupt  handler to change the LED status to solve the un-dedicated issue.

0 Likes

Not it actually do some fading, but very very random up Down and off. I need to put a value from 0-255 to control the led itensity. How Can i do that?

0 Likes