• I was having an issue with setting up chip Via I2C with the MDBT42Q breakout board. I kept getting numbers that made no sense. I disconnected the Chip from the Board and the I2C read command would still return "data". I belive there is something wrong with this function. I setup an I2C again, with nothing attatched and the read function still returns something with no error. I'm running the lastest firmware I could find; espruino_2v17_mdbt42q.

    pasted from the web editor:

    var i = new I2C();
    =I2C: { }
    i.setup({ scl : D15, sda: D14 });

    i.readFrom(0x2A, 3)
    =new Uint8Array([255, 255, 255])

    this occurs with nothing connected to the MDBT42Q breakout board. I think i need some help with this!

  • Hi - yes, the software I2C implementation does do some error checking but it doesn't throw an error if there isn't an explicit acknowledge to a read request, it just returns 255.

    You could try hardware I2C - the only difference in your code would be changing var i = new I2C(); to var i = I2C1;. It will probably then throw an error if a device isn't connected (but hardware I2C might require external pullup resistors).

    However, the problems you're having with unexpected values for reads are unlikely to be related to that - maybe you could share the code you were using to read a value that wasn't working, and what device/value you were trying to read and I might be able to figure out what's up?

  • Thank you for your prompt response, Gordon. It is good to know this quirk of the software I2C, I will change my code to rely on the hardware I2C instead, for now. Does the Software I2C object accept arguments to disable internal pullup feature when the External Device already has Pullup resistors? This would be ideal for some of my work. I will get back to testing my custom pcb, I designed a small hat for the MDBT42Q breakout board to interface with a texas instument LDC3114 chip and add analog output capability utilizing a MCP4725 DAC. both of these chips are on a I2C bus. Thanks again!

  • Does the Software I2C object accept arguments to disable internal pullup feature when the External Device already has Pullup resistors?

    I'm afraid not, no... I suppose it's something that possibly could be done, but honestly I2C is pretty tolerant - it's unlikely to care if there are two sets of pullup resistors

  • I think you are correct I, tested with hardware & software I2C and I can relaibly communicate with my hardware now !(with external pullups) I'm not entirely sure what happened overnight but when I went to debug using the hardware I2C this morning it just worked straight away, then it worked fine with the software defined I2C as well. I think my biggest hangup was the software not throwing an error with the software I2C, I didn't know what was going on. Now that i'm aware of that quirk, it wont surprise me in the future. thanks for your help!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Issue with software I2C on MDBT42Q Bluetooth Module

Posted by Avatar for ioi-655321 @ioi-655321