Need additonal i2c config in stm32f0_i2c.c

Basic Information:

Printer Model: monoprice select mini V3
MCU / Printerboard: M200
Host / SBC: Raspberry 3
klippy.log

klippy(15).log (701.8 KB)

Fill out above information and in all cases attach your klippy.log file (use zip to compress it, if too big). Pasting your printer.cfg is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there

Describe your issue:

Hi guys,

could you please add

PA9/PA10 these are the alternativ ports for stm32F072C6 I2C.
Port PB6/PB7 is unfortunately used by other things.

At the Moment i use software i2c but this is very slow.

[display]
lcd_type: sh1106
i2c_software_scl_pin: PA9
i2c_software_sda_pin: PA10
#i2c_bus: i2c1a
x_offset: 2

Thanks

Rüdiger

1 Like

As far as I can tell, there are no alt i2c functions for those pins:


https://www.st.com/resource/en/datasheet/stm32f072c8.pdf

From the log file, it seems that you have a lot of random I2C errors, but it is either a timeout or a START NACK (so the address byte is not acknowledged).

If you accidentally have a logic analyzer or oscilloscope, you can verify the timings, which would help to estimate the actual I2C bandwidth.

Assuming the code is correct (I do believe I2C software implementation is solid).
I2C START NACK would probably mean that the display didn’t acknowledge the transaction at all. Unfortunately, the documentation for this device is scarce. If you can, it would be good to check the existence of pull-up resistors on the lines.

Unfortunately, I do not have benchmark data for the STM32F072 to even estimate what it is capable of.
Also, from the attached logs, it seems that you have an absurd restarts and unclean shutdowns for some reason.

Also, jfyi, there was a recent change around that display support:

So, to sum things up:

  • If you can make sure there a pull-ups for I2C 3-10kOm, depending on your lines and voltages. You can use a multimeter and test the resistance to the nearby VCCIO (if you feed the display with 3.3v, probably there should be pull-ups to the 3.3v).
    (If there is critically not enough performance, there would always be I2C timeout, and no START NACKs. From the MCU load graph, it seems busy, but not 100% percent).

  • If you can, you can after checking the actual I2C performance using of Logic Analyzer or oscilloscope. Generally, the SCL line timings will tell you about performance, the form of the signal the state of pull-ups.

Then it probably should work, it can be slow and garbled. Recent SBC/Host side updates should fix the garbled data.

Then the pull request with async rendering could help to reduce redraw lag.

Hope that helps.

Hi ,

please ignore th NACK messages. These came from a wrong wiring. I swaped 2 pins.
After that the communication seem s ok.

From ST documentation i can confirn the STM32F070C6/F6 has an alternative ic2 configuration on PA9/10

Np, you are correct F070 does have one: https://www.st.com/resource/en/datasheet/stm32f070c6.pdf

You can give it a try: stm32: f070 add PA9/PA10 i2c bus line by nefelim4ag · Pull Request #7039 · Klipper3d/klipper · GitHub
This could help with testing: Testing Klipper Pull Requests

Sorry,

can’t get it working.
Klipper reports: SHUTDOWN

MCU 'mcu' shutdown: I2C Timeout
Once the underlying issue is corrected, use the
"FIRMWARE_RESTART" command to reset the firmware, reload the
config, and restart the host software.
Printer is shutdown

klippy(11).log (234.5 KB)

Hmmm, are you sure you have the STM32F070C6?

So, probably there is no such function on your MCU.


image

Thanks,

you are right, it’s an STM32F070CBT6. I meesed up the type.
So no i2c on PA9/PA10, that’s bad.
Now i have to life with software i2c.
But maybe someone other can use your change.

But again, great job.
Cheers
Rüdiger

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.