• Consider the I2Ctest script below. After a 'send to Espruino' and running 'onInit()' everything works fine. After a 'save()', I2C fails.

    My hardware is OK, I have 2 pullups on B6 and B7 and a single DS3231 on the bus. An oscilloscope does not show any activity on either SDA or SCL, so how can a timeout is detected...

    function init()
    {
      //I2C1.setup({ scl : B6, sda: B7 });
      try {
        I2C1.writeTo(0x68,0);
        var data=I2C1.readFrom(0x68,3);
        console.log(data);
    	LED2.set();
      } catch (error) {
        console.log(error);
    	LED1.set();
      }
    }
    
    function onInit()
    {
      I2C1.setup({ scl : B6, sda: B7 });
      LED1.reset();
      LED2.reset();
      setTimeout(init,2000);
    }
    Gives output :
    
    > |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v09 (c) 2021 G.Williams
    >
    >onInit()
    =undefined
    new Uint8Array([41, 85, 22])
    >save()
    =undefined
    Compacting Flash...
    Calculating Size...
    Writing..
    Compressed 81600 bytes to 3379
    Running onInit()...
    InternalError: InternalError: Timeout on I2C Write BUSY
    > 
    
    
    
    

    The behaviour is the same after power off/power on (with the console.logs removed). What am I doing wrong ?

About

Avatar for jgw @jgw started