boochow / micropython-raspberrypi

bare metal Raspberry Pi Zero / Zero W port of MicroPython
MIT License
215 stars 24 forks source link

Hello #26

Closed dcabanis closed 5 years ago

dcabanis commented 5 years ago

Hello! Thank you for your great work. Running micropython on a RPI is such a great idea. I have been using an original RPI (RPI A) to run your code. I am able to do GPIO read/writes, the REPL works great too. Where I am having difficulties is with the I2C interface. I have tried a couple of different devices but I can't seem to get them to talk to the RPI, The same devices work with other boards like micro:bit.

Do you have to enable the interface in config.txt? is there an I2C baudrate value that should be provided? For info, I an trying to get an OLED 128x64 1306 display to work with it.

Could it be down to differences between RPI Zero and the original RPI? I thought they had the same SoC.

Kindly,

David

boochow commented 5 years ago

Hi David, thank you for your question. An important thing is that the MP for RPi currently does not support software-I2C, which is required for the SSD1306 driver. Its method for drawing image on SSD1306 uses a mid-level API of software I2C to prevent allocating a large memory block in the driver, so you have to use software I2C.

Please see this post for details https://forum.micropython.org/viewtopic.php?f=2&t=5032&start=20#p29260

I suppose if i2c.scan() works, your board is working correctly. Since dpgeorge implemented new method i2c.writevto(), now I am planning to port it to MP for RPi.

dcabanis commented 5 years ago

Super! Thanks for the info. I going to try it directly from the main.py

Thanks again,

David

On Fri, 12 Jul 2019, 04:05 boochow, notifications@github.com wrote:

Hi David, thank you for your question. An important thing is that the MP for RPi currently does not support software-I2C, which is required for the SSD1306 driver. Its method for drawing image on SSD1306 uses a mid-level API of software I2C to prevent allocating a large memory block in the driver, so you have to use software I2C.

Please see this post for details https://forum.micropython.org/viewtopic.php?f=2&t=5032&start=20#p29260

I suppose if i2c.scan() works, your board is working correctly.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/boochow/micropython-raspberrypi/issues/26?email_source=notifications&email_token=AD52GEIZQJSA2TI7BAF6RB3P67YGZA5CNFSM4IBFHX3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZYRIZQ#issuecomment-510727270, or mute the thread https://github.com/notifications/unsubscribe-auth/AD52GENN2HY6BIZATXPJ4GLP67YGZANCNFSM4IBFHX3A .