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

[HUB75]Leds do not light up as expected #691

Open
ehime-iyokan opened this issue Jul 2, 2024 · 5 comments
Open

[HUB75]Leds do not light up as expected #691

ehime-iyokan opened this issue Jul 2, 2024 · 5 comments

Comments

@ehime-iyokan
Copy link

ehime-iyokan commented Jul 2, 2024

I wrote program using hub75 package and raspberry pi pico. but, it didn't light up. So I have tried to fix hub75.
As a result. It light up as expected. And Environmental information is here. -> https://github.com/ehime-iyokan/tinygo_hub75_sample

picture1

First, I added a time.sleep(1 * time.Microsecond) after latch-High.
By doing so, the light came on. However, I don't know why, so if you know, please let me know.
Moreover, the red lights are on in different places.

picture2

Second, I fixed buffering of red data.
I guess it has to do left-shift first.
d.buffer[c][offsetR] = d.buffer[c][offsetR] &^ 1 << bitSelect
-> d.buffer[c][offsetR] &^= 1 << bitSelect

picture3

@ehime-iyokan
Copy link
Author

I added a time.sleep(1 * time.Microsecond) after latch-High. By doing so, the light came on. However, I don't know why
If I figured out why it worked correctly, I'll create a pull request.

@sago35
Copy link
Member

sago35 commented Jul 13, 2024

@ehime-iyokan
The GPIO of the RP2040 might be too fast. Without adding time.Sleep(), the pulse width is 110ns, which might be too short. With time.Sleep(), it is around 5us.

I think the fix you are considering is necessary.

with time.Sleep(1 * time.Microsecond) : 5.046us

image

without time.Sleep(1 * time.Microsecond) : 110ns

image

@sago35
Copy link
Member

sago35 commented Jul 13, 2024

Including other parts as well, it is better to use delay.Sleep() for microsecond sleeps. I think it would be good if you could create a Pull Request with that change.

https://github.com/tinygo-org/drivers/blob/v0.28.0/delay/sleep.go

with delay.Sleep(1 * time.Microsecond) : 1.16us

image

@ehime-iyokan
Copy link
Author

I created pullrequest. => (#722)

Second, I fixed buffering of red data.
I guess it has to do left-shift first.
d.buffer[c][offsetR] = d.buffer[c][offsetR] &^ 1 << bitSelect
-> d.buffer[c][offsetR] &^= 1 << bitSelect

(#691 (comment))

@ehime-iyokan
Copy link
Author

Thank you for providing the information. @sago35
For now, I've decided to use a microcontroller board other than the RP2040. Next time I use the RP2040, I’ll consider creating a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants