Avatar for Mrbbp

Mrbbp

Member since Mar 2017 • Last active Jan 2020
  • 16 conversations
  • 110 comments

I'm newb with espruino, not with arduino, not with js...
But i'm not a coding ninja

Most recent activity

  • in Pico / Wifi / Original Espruino
    Avatar for Mrbbp

    And so. Can you be more specific. Have you a ref on ebay?
    I’m living in farwest with no electronic furniture store in my area...

    I will try later... when i’ll have got some
    Regards

  • in Pico / Wifi / Original Espruino
    Avatar for Mrbbp

    Ok, i stop to try to work with the ht16k33 and return to the « good old shit » alias the max7219.
    Spi nor i2c...
    With a delay of 100ms for the setup, it works fine (everytime) and is cheaper and easier to find!

    Thanks for your help @allObjects

    Ps: i tried to remove the 10k with just a bridge... and with a 4k7... no more results... grrrrrrr
    I was looking for a solution to have only 3v3, but it does not work as expected .fu...

  • in Pico / Wifi / Original Espruino
    Avatar for Mrbbp

    @allObjects,
    Hello Markus, i've tried to add a diode N4007 to sda and scl... (as you explain) it's worse, it does not init.
    The module have 2 10k resistor in pull-up on sda and scl.
    is it possible to remove the resistors or change value to a 4k7?
    i refer to an other post here

    regards

    é.

  • Avatar for Mrbbp

    some infos about the I2C from the IC doc
    I2C Serial Interface
    The HT16K33 includes an I2C serial interface. The I2C bus is used for bidirectional, two-line communication between different ICs or modules. The two lines are a serial data line (SDA) and a serial clock line (SCL). Both lines are connected to a positive supply via a pull-up resistor. When the bus is free, both lines are high. The output stages of devices connected to the bus must have an open-drain or open-collector to perform a wired and function. Data transfer is initiated only when the bus is not busy.
    [...]
    START and STOP Conditions
    • A high to low transition on the SDA line while SCL is high defines a START condition.
    • A low to high transition on the SDA line while SCL is high defines a STOP condition.
    • START and STOP conditions are always generated by the master. The bus is considered to be busy after the START condition.
    The bus is considered to be free again a certain time after the STOP condition.
    • The bus stays busy if a repeated START (Sr) is generated instead of a STOP condition. In this respect, the START(S) and repeated START (Sr) conditions are functionally identical.

    there is no busy pin on the driver board.
    i was thinking to read B6 and B7 to know if it's busy... (as read in the doc)
    If you digitalRead a pin, without a pinMode, you reset the pin in input :(
    I've tried.
    it freeze the display and add to upload a new firmware few time after (is it the cause.. i can't said)

  • Avatar for Mrbbp

    Gorgeous @allObjects!
    it works pretty well, have to try it more.
    Sometime pb persisting even with the tries...
    I definitively will try with the scotchy diode...

    My crappy solution seemed effective but it was an evidence there was a better, nicer code structure to write to do this.

    it seems if it catchs an error even with the tries it fail to initialize the display...
    never mind i use your "boot sequence"

    just a small misspelling throw rather than trow (i'm unfamiliar with this command).

    Thanks again.
    It's nice code

    I do not see a reset command in the doc
    therefore i remove the first function (res). ;)

    é.

    ps: clearInterval() was seen in a forum post about timeout

    var ini = function() { // first
      require("Font4x6").add(Graphics);
      // initialisation I2C
      console.log("setup I2C");
      I2C1.setup({scl: B6,sda: B7});
      /* rajouter les init de connexion pour le display */
      console.log("init programme affichage matrice v2.2 - éric choisy ©2019");
      console.log("mém. utilisée: "+Math.round(process.memory().usage/proc­ess.memory().total*100)+"%");
    }
    , osc = function(tries) { if (tries>0) { // third w/ retries
      try { console.log("turn OSC ON");
        digitalPulse(LED2,1,20);//verte
        I2C1.writeTo(0x70, 0x21); // turn on oscillator
        setTimeout(don,250,2);
      } catch(e) { console.log(e);
        setTimeout(osc,250,--tries);
        digitalPulse(LED1,1,20);//rouge
      } } else throw "Unable to turn osc on";
    }
    , don = function(tries) { if (tries>0) { // fourth w/ retries
      try { console.log("turn display ON");
      digitalPulse(LED2,1,20);//verte
        I2C1.writeTo(0x70, 0x81); // display on
        setTimeout(lum,250,2);
      } catch(e) { console.log(e);
        setTimeout(don,250,--tries);
        digitalPulse(LED1,1,20);// rouge
      } } else throw "Unable to turn display ON";
    }
    , lum = function(tries) { if (tries>0) { // fifth w/ retries
      try { console.log("set brightness");
        digitalPulse(LED2,1,20);//verte
        I2C1.writeTo(0x70, 0xE0 | 0); // luminosité 0-15
        setTimeout(envoieMatrice, 1000);
      } catch(e) { console.log(e);
        digitalPulse(LED1,1,20);//rouge
        setTimeout(lum,250,--tries);
      } } else throw "Unable to set brightness";
    };
    const onInit = function() {
      ini();
      osc(3); // starts the chain \:
    };
    

    i added led pulse to have visual feedback without a console...

  • Avatar for Mrbbp

    ok understood! :)
    i've got only one module... i keep in mind to remove the resistors (not on last) if i need to chain modules.
    I do not work with flipdot matrix for this project (too deep, too expensive, no more flipdot module on sale :( ) just a big 60mm led matrix, with a ldr to adjust brightness and a pot for speed scroll text.

  • Avatar for Mrbbp

    @Robin

    i tried in a dirty way by adding some time in each command (a blank loop) and a try catch.
    i've got less error.
    sometime (1 in 5 switch on) there is no error but display does not start.
    When i unplug/plug i lost the connexion therefore i do not receive the error... but i blink the led in the main program and it blink....
    show you my ugly code

    const onInit = function() {
      clearInterval();
      clearWatch();
      pinMode(B6, 'opendrain');
      pinMode(B7, 'opendrain');
      require("Font4x6").add(Graphics);
      /* rajouter les init de connexion pour le display */
      console.log("init programme affichage matrice v2.2 - éric choisy ©2019");
      console.log("mém. utilisée: "+Math.round(process.memory().usage/proc­ess.memory().total*100)+"%");
      // initialisation I2C
    
        console.log("setup I2C");
      I2C1.setup({scl: B6,sda: B7});
      // rouge
      try {
        console.log("try OSC ON");
        I2C1.writeTo(0x70, 0x21); // turn on oscillator
      } catch(e) {
        I2C1.setup({scl: B6,sda: B7});
        setTimeout(function() {
          console.log("try again 0x21");
          try {
            I2C1.writeTo(0x70, 0x21); // turn on oscillator
          } catch(e) {
            console.log("does not init",e);
          }
        }, 250);
      }
    
      // init suite I2C
      for (var i=0; i<10000; i++) {
        //
      }
      try {
        console.log("try display ON");
        I2C1.writeTo(0x70, 0x81); // display on
      } catch(r) {
        digitalPulse(LED1,1,20); //rouge
        for (i=0; i<10000; i++) {
          //
        }
        console.log("try again display ON");
        I2C1.writeTo(0x70, 0x81); // display on
      }
      digitalPulse(LED2,1,20);//verte
      try {
        console.log("try brightness");
        I2C1.writeTo(0x70, 0xE0 | 0); // luminosité 0-15
      } catch(r) {
        digitalPulse(LED1,1,20); //rouge
        for (i=0; i<10000; i++) {
          //
        }
        console.log("try again brightness");
        I2C1.writeTo(0x70, 0xE0 | 0); // luminosité 0-15
      }
      digitalPulse(LED2,1,20);//verte
      setTimeout(envoieMatrice, 1000);
    };
    
  • Avatar for Mrbbp

    @Robin
    i give you more off my onInit()

    const onInit = function() {
      clearInterval();
      clearWatch();
      pinMode(B6, 'opendrain');
      pinMode(B7, 'opendrain');
      require("Font4x6").add(Graphics);
      /* rajouter les init de connexion pour le display */
      // initialisation I2C
      I2C1.setup({scl: B6,sda: B7});
      // rouge
      try {
        I2C1.writeTo(0x70, 0x21); // turn on oscillator
      } catch(e) {
        I2C1.setup({scl: B6,sda: B7});
        setTimeout(function() {
          console.log("try again");
          try {
            I2C1.writeTo(0x70, 0x21); // turn on oscillator
          } catch(e) {
            console.log("does not init",e);
          }
        }, 500);
      }
    
        console.log("init I2C");
        // init suite I2C
        I2C1.writeTo(0x70, 0x81); // display on
        I2C1.writeTo(0x70, 0xE0 | 0); // luminosité 0-15
        digitalPulse(LED2,1,20);
        setTimeout(envoieMatrice, 2000);
    };
    

    and the output.
    It does not loop
    it try once as in the code
    if i well understand, it fail on the first communication

    init I2C
    Uncaught InternalError: Timeout on I2C Write BUSY
     at line 1 col 541
    ... I2C'),I2C1.writeTo(112,129),I2C1.writeTo­(112,224),digitalPu...
                                  ^
    in function called from system
    try again
    does not init InternalError: InternalError: Timeout on I2C Write BUSY
    > 
    
  • Avatar for Mrbbp

    Hello @allObjects M...

    a/ i power the board and the display with usb from my macbook. I've tried with a 700mA phone charger, it inconsistently... After some time unplugged, when i plug the circuit with 5v, it does not initialize at first time... have to switch off/on (plug/unplug) few time and the display start. (as an old car or a cold engine that need a starter)
    The backpack is supposed to work with a Feather (from adafruit) that work at 3.3v level.

    b/ not sure to understand what you mean (sorry)

    c/ no c/

    d/ i've tried

    pinMode(B6, 'opendrain');
    pinMode(B7, 'opendrain');
    

    not better.

    e/ I'll try tomorrow. I think i have a plastic bag full of these black diode... (i used it to stepdown current for led...is it the same?) (dont remember the ref... N4007 (in smd and old fashion black cylinder?)

    thanks for your advice...

Actions