using with alternative to Wire.h or non-blocking I2C communication #2422
Replies: 1 comment
-
U8g2 for Arduino will just use the existing Arduino Wire. It is the advantage of Arduino to have a common interface but a disadvantage in cases you have special needs. One solution could be to implement your own low level output with the method used here: u8g2/sys/arduino/u8g2_page_buffer/I2CLCDBoard/I2CLCDBoard.ino Lines 460 to 488 in b82f49a The setup function (line 482) allows you to provide your own custom (and non-blocking) I2C functions. Another approach is to avoid Arduino and build your own C based approach, for example see here: https://github.com/olikraus/u8g2/tree/master/sys/arm/stm32l031x6/u8x8_test In both cases you need to write a low level API for u8g2, which is discussed here: Due to the differences in microcontrollers, the support from u8g2 is limited. For my own time critical applications I usually let the real time part run in interrupts while the display output runs in the main loop. I2C obviously shouldn't be shared if the real time function also requires I2C. In such a case I did fallback to software emulated I2C if required, which also can be interrupted. |
Beta Was this translation helpful? Give feedback.
-
I am currently using the U8g2 library to control an SSD1306 OLED display via I2C on a Seeed XIAO (SAMD21).
However, I am experiencing severe blocking issues with the Wire.h library.
This might have been discussed before, but I couldn't find a clear solution.
I noticed that the U8g2 constructor only allows me to choose between hardware (HW) and software (SW) I2C configurations.
I was wondering if there is a way to use alternative I2C libraries, such as I2C_DMAC for the SAMD21, with U8g2 to alleviate the blocking problem.
The blocking issue is causing problems in other parts of my application.
For example, in an audio application, the audio glitches every time the buffer is sent to the OLED.
(audio rate is 48khz, by TC4 hardware timer interrupting)
If anyone has experience using U8g2 with other fast I2C libraries on the SAMD21 or similar microcontrollers,
I would greatly appreciate any insights or suggestions.
Thank you in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions