olikraus / u8g2

U8glib library for monochrome displays, version 2
Other
5.18k stars 1.05k forks source link

ssd1306 NO_NAME I2C FW not work rp2040 #2528

Open tistructor opened 2 weeks ago

tistructor commented 2 weeks ago

Hi, I'm testing with sdd1306 in I2C on a board with rp2040.

It works well if I use I2C in HW but if I use software mode the display remains black.

I used the sample file attached to the library, especially the graphicTest.ino.

I also tried to change the gpio but I don't get results.

olikraus commented 2 weeks ago

I have no idea what could be the reason. Maybe search in this forum for rp2040.

tistructor commented 2 weeks ago

I checked all the problems with rp2040 but there is nothing about the fact that I2C software doesn't work. I tried in every possible way but the display remains off. I set the same I2C HW GPIOs in software mode but nothing, it doesn't work. I'm using the https://github.com/earlephilhower/arduino-pico package latest version. I tried adding external pullup resistors on the scl and sda pins but the problem remains. I can check the quality of the signal and whether it is present with an oscilloscope.

I'm using micro defaul settings no overclocking or anything.

tistructor commented 2 weeks ago

I could try powering the display with 5V as it accepts this power while keeping the data level at 3.3V.

But first I'll do a test with 5V arduino and software mode and see if everything works.

tistructor commented 2 weeks ago

First I do a test with software to verify that the i2c display is detected correctly.

tistructor commented 2 weeks ago

I scanned with software and found 2 addresses:

Device found at 0x79 Device found at 0x7A

However, with the I2C Hw test I only find one address and it is different from the other 2 previous ones.

Finished Scanning... I2C device found at address 0x3C !

In theory I should have the same addresses.

tistructor commented 2 weeks ago

I tried changing gpio for i2c software and the scan results in the same 2 addresses.

tistructor commented 2 weeks ago

I noticed that if I shift to the right of a position I find the correct address of 0x3C. I think the two programs are not exactly the same.

tistructor commented 2 weeks ago

However, the peripheral in I2C sw is detected. I think it depends on some timing within your library. I couldn't say anything else.

tistructor commented 2 weeks ago

Software mode that doesn't work: U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, / clock=/ D5, / data=/ D4, / reset=/ U8X8_PIN_NONE);

Hardware mode that works: U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE);

GPIOs equal.

tistructor commented 2 weeks ago

I also did the same graphicTest on an rp2040 module and it works the same way as my coustom card. I2C HW works and FW mode doesn't work.

tistructor commented 2 weeks ago

Tested on arduino one, I2C works both fw and hw.

I also scanned I2C addresses with softwire and in this case I get the correct address 0x3C.

I think there are timing problems with RP2040 in software mode.

olikraus commented 2 weeks ago

Thanks for the testing and reporting this here. I agree to you conclusion and i am sorry not to be able to help here...