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

neopixel/ws2812 timings #161

Closed
microbit-carlos opened this issue Oct 30, 2023 · 3 comments
Closed

neopixel/ws2812 timings #161

microbit-carlos opened this issue Oct 30, 2023 · 3 comments

Comments

@microbit-carlos
Copy link
Contributor

microbit-carlos commented Oct 30, 2023

There is a wide range of ws2812 LEDs with slightly different timings and the CODAL version in the MicroPython v.2.1.1 release doesn't work with all of them:

This has been fixed in CODAL's PR lancaster-university/codal-nrf52#47, but to do a low-risk v2.1.2 release we can apply the patch directly to v2.1.1 as done in: v2.1.1...0697c6d

@microbit-carlos
Copy link
Contributor Author

microbit-carlos commented Oct 30, 2023

Okay, so I could not successfully trigger a new docker build of the MicroPython builds we have in https://github.com/microbit-foundation/micropython-build-env, because some pinned dependencies don't seem to be available in the ubuntu package repositories.
I'll need to look into that issue and fix it in a future date, but in the meantime I've created a v2.1.2 build by using the docker image created as part of the v2.1.1 build.

I was hoping to be able to checkout the v2.1.x-branch, and re-build with only those changes, but for some reason that didn't triggering re-compilation for the codal-nrf52 files and ended up with a build with the only change being the version string.

Nevertheless, doing a clean build worked correctly, and there wasn't significant changes in the build output (sometimes, even with small changes, the compiler applies optimisation levels differently and/or moves things around, when so a binary/hex comparison is not easy).

The final hex output only contains 4 changes, so that made it really easy to verify everything else should be exactly the same. Which is important as I was hoping to be able to avoid having to run a lot of manual tests.

The v2.1.2 hex file can be downloaded from the GitHub release https://github.com/microbit-foundation/micropython-microbit-v2/releases/tag/v2.1.2 and will be added to the Python Editor soon.

The changes in the hex file are:

  • A change at address 0x29900:
    image
    • From the map file, is for the neopixel_send_buffer function, makes sense ✅.
      .text._Z20neopixel_send_bufferRN5codal3PinEPKhi
                      0x0000000000029880       0x84 /home/micropython-microbit-v2/lib/codal/build/libcodal-nrf52.a(neopixel.cpp.o)
                      0x0000000000029880                neopixel_send_buffer(codal::Pin&, unsigned char const*, int)
      .text._ZN5codal19allocate_peripheralEPv
                      0x0000000000029904       0x3c /home/micropython-microbit-v2/lib/codal/build/libcodal-nrf52.a(peripheral_alloc.cpp.o)
                      0x0000000000029904                codal::allocate_peripheral(void*)
      
  • Another change at address 0x53A50, where we can clearly see the change from WS2812B_LOW and WS2812B_HIGH (neopixel_ws2812b_timing.patch):
    image
    • This is the codal::WS2812B::pull() method, also expected ✅.
      .text._ZN5codal7WS2812B4pullEv
                      0x0000000000053a24       0x9c /home/micropython-microbit-v2/lib/codal/build/libcodal-nrf52.a(WS2812B.cpp.o)
                      0x0000000000053a24                codal::WS2812B::pull()
      .text._ZN5codal7WS2812B5_playEPKvib
                      0x0000000000053ac0       0x30 /home/micropython-microbit-v2/lib/codal/build/libcodal-nrf52.a(WS2812B.cpp.o)
                      0x0000000000053ac0                codal::WS2812B::_play(void const*, int, bool)
      
  • The other two changes are strings changed as a result of updating the version number (0697c6d) ✅:
    • A change in the string micro:bit v2.1.2+0697c6d on 2023-10-30; MicroPython v1.18 on 2023-10-30:
      image
    • And a change in the string MicroPython v1.18 on 2023-10-30; micro:bit v2.1.2 with nRF52833:
      image

@microbit-carlos
Copy link
Contributor Author

@dpgeorge @jimmo v2.1.2 of MicroPython for micro:bit V2 has been deployed to https://python.microbit.org

@jimmo
Copy link

jimmo commented Nov 3, 2023

Thanks @microbit-carlos!! :)

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