Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider adding SB_RGBA_DRV PWM verilog examples #525

Open
proppy opened this issue Aug 3, 2021 · 4 comments
Open

consider adding SB_RGBA_DRV PWM verilog examples #525

proppy opened this issue Aug 3, 2021 · 4 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@proppy
Copy link
Collaborator

proppy commented Aug 3, 2021

It would be nice to show how to drive RGB0PWM RGB1PWM RGB2PWM using a clock divider, so achieve the same color cycling effect as the risc-v sample.

@umarcor
Copy link
Collaborator

umarcor commented Aug 3, 2021

That is actually the example design in hdl/verilog/blink, hdl/vhdl/blink and hdl/mixed/blink.

Mixed examples are a combination of those: having the counter in one language and the instantiation of the SB_RGBA_DRV in the other.

The resulting color cycles are not exactly the same, though, because we did not necessarily care about using exactly the same counter size/period.

@proppy
Copy link
Collaborator Author

proppy commented Aug 3, 2021

Sorry for the lack of precision I was referring to driving the PWM in a pattern similar to https://github.com/im-tomu/fomu-workshop/blob/master/riscv-blink/src/main.c#L9 rather than blinking full blue, full red, full green at clock >> 25, clock >> 24 and clock >> 23 intervals like in https://github.com/im-tomu/fomu-workshop/blob/master/hdl/verilog/blink/blink.v#L51-L81

See below:
rainbow

@umarcor
Copy link
Collaborator

umarcor commented Aug 3, 2021

Note that bits 25, 24 and 23 compose a 3 bit word with 2**3=8 different values. Therefore, the current HDL examples do not blink full blue, full red and full green. Instead, they cycle through the 7 colors (the last one is "black").

I just run the hdl/vhdl/blink example on my Fomu and the sequence is: off (black), blue, red, magenta, green, cyan, yellow, all (white).

Given said that, I think it would be interesting to have this better explained in the docs for the less experienced HDL users. It would also be nice to have some more creative examples that show how to get other colour effects.

@umarcor umarcor added documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Aug 3, 2021
@proppy
Copy link
Collaborator Author

proppy commented Aug 3, 2021

Oh yes, sorry for the miss-understanding, what I meant was that it blinks red, blue and green with between 100% duty cycle and 0% duty cycle at consecutive 2^ interval (causing the 3 components to get mixed as you described), I'd be interesting to provide examples that modulate the PWM duty cycle to get access to more colors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants