[Pytrack] Problem getting an extra I2C sensor working on different bus, pins



  • Hi all,

    I have a Pytrack and added a BME280 sensor as follows on the External IO Headers.

    VCC - Pin 3
    GND - Pin 1
    SCL - Pin 7 (P10)
    SDA - Pin 8 (P11)

    My code:

    i2c_env = machine.I2C(1, machine.I2C.MASTER, baudrate=400000, pins=('P11', 'P10'))
    

    What happens is that the program hangs on this initialization. Probably I misunderstand something with initializing the I2C on a different bus and pins.

    Thanks.



  • @xykon Hi I didnt't told you but have tried 1.16.0.b1 and 1.15.0.1 with both the same results. But with some wires soldered it is working fine.

    The following schema now is running:

    External IO Header :
    PIN 1 - GND
    PIN 4 - VCC 3V3 SENSORS

    Header(connected a wire underneath the board)
    P22 - SDA
    P21 - SCL

    I have now a working demo device for this week :)


  • administrators

    @marco-den-hartog OK thanks for the update. I will investigate this further tomorrow as I do not have the necessary hardware at home.

    You can also try downloading an older firmware here: https://software.pycom.io/downloads/WiPy.html

    I'd suggest you try WiPy-1.17.0.b1.tar.gz first and then WiPy-1.16.0.b1.tar.gz



  • @xykon Hi. Yes I tried that and also soldering it the SDA to PIN 6 (P9) and SCL to PIN 7 (P10). I am using the WiPy 3.0 with the latest firmware. When initializing it on I2C bus 1 is hangs. When I use bus 2 then the device crashes. Now I have connected the BME280 directly to the configured PINS on the Pytrack for I2C bus 0 and everything runs smoothly.

    Looks like there is something not correctly or on the Pytrack board or on the software side. My guess is on the software site because I get some voltage on the pins when using the External IO headers.


  • administrators

    @marco-den-hartog Have you tried adding external pull-ups on the bus.



Pycom on Twitter