Avatar for HaraldK

HaraldK

Member since Sep 2015 • Last active Feb 2019
  • 5 conversations
  • 19 comments

Most recent activity

  • in ESP8266
    Avatar for HaraldK

    Nothing else running on it. I had more, but to debug this problem I removed anything else (not that much was running since it's very much space constrained).
    Since the point is to display whatever is sent (up to 6 bytes, since it's a 6 character display), not much chopping up possible.
    For power: It's using a USB power adapter. Never had problems with it.
    Two different ESP8266 modules. Both with ESP12E: Wemos D1mini and a random NodeMCU module.

  • in ESP8266
    Avatar for HaraldK

    Maybe i should simple not use those ESP8266 anymore...

    ESP32 tested and works 100% as expected.

    BTW in both cases I use v2.0x (x=0 for ESP32, x=1 for ESP8266).

  • in ESP8266
    Avatar for HaraldK

    Hi,

    I have a small ESP8266 module which is supposed to receive simple data via simple TCP. The net module should do that and it works mostly:

    var server = net.createServer(function(socket) {
      socket.on('data', function(data) {
        try {
          let a=JSON.parse(data);
          console.log(">"+JSON.stringify(a));
        } catch(e) {
          console.log("ERROR: ", e);
        }
      });
      socket.end();
    });
    
    server.listen(1234);
    

    On the sender side I do a simple test via netcat:

    for i in {0..4} ; do echo "{'toggle':$i}" | nc 192.168.21.105 1234 ; done
    

    But what I get on the Espruino side is:

    {"toggle":0}
    {"toggle":2}
    {"toggle":3}
    {"toggle":4}
    {"toggle":0}
    {"toggle":1}
    {"toggle":3}
    {"toggle":4}
    {"toggle":0}
    {"toggle":1}
    {"toggle":3}
    {"toggle":4}
    {"toggle":0}
    {"toggle":1}
    {"toggle":1}
    {"toggle":2}
    {"toggle":3}
    {"toggle":4}

    which is not what I'd expect from TCP. I should see 0, 1, 2, 3, 4.
    Even if I send one string at a time (and not 5 in a loop), it gets lost in about 20% of the cases.

    Am I doing something wrong? Is the net module on ESP8266 not working reliably?

  • in ESP32
    Avatar for HaraldK

    Digging a bit around, this works and it's reliably working: Use espruino -o x.js MYPROGRAM.js and then upload the temporary output, which resolves all require() modules via wifi (nc ESP32IP 23 < x.js)

    That proves at least that whatever the espruino command does, seems to work. The problem might be an intermittent reset caused by the serial port.

  • in ESP32
    Avatar for HaraldK

    Hi,

    I got a neat ESP32 board and tested Espruino (1.92) on it. Works like a charm when using the Web IDE. Uploading via NPM espruino module works. About once in 10 times. It sends data (-v switch is very useful here), and it usually does something, but often it seems to forget everything immediately, like if there is a reset() after upload.

    E.g. I have a small program uploaded which:

    1. Sets up I2C1
    2. Loads SSD1306 library and initializes the OLED (connected via I2C)
    3. Prints text on the OLED. This works 100%. The OLED is initialized and text appears.
    4. Supposed to print more every second (via setInterval()). That does work once in about 10 times.

    In the cases where it does not work, the serial console is usually no longer working until I reset the board. In the few cases where the console is accessible, I can connect via minicom, and I see nothing being remembered of my program. Looks like a reset happened. Namely the variable g I use for the OLED is not defined anymore. No wonder it cannot write anything to the display.

    The Web IDE works. Always.

    Any idea what's causing the NPM espruino to not work as well as the Web IDE?

    Harald

  • in General
    Avatar for HaraldK

    Nah, it's generally a problem and it seems to be because I'm in Japan.

  • in General
    Avatar for HaraldK

    PayPal for whatever odd reason, doesn't like donations when you (resp. me) are in Japan. So button or not, no donations from me. Instead I bought some Pucks from the Tindie store.

  • in Interfacing
    Avatar for HaraldK

    ROR is ROtate Right. ROL is ROtate Left.
    Difference to a normal shift is that in a shift all bits move one bit position. The leftmost in a shift left or rightmost in a shift right usually gets a 0.
    In a rotation the bits move in a circle: in a left shift bit 7 moves into bit 0.
    See here: https://en.wikipedia.org/wiki/Bitwise_opĀ­eration#Rotate_no_carry

Actions