Avatar for 27percent

27percent

Member since Jan 2018 • Last active Jan 2018
  • 1 conversations
  • 5 comments

Most recent activity

  • in Pico / Wifi / Original Espruino
    Avatar for 27percent

    Damn, thought we had this sorted but I've come across some other weirdness -_- First off, thanks again for all your help, I know everyone here is busy so I appreciate the time. Second, I've come across a couple of issues interfacing with two MCP23017s, one on address 0b0000101 and one on address 0b0000111, I'll list them below:

    1) Address 0b0000000 fails to connect for some reason.
    2) The 'writePort()' command doesn't seem to work, I've tested it with multiple values (0, 1, 0b0000000000000000, 0b1111111111111111) to no effect.
    3) Port A on address 0b0000101 fails to read and write, tested with two chips in multiple places on the breadboard.
    4) Writing to pins on the expanders intermittently fails for long periods, then suddenly starts working again after messing about with code and not moving the physical breadboard.
    5) When reading/writing to the chips at sub-500ms intervals, after a short time the I2C bus packs up and gives a 'Uncaught InternalError: Timeout on I2C Write Transmit Mode 2' error. The bus occasionally recovers and begins re-scanning after a couple of minutes but usually stays down.

    I'm almost certain there's something underpinning all of this weirdness, but it feels like I'm working in the dark in terms of debugging - things seem to be happening at random

    Cheers

    -JBL

  • in Pico / Wifi / Original Espruino
    Avatar for 27percent

    Okay, to keep you posted, issue is re-occurring now after waiting for 5 minutes and re-sending the hardware sketch to the pico on I2C2 pins B10 & B8 - Out of the blue I decided to try I2C1 pins B8 and B9 and they seem to work fine

  • in Pico / Wifi / Original Espruino
    Avatar for 27percent

    Definitely 23017 not 23S17, I checked that last night before posting to make sure I'd covered as many potentially silly issues as possible :).

    Tried the software I2C trick, changed from I2C2 to new I2C() and everything worked perfectly. Then I tried changing back to hardware I2C and it worked perfectly too, so then I tried power-cycling and trying hardware I2C and it still works - I can't really explain what fixed the issue, perhaps establishing a solid software I2C link kicked something in the MCP chip and got it in a good state, but it's working now.

    I'll keep an eye on it and monitor for any instability, thanks for your help :)

  • in Pico / Wifi / Original Espruino
    Avatar for 27percent

    Updating to 1v95 is a good shout, as is setting the address to 0 instead of 0x20, I've tried setting the address to 0 (along with 1 to 7 for make sure I'm not on the wrong address) but I'm still getting the same error unfortunately. I've just updated to 1v95 this moment and re-tested and I'm getting the same issue, full code is below, it's pulled almost verbatim from the example:

    Code:

    var i2c=I2C2;
    i2c.setup({scl: B10, sda: B3});
    var address = 0;
    var RST=A8;
    
    var port=require("MCP23017").connect(i2c,RST­,address);
    
    port.A0.mode('input_pullup');
    console.log(port.A0.read());
    

    Error:

    Uncaught InternalError: Timeout on I2C Write Transmit Mode 2
     at line 1 col 42
    this.i2c.writeTo(this.i2ca,c,[a&255,a>>8­])
                                             ^
    in function "s" called from line 1 col 128
    ...ut"==a?this.n&=~c:this.n|=c);this.s(1­2,"input_pullup"==a?thi...
                                  ^
    in function "m" called from line 1 col 18
    this.p.m(this.b,a)
                     ^
    in function "mode" called from line 1 col 28
    port.A0.mode('input_pullup');
                               ^
    Uncaught InternalError: Timeout on I2C Write Transmit Mode 2
     at line 1 col 29
    this.i2c.writeTo(this.i2ca,c);return this.i2c.readFrom(this....
                                ^
    in function "r" called from line 1 col 53
    ...8:this.b;return this.p.r(18)[255<this.b?1:0]&a?1:0
                                  ^
    in function "read" called from line 1 col 26
    console.log(port.A0.read());
    

    I've also attached a potato-quality photo of my wiring, note the reset pin is not connected - I've tried it both with and without, each result in the same error

  • in Pico / Wifi / Original Espruino
    Avatar for 27percent

    Hi there!

    I'm trying to interface and Espruino Pico with an MCP23017 and I'm running into a little trouble with the I2C communication (I2C2, pins B10 & B3, MCP device address 0x20)

    The error I'm getting is as follows:

    Uncaught InternalError: Timeout on I2C Write Transmit Mode 2
     at line 1 col 43
    {this.i2c.writeTo(this.i2ca,c,[a&255,a>>­8])}
    

    I've tried manually reading data from the MCP chip and that works as far as I can tell, my original assumption was incorrect wiring but I've been over half a dozen times and everything looks sound, 10k pullup resistors included on the i2c lines etc, and I can read data from the chip.

    The problem only seems to occur when something tries to write to the chip, I've tested two different chips both giving the same error, does anyone think they could lend me a hand with this? It'll likely be something forehead-slappingly simple I've overlooked but on the off chance it isn't, I figured I'd post here

    Cheers!

    -Josh

Actions