Wifi + Pin() + I2C Closes Wifi connection?
-
I have a
- Wifi connection
- I2C Channel
- Pin() out setting
I can use Wifi + Pin OR Wifi + I2C
But as soon as I combine all 3 and start reading on I2C the Wifi closes or I2C waits until FTP is ready and then closes Wifi. 'connection closed by server' in Filezilla.Is this a documented resource limitation or a bug??
Any way around it?Lopy4 + Expansion Board V3.1
Firmware 1.20.1.r1Wifi:
wlan = WLAN(mode=WLAN.STA)I2C:
i2cCH1 = I2C(0, I2C.MASTER, baudrate=100000, pins=('P9','P10'))
i2cCH2 = I2C(1, I2C.MASTER, baudrate=100000, pins=('P22','P21'))Pin:
RelayPin20 = Pin('P20',mode = Pin.OUT)
RelayPin20.value(1) # Relay Off
-
@KenM So easy. Sometimes you have to know for sure that there is a big in the code, to be able to see it.
-
@robert-hh
I'm using 4k7 pull-ups on al 4 pins, but it worked before.
Found it, I had a conditional machine.sleep(1000) after my I2C read code I forgot to remove after my deepsleep tests. My bad.
-
@robert-hh
The test was done with a not modified P20 connection to the expansion board to avoid confusion.I did get a few reading from I2C without losing may FTP connection, not sure if it's FTP timeout related to the normal 10 sec continuous I2C stream I take. (512 readings)
-
@KenM Is it possible that there is a short between P20 and P21? You have modified the board.
-
@KenM I tried that here with a Lopy4. P20 set to output mode, value=1. I2C on P9 and P10 and keeping that very busy. During that I had not problem of communicating with FileZilla, uploading and downloading files.
May it be possible that it is a power supply problem? Although it is hard to imagine that this minor additional load by I2C or P20 together with WiFi is the problem. What is the impedance between Vcc and SDA or SCL?
-
@robert-hh
I have the same problem if I only use one channel (P9, P10)
So I don't think that is related to that, they can probably both communicate on the bus without problem. (I only use address 0x28)
-
@KenM I do not know if you use I2C(1) on P21, P22 for your own code, but that one is used by Pycom code to communicate with the expansion board.