Closed lucazulian closed 4 years ago
Thanks for the report! This is going to be difficult for me to reproduce as I don't have an STM32L4xx board lying around. If you have another SSD1306 and dev board to test with, can you try different combinations of those? That will rule out whether the hardware is broken in some way or not. In your example above, do all the htprintln!()
s print out or does it get stuck/crash somewhere?
My only other suggestion right now would be to disable the pullups set by scl.internal_pull_up()
/sda.internal_pull_up()
.
This is going to be difficult for me to reproduce as I don't have an STM32L4xx board lying around.
Turns out I have an STM32F411 board somewhere. I'll dig that out in the next couple of days and see if I can repro/find a fix.
Managed to reproduce your issue on my Nucleo STM32F411 board. After a bunch of issue reading I found stm32-rs/stm32f4xx-hal#99 which fixed the SSD1306 411 example for me. I've opened stm32-rs/stm32f4xx-hal#120 to fix the examples in that repo.
So that's that mystery solved. Unfortunately I still don't know why your L411 board isn't working. Maybe open an issue in stm32-rs/stm32l4xx-hal repo? I'm pretty sure it's not the SSD1306 driver. There seem to be quite a few bugs around I2C and the various STM32x4xx devices floating around :confused:
As mentioned in stm32-rs/stm32f4xx-hal#99 and fixed in stm32-rs/stm32f4xx-hal#120, adding .set_open_drain()
to SCL and SDA fixes the problem for me on an F446 Nucleo as well as the 411 I tested a while back. I also had to change from 400KHz to 100KHz to get it working. Can you try those changes and let me know if it works?
Reproduced issue on STM32F407VET6. Thanks to @jamwaffles. It appears that lacking knowledge might get painful.
let peripherals = stm32f4::stm32f407::Peripherals::take().unwrap();
let clocks = peripherals.RCC.constrain().cfgr.freeze();
// I2C
let gpiob = peripherals.GPIOB.split();
let (scl, sda) = (gpiob.pb10.into_open_drain_output().into_alternate_af4(), gpiob.pb11.into_open_drain_output().into_alternate_af4());
let i2c = I2c::i2c2(
peripherals.I2C2,
(scl, sda),
500.khz(),
clocks,
);
Solves an issue. These pins must be in open drain configuration. Otherwise, device will respond with NACKs.
ssd1306
in use (if applicable): 0.3.0-alpha.2Description of the problem/feature request/other
I was trying to print some text out but with the code below I not able to see anything into the display. I've tried to change che I2C pin, frequency etc; I didn't spend much time debugging because I don't know if the problem is related to the
stm32l432kc
implementation, with thessd1306
or not. How can I test this issue?Test case (if applicable)
test case dependencies
Can someone explain me how to "solve" or debug this kind of issue?