Hi @lukasmaximus,
I want create snapshots with the UnitV via WIFI. The ws2812 import is only to show the status of the camera.
UnitV = I2C Slave
ESP8266 = I2C Master + Wifi
Jan
Hi @lukasmaximus,
I want create snapshots with the UnitV via WIFI. The ws2812 import is only to show the status of the camera.
UnitV = I2C Slave
ESP8266 = I2C Master + Wifi
Jan
@m5stack The deinit() is just called at the end for cleanup. I2C should work in the endless loop "while True: time.sleep(20)"
Any ideas how to establish a I2C connection with the M5Stack UnitV as I2C.Slave?
Setup:
Setting up the UnitV Stick as a I2C slave is failing. I'm connecting a ESP8266 with ports 34,35 of the UnitV and a 4,7kO Pull-Up resistor.
The scan from the ESP8266 master is successful, but any read or write operation fails with a timeout message. The connection to other I2C devices is successful, when the UnitV is removed from the bus.
UPDATE: Any write operation - before a read - is successful. After the first read, the bus is blocked.
import time
from machine import I2C
I2C_SLAVE_ADDR = 0x3a
count=0
def i2c_on_receive (data):
print ("on_receive:", data)
def i2c_on_transmit ():
count = count + 1
print ("on_transmit, send:", count)
return count
def i2c_on_event (event):
print ("on_event:", event)
print ("starting i2c")
i2c = I2C(I2C.I2C1, mode = I2C.MODE_SLAVE, scl=34, sda=35,
freq = 400000, addr = I2C_SLAVE_ADDR,
addr_size = 7,
on_receive = i2c_on_receive,
on_transmit = i2c_on_transmit,
on_event = i2c_on_event)
while True:
time.sleep(20)
ESP8266 Micropython Code:
from machine import Pin, I2C
i2c = I2C(scl=Pin(12), sda=Pin(13), freq=400000)
i2c.scan() # returns [58]
i2c.writeto(0x3a,'test') # success, write 4 bytes to slave with address 0x3a
result = i2c.readfrom(0x3a, 4) # fails with Timeout
print(q)
UPDATE 2020-06-26: