⭐️ Beta Firmware Update: NodeJS v16.19, OpenWRT 22.03.3, PWM, and more! ⭐️


  • administrators

    What's new in the latest beta firmware?

    The latest 22.03.3 20230628 20230526 beta firmware is packed full of goodies:

    • Updated to the 22.03.3 OpenWRT release
    • Support for NodeJS v16.19 - more info here
    • omega2-ctrl, the GPIO muxing utility is now available - more info here
    • Added a small gpio-lookup utility for easier GPIO usage - more info here
    • Support for hardware PWM - more info here
      • A script for easy command line control of the PWM channels is available as an installable package - see details here
    • The beta firmware is now built using Onion customized versions of the OpenWRT SDK and Image Builder

    Why is this a big deal?

    One of the requests we get most frequently is for support for newer versions of NodeJS. So that one is self-explanatory 🙂

    The Big Deal here is that we are now using an SDK and Image Builder that we've customized to build the beta firmware.

    We previously used the SDK & Image Builder provided by OpenWRT. This only gave us control of the general configuration and what packages to include in the firmware, but we couldn't readily make any deeper changes.

    Now that we have the ability to change and customize the SDK and Image Builder, we have much more flexibility to change the kernel and system configuration. This includes making the changes required to:

    1. Support building and using NodeJS (modern versions are not supported on any other MIPS platform)
    2. Enable the /dev/mem device used by omega2-ctrl

    This change took quite a bit of work but was a necessary step since it sets the stage for many future improvements in our Omega2 Firmware Improvement Initiative.

    All of the customizations to the build system we use to compile our SDK and image builder are public and available on GitHub: https://github.com/OnionIoT/OpenWRT-buildsystem-wrapper
    The customizations are based on patches to the build system (instead of having our own fork) so they will be relatively easy to port to new releases of OpenWRT.
    This customized OpenWRT build system is compiled by our CI system and the output is placed here: http://downloads.onioniot.com/
    The compiled SDK and Image Builder can be found here: http://downloads.onioniot.com/releases/22.03.3/targets/ramips/mt76x8/
    This directory also has firmware images, you can safely ignore them since they are vanilla OpenWRT. The beta firmware is still stored here: http://repo.onioniot.com/omega2/images/openwrt-22.03/
    Building the beta firmware is a two-step process: 1) we use the OnionIoT/openwrt-sdk-wrapper to build the packages from the openwrt-22.03 branch of OnionIoT/openwrt-packages (and host them at http://repo.onioniot.com/omega2/packages/openwrt-22.03.3/), then 2) we use the OnionIoT/openwrt-imagebuilder-wrapper to build firmware images that include the packages from step 1.

    What's Next?

    Given our new ability to make deeper changes to the firmware, here are a few of the items that we're currently looking into:

    • ✅ Hardware PWM (added in firmware 22.03.3 20230628)
    • p44-ledchain to control WS281x LEDs (Neopixels)
    • one wire support
    • Better SPI support

    A little down the road we'll look at upgrading the firmware to be based on OpenWRT release 22.03.5 or perhaps 23.05.0 depending on when it becomes available and stable.

    How can I get involved?

    The easiest way: try out the latest beta firmware and let us know what you think + how it can be improved!

    Check out the technical doc on GitHub for instructions on how to install the latest beta firmware and then afterwards for info on how to use the firmware: https://github.com/OnionIoT/OpenWRT-Packages/blob/openwrt-22.03/technical-doc.md

    And then beyond that, let us know your experience here on the forum.

    If you have a specific improvement suggestion, please create an Issue in the OnionIoT/OpenWRT-Packages GitHub Repo.

    You can also follow along with our development on the Omega2 firmware improvements Project Board on GitHub.

    Excited to hear what you think!


    EDIT June 28, 2023: updated post to reflect addition of hardware PWM support in beta firmware 22.03.3 20230628
    EDIT Aug 10, 2023: updated post to mention package that includes script for easy PWM channel control from command line



  • @Lazar-Demin Hi Lazar, I'm exited to see OpenWrt-buildsystem-wrapper essentially replicating p44build - available for years on github and mentioned several times online and offline, when discussing openwrt level patches, e.g here!

    I guess the need for this approach was more urgent for me, having not one, but several different targets on top of openwrt, where maintaining a fork for each of them was simply a nightmare 😉

    So I'm very happy to see OnionOS is becoming a set of patches, config and custom packages on top of the original OpenWrt tree, too!

    It seems to me from the first quick look, that while the workflows your build.sh and my p44b support are a bit different, the assets (patches, configs) they work with are probably 100% compatible, so using the Onion patchset under p44b and my patches under build.sh should work 🙂

    So, to contribute more than words, I just created a new p44b-onion "umbrella" package in the plan44 feed aimed at becoming a way to build the Onion Firmware with p44b. It does not work for that, yet, but it contains hopefully useful patches which I created over the years for my Omega2 + OpenWrt projects and should be easily portable/usable in OpenWrt-buildsystem-wrapper:

    • hardware PWM (204)
    • I2S sound (210)
    • runtime loadable device tree overlays (251..253)
    • Modern GPIO via cdev support (252)
    • re-introducing mt7621 GPIO "base" of-property to keep SoC pin based GPIO numbering (257, 281)

    I am really excited about this, because I see great potential for the Onion community to share openwrt level work more easily than in the past, where the hurdle of diverging trees made it hard to "just try" the latest changes of someone else.


  • administrators

    @luz Glad to hear you're excited!
    Yeah, using patches, configs, and custom packages is definitely the way to go. One of our many learnings from using a forked openwrt for the stable v0.3.3 firmware for years 🙂

    Thanks for the contribution, we'll be look at your patches to see how they line up with what we've currently got in our backlog and taking notes for future development.

    @luz said:

    I am really excited about this, because I see great potential for the Onion community to share openwrt level work more easily than in the past, where the hurdle of diverging trees made it hard to "just try" the latest changes of someone else.

    We're really excited too! Not only is it easier to share work on openwrt, it's now also much easier and quicker to build customized firmware and packages.
    We think these two things in tandem will really allow our community to make the most use out of the Omega2 and OpenWRT.

    PS We'll also be putting out some documentation on how our buildsystem, sdk, and imagebuilder wrappers are being used to build the packages and firmware - to make this process available to everyone.



  • @Lazar-Demin said in ⭐️ Beta Firmware Update: NodeJS v16.19, OpenWRT 22.03.3, and more! ⭐:

    [...] we'll be look at your patches to see how they line up with what we've currently got in our backlog [...]

    The "Possibility of using One Wire again" item in the backlog hints to a general problem. Not only w1-gpio-custom was removed, but all other of those *-gpio-custom drivers (spi, i2c and maybe others).

    It does not seem re-establishing (and later maintaining) those would be a simple task.

    That's why I took the route towards runtime loadable device tree overlays (patches 251..253). While these are not mainline linux, these patches are in use in RaspberryPi for a long time, offering the same as, and much more than, the *-gpio-custom drivers did: configuring standard hardware drivers at runtime, in general.

    The overlay directory in the RaspberryPi kernel tree on github gives a lot of examples - there's also one for the w1-gpio driver we could glean from 😉

    I did not try W1 yet, but I did try software SPI. This works on device running a build with patches 251..253 and dtc installed (the latter is a menuconfig option):

    # create overlay definition
    cd /tmp
    cat >sw-spi.dts <<ENDOVERLAY
    /dts-v1/;
    /plugin/;
    / {
      fragment@0 {
        target-path = "/";
        __overlay__ {
          sw-spi {
            compatible = "spi-gpio";
            #address-cells = <0x1>;
            #size-cells = <0x0>;
            sck-gpios = <&gpio 11 0>;
            mosi-gpios = <&gpio 5 0>;
            miso-gpios = <&gpio 4 0>;
            cs-gpios = <&gpio 23 0>;
            num-chipselects = <1>;
    
            spi-max-frequency = <100000>;
            spi-cs-high;
    
            /* clients */
            spidev@0 {
              compatible = "linux,spidev";
              reg = <0>;
              spi-max-frequency = <10000000>;
            };
    
          };
    
        };
      };
    };
    ENDOVERLAY
    
    # compile overlay definition
    dtc -b 0 -@ -O dtb sw-spi.dts -o sw-spi.dtbo
    
    # apply overlay definition
    mkdir /sys/kernel/config/device-tree/overlays/swspi
    cat sw-spi.dtbo >/sys/kernel/config/device-tree/overlays/swspi/dtbo
    
    # have a look at kernel messages for errors
    dmesg
    
    # check overlay status (should return "applied")
    cat /sys/kernel/config/device-tree/overlays/swspi/status
    

    The patchset also includes a startup script that will automatically load compiled device tree overlays placed in /lib/firmware/device-tree/overlays/*.dto at startup.

    So future hardware configuration for the Omega2 might become as simple as choosing an overlay file from a library, and copying it to /lib/firmware/device-tree/overlays/...



  • @Lazar-Demin I can't upload files to the Onion anymore. I'm not sure if its a setting I got to change but I can't access it through WinSCP or rsync anymore. What do I need to change to fix this?


  • administrators

    @luz oh very cool! Thanks for the pointer and example.
    We've been discussion DT overlay for some time - I guess this is a good opportunity to pull this development forward.
    We'll be experimenting with this in the near term, maybe we'll upgrade to 22.03.5 and then work on DT overlay and the rest of the current backlog.


    @santi29051
    scp should work out of the box. It uses ssh which the beta firmware has installed.

    To get rsync working, you need to first install rsync on the Omega2. Run opkg update; opkg install rsync and then try again.

    Can you share more about the commands that you're using? Keep in mind that the beta firmware is not configured to have a omega-abcd.local hostname and you need to use its IP address. Info on finding the IP address here.

    And did it work with previous versions of the beta firmware or has it not worked with the beta firmware at all?


    One more thing, the very latest 22.03.3 20230628 firmware now supports hardware PWM!
    Check out the technical doc for info on how to use hardware PWM.

    I've updated the original post to add hw pwm to the list of what's new 🙂



  • 👍

    Great work! Really love it 😉
    Now that hardware pwm is possible using command line, will there be an easy way to use pwm. Before it was possible to use

    onion pwm <CHANNEL> <DUTY CYCLE> <FREQUENCY>
    

    or should we write a python module which uses the documented command line methods?

    Thx again for the great work


  • administrators

    @DocHardinger Good point on making it easy to use pwm on the command line.

    We've brought a new, smaller onion script to the beta firmware.

    It's part of a new omega2-script package that's not included in the firmware but can be installed. For now it only supports the pwm and time commands.

    Check out the updated documentation here: https://github.com/OnionIoT/OpenWRT-Packages/blob/openwrt-22.03/technical-doc.md#enabling-pwm-pins



  • @Lazar-Demin

    any news on the open points? especially spi and onewire? are you still working on this?


  • administrators

    @DocHardinger Both SPI and onewire are still in the pipeline.

    We're currently working on making device tree overlays loadable during run-time. More info on the progress of that here: https://github.com/OnionIoT/OpenWRT-Packages/issues/62

    We'll need the device tree overlay functionality to make one-wire work - as a lot of the "custom" gpio modules were removed from the linux kernel. @luz posted above in this thread with more details.


    TL;DR: we're still working on improving the beta firmware. Expect SPI and one-wire to be completed in the coming weeks.



Looks like your connection to Community was lost, please wait while we try to reconnect.