Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Mux I2C


    JAPIB - 2022-11-24

    Is there a simple example of using an I2C multiplexer (PCA9548A).
    I found Stefan's post but I can't find a simple example or documentation.
    My goal is to use the multiplexer to manage 6 or 8 analog output modules (MCP4725).
    Thanks in advance.


    JAPIB - 2022-12-03

    Thank you very much for your answer. Is there a program to drive the multiplexer.

  • martinll - 2023-10-22


    IΒ΄ll try to get this thread going again as iΒ΄m having simliar problems.

    Right now i get a red triangle on my connected devices (iΒ΄m testing with a BME280 sensor and a PCA9685 resvo driver).
    The TCA9548 have the green symbol beside it.

    On the "red" devices i get that the bus is not running.
    I have tried to either run it using the parent bus cycle setting or creating a new freewheeling task prio 1 but nothing helps.

    I have compared my settings to the settings from the example from the MUX package and i have read (i think) every thread in forge that could be of interest.

    EDIT: The ic2detect only shows the mux (70-70) and the servo drive (70-76) so iΒ΄ll look in to if i managed to burn the 280-sensor while soldering).

    Another question regarding the 280 sensor. I have a sensor


    that should record humidity and temperatur.
    Could this be a problem with the library?

    Does anyone have an idea of what i might be doing wrong?
    I have some experience from Codesys but not much so this could be an easy one.
    All suggestions are welcome.

    I tried to upload the project archive but it did not work. Should i upload the export or how could i show you my horrible project?




    Last edit: martinll 2023-10-22
  • andrax

    andrax - 2023-10-28

    sorry I was not there for a long time.
    The TCA9548 needs terminating resistors, do you have them in?
    That's why I went to QWIIC, the muxboard already has them built in.
    If it still does not work, try it first without the muxboard.
    PS: Note the channel assignment.
    Muxboard 0 = I2C_Master 1,0,0,0,0,0,0,0
    Muxboard 1 = I2C_Master 2,0,0,0,0,0,0,0


    Last edit: andrax 2023-10-29
  • martinll - 2023-12-31


    this is also a delayed answer, sorry for this.

    when coding in python i get the TCA9548a working.

    Is there someone who knows how big of a effort it would be to update Stefan's original code to make it work with a more up to date version of codesys or should i downgrade my system?

    andrax - are you using a downgraded version of codesys or have you downgraded all the libraries? What Oscat lib are you using? what version?

    thanks for your reply!



Log in to post a comment.