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

Fix bit timing #10

Merged
merged 1 commit into from
Oct 18, 2024
Merged

Fix bit timing #10

merged 1 commit into from
Oct 18, 2024

Conversation

jepler
Copy link
Member

@jepler jepler commented Sep 17, 2024

There were 3 cycles of always-low time missing, making the bit time closer to 1us than 1.25us.

This apparently was OK with whatever strips I tested way back, but not with the saleae ws2812b decoder.

Now, a trace generated on either rp2040 or rp2350 decodes in saleae and has the expected content.

There were 3 cycles of always-low time missing, making the bit time
closer to 1us than 1.25us.

This apparently was OK with whatever strips I tested way back, but
not with the saleae ws2812b decoder.
@jepler jepler requested a review from a team September 17, 2024 19:30
@dhalbert
Copy link
Contributor

I did a lot of testing in adafruit/circuitpython#6312, and adjusted the PIO program timing for neopixel_write. How do those timings compare with these?

@jepler
Copy link
Member Author

jepler commented Sep 24, 2024

Your final conclusion seemed to be:

The timings from this code are now:

  • zeroes: 4 cycles high + 12 cycles low, about 312ns high, 938ns low
  • ones: 9 cycles high + 7 cycles low, about 703ns high, 547ns low

Your conclusion was:

The timings have been adjusted to:
about 300 ns high, 900 ns low, for a zero
about 700 ns high, 500 ns low, for a one
These vary per implementation, based on implementation constraints.

Except for my bugs, my timings were intended to match what was in the core implementation of neopixel for rp2 family micros:

// NeoPixels are 800khz bit streams. We are choosing zeros as <312ns hi, 936 lo> and ones
// and ones as <700 ns hi, 556 ns lo>.

Your overall timing is faster than mine (833kHz vs 800kHz) overall but my "high" timings are very close to yours and I'm closer to what I thought was the received wisdom frequency of 800kHz.

@dhalbert
Copy link
Contributor

Your overall timing is faster than mine (833kHz vs 800kHz) overall but my "high" timings are very close to yours and I'm closer to what I thought was the received wisdom frequency of 800kHz.

I tested something like five varieties until they all worked. But I felt constrained by the granularity of the PIO cycles, so maybe I didn't quite reach optimum. We can leave mine alone, I guess, unless you think they could use touching up.

Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dhalbert dhalbert merged commit dd1a58a into main Oct 18, 2024
2 checks passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Nov 6, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_NeoPxl8 to 0.3.0 from 0.2.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_NeoPxl8#11 from FoamyGuy/fix_circup_instruction
  > Merge pull request adafruit/Adafruit_CircuitPython_NeoPxl8#10 from adafruit/fix-timings

Updating https://github.com/adafruit/Adafruit_CircuitPython_Pastebin to 1.0.6 from 1.0.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_Pastebin#3 from FoamyGuy/fix_circup_instruction

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_WM8960

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
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

Successfully merging this pull request may close these issues.

2 participants