How quickly can I get I2C going during boot? (OLED DIsplay)



  • Hi everyone
    I have built a device for a client that creates a kind of Network (UDP) to Serial convertor. It also does protocol convertion and scaling etc.

    Anyway... it has an OLED display on board, and some buttons to present a UI.
    Since the Onion takes about 1 minute to boot up, I was wondering how early in the boot process I could send some commands over i2c to the oled, so that something appears on the display early in the boot process?

    I tried START=13 in my service file, but the difference between that and START=99 was minimal.

    In other words... is it possible to use I2C and get something showing on the display early in the boot, if so, how early?



  • You might want to look at the preinit mechanism. This is similar to the /etc/init.d scripts, but runs much earlier.

    The preinit scripts are in /lib/preinit/ and, according to my dmesg outputs (search for "init: - preinit -" line), start running around 3.5 seconds into the boot process.

    However, when these start running, you have almost nothing ready yet. In particular, loading of additional kernel modules, such as the i2c driver, seems to happen only after preinit is done. Most of the preinit runtime seems to be mounting the jffs2 overlay, taking around 20 seconds. Only then, procd starts running, and kernel module autoload starts.

    The main challenge might be: before the jffs overlay is up, you only have the files that are baked into the firmware image. So whatever custom things you want to do early, need to be part of a custom-built OpenWrt image and can't be just installed later on top.



  • @SpiderKenny Perhaps look at this thread, where @supczinskib developed a driver for their display, some kernel magic required.

    https://community.onion.io/topic/4238/smart-irrigation-system/7?_=1715760525737



  • @luz Thanks - there's some things for me to think about there!


  • administrators

    @SpiderKenny another option would be to modify the bootloader so it writes a loading screen to the OLED display before Linux even starts booting.
    Might be a little work intensive tho!



  • @crispyoz Thanks! That's an idea - I could probably just do a bunch of register level acces to initialise the display over i2c and put up something. I'll need to do a bit of learning on uboot šŸ™‚


Log in to reply
 

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