Created
July 6, 2020 12:16
-
-
Save withattribution/29432b36aea6562c5fab70549201e6b3 to your computer and use it in GitHub Desktop.
Quck notes on MPC23107 implementation on the Rose Board
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| i2c MPC23107 | |
| from machine import I2C,Pin | |
| i2c = I2C(-1,Pin(14),Pin(2)) | |
| i2c.scan() | |
| [IOCON x0A BANK (0 is default)] | |
| i2c.readfrom_mem(32,10,1) (returns b'\x00') | |
| [IODIRA initial read] | |
| i2c.readfrom_mem(32,0,1) returns (b'\xff') | |
| [IODIRA x00 set to 00 (all outputs)] | |
| [I2C.writeto_mem(addr, memaddr, buf, *, addrsize=8)] | |
| i2c.writeto_mem(32,0,b'\x00') | |
| then re-read should be \x00 | |
| i2c.readfrom_mem(32,0,1) returns (b'\x00') [yaaas!] | |
| [GPIOA x12 set 1 (gpa0 high)] | |
| x12 is decimal 18 | |
| i2c.readfrom_mem(32,18,1) returns b'\x00' everything off | |
| i2c.writeto_mem(32,18,b'\x01') | |
| i2c.readfrom_mem(32,18,1) returns b'\x01' gpa0 on! verified with voltmeter! | |
| turn off GPA0 | |
| i2c.writeto_mem(32,18,b'\x00') | |
| i2c.start() | |
| i2c.stop() | |
| ---------regard later | |
| or maybe OLAT | |
| ---------regard later | |
| i2c.start() | |
| i2c.writeto(32,b'0') | |
| i2c.writeto(32,b'0') | |
| i2c.stop() | |
| i2c.start() | |
| i2c.writeto(32,b'\x12') | |
| i2c.writeto(32,b'255') | |
| i2c.stop() | |
| #i2c.start() | |
| i2c.writeto(32,b'9') | |
| i2c.writeto(32,b'1') | |
| i2c.stop() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment