Milk-V Duo I2C SSD1306 with user-space driver

Dear Friends,
Please forgive me for posting in English.
I have managed to connect the Milk-V Duo to an I2C SSD1306 128x64 OLED display. The only difference with other previous projects is that I am not using a Linux kernel driver for the SSD1306. I am using a user-space driver.
The user-space driver can be found on GitHub: GitHub - armlabs/ssd1306_linux: SSD1306 oled I2C driver working in linux
It can be compiled very easily.


Then copy it using scp to the Milk-V Duo.
The driver can then be used very easily, here is an example,

And the result

Note that I2C0 pinmux has to be setup previously.

Thank you all for your patience and kindness.

5 Likes

I was able to compile the binary on the board itself with tinycc (使用TinyCC在(milkv-duo)开发板内编写C程序调试):

tcc -r ssd1306.c -I .
tcc -r linux_i2c.c -I .
tcc -o ssd1306 main.c linux_i2c.o ssd1306.o -I .
./ssd1306 -I 128x64
./ssd1306 -c
./ssd1306 -m "Hello world!\nMilk-V Duo"

Thanks for detailed info you gave @AndrewDB

2 Likes

Your demo program is great!

I always used other peoples’ SSD1306 drivers before. Always said I was going to dig through the datasheet and write my own someday. The last few days was that “someday”.

Could not get WiringX to do it. Seems to be just not flexible enough, at least for the init(). I am going to go back to that code and try again now that I have a working init array. (I did go back to it and try again on my Sparkfun LCD project - still glitchy problems - went back to the solid, reliable bitbang i2c).

Finally got it running yesterday and started on a simple rasterizer and building a font for it. It’s rough and very minimal still, but works well. It wasn’t terribly difficult - the hardest part is getting the 1306 initialization right. That datasheet is a bit difficult to read. I don’t think English is their first language. :yum:

1 Like