Shop OBEX P1 Docs P2 Docs Learn Events
3.4 MHz MCP23009 I2C I/O expander Spin2 Test (with SimplestSerial) — Parallax Forums

3.4 MHz MCP23009 I2C I/O expander Spin2 Test (with SimplestSerial)

RaymanRayman Posts: 14,744
edited 2023-12-09 16:50 in Propeller 2

Was looking for high speed I2C I/O expander and came across this one.
Has a lot of nice features.
Says it's open drain, but it can actually provide ~33 kOhm pullup resistors.

This code test reading and writing at 3.4 MHz and seems to be working.
Needs the lowest value of internal P2 pullup, 1.5 kOhm, to work though.
Probably due to the high speed and me having some other I2C devices on the bus...

This code also has me testing "SimplestSerial" where I'm using the PropTool debug window for serial output. Saves me from starting up PST. This also works in FlexProp.

Comments

  • RaymanRayman Posts: 14,744

    Ok, simplestserial seems to just freeze up when used in subobject for some unknown reason...
    Think going back to PST instead of trying to use debug window for serial...

  • In the past I tried to connect a slow I2C device to the P1 I2C (EE) bus and had problems on the P1 I side when wanting to write to the EE during programming (which happens at an odd speed of around 230kHz [if my memory is correct]). I wonder if having a high-speed device like this share a bus with standard devices could cause you problems. We are lucky that we have the option to define any pins as I2C.

  • RaymanRayman Posts: 14,744

    The real application here is for a 2.4” lcd with touchscreen. I am having some troubles with my first attempt to make it work. Thought it might be having the touch controller on the same bus, but it is also rated for 3.4 MHz. And, same issues at lower speed.

    Might have to break out scope if can’t figure it out soon…

  • RaymanRayman Posts: 14,744

    Circuit has all control pins coming out of expander except wr, so can still do high speed writes with 8 bit data bus using p2 pins. Seems almost works correctly but something is off..

  • RaymanRayman Posts: 14,744

    Ok, all good. Expander is working for LCD! Was concerned that 33k pullups was not strong enough for this LCD, but problem was actually a bad soldering contact on the LCD interface.
    The debug serial may also be working. Going to test that some more....

    480 x 640 - 177K
  • That looks nice. Well done.

  • Really nice👍

  • RaymanRayman Posts: 14,744

    Thanks. One other nice thing is that the Exander's I/O is 5V tolerant. This particular application has two free expander pins that I brought out to header in case needed for something...

    This seems like a way to interface with 5V signals without risking damage to P2, if doesn't need to be super fast...

  • RaymanRayman Posts: 14,744

    Seems there is some I2C speed issue after all. TSC2003 touchscreen chip shows up in bus scan at 3.4 MHz, but won't communicate.
    Does work at 1.7 MHz though with the 1.5 kOhm pullup. So that seems strange.
    1.7 MHz is good enough, but think should work at 3.4 MHz. Might be some driver issue, I suppose....

  • RaymanRayman Posts: 14,744

    Here's another kind of strange thing... When the bus speed is reduced from first test at 3.4 MHz to second test at 1.7 MHz, a third thing shows up on the i2c bus. But, there are actually only two chips on the bus...

    1120 x 1412 - 200K
    C8.png 199.8K
  • RaymanRayman Posts: 14,744

    Just noticed this section of the datasheet. Hopefully this will fix it:

    538 x 285 - 74K
  • RaymanRayman Posts: 14,744

    Actually, things seem fine with I/O expander at 3.4 MHz and this at 1.7 MHz. Think just go with that for now...

Sign In or Register to comment.