Avatar for user109783

user109783

Member since Feb 2020 • Last active Jun 2021
  • 19 conversations
  • 32 comments

Most recent activity

  • in Other Boards
    Avatar for user109783

    The board ran for months, but someday the codes in flash disappeared, and the board died.
    How and Where I can figure out the key problem?

  • in Other Boards
    Avatar for user109783

    Yes, the reset pin can help this issue. Or restart the power of the device can also reset the W5500. But this issue will happen in a few minute again.

  • in Other Boards
    Avatar for user109783

    I used wiznet 5500 for tcp connection, but sometime I didn't know why it stopped. And then I tried to reset system, but the socket not avaiable still exiested. I had to power off the board then the wiznet work fined agnin.

    How to reset WIZnet 5500 while socket is not available?

    No free sockets found

    This is my code, and run on the board STM32F4DISCOVERY

    let WIZnet = require("WIZnet");
    let st = require("Storage");
    let WebServer = require('WebServer');
    let ip = "192.168.1.238";
    let gateway = "192.168.1.1";
    let eth = null;
    
    
    E.on('init', function () {
        SPI2.setup({mosi: B15, miso: B14, sck: B13});
        eth = WIZnet.connect(SPI2, B12);
        setTimeout(function () {
            eth.setIP({ip: ip, gateway: gateway, subnet: "255.255.255.0",dns:"8.8.8.8"});
            console.log("ip", eth.getIP());
            startServer();
        }, 1500);
    });
    
    function startServer() {
        var webs = new WebServer({
            port: 8080,
            file_system: '/var/www/',
            memory: {
                'index.html': {
                    'type': 'text/html',
                    'content': '<html><head><script src="index.js"></script></head><body>' +
                        '<p>Hello from in memory HTML!</p>' +
                        '<br><button onclick="hello()"> Run client side JavaScript</button>' +
                        '<br><br><button onclick="window.open(\'index.njs\', \'_top\')"> Run server side JavaScript</button>' +
                        '<br><br><button onclick="window.open(\'index.txt\', \'_top\')"> Go to a simple text</button>' +
                        '<br><p align="right"> <small>Espruino WebServer</small> </p>' +
                        '</body></html>'
                },
                'index.txt': {
                    'content': 'Hello from in memory text!'
                },
                'index.js': {
                    'type': 'application/javascript',
                    'content': "function hello(){ alert('Hello from in memory client side javascript'); }",
                },
                'index.njs': {
                    'content': index_njs
                },
                'favicon.ico': {
                    'type': 'image/x-icon',
                    'content': "\0\0\x01\0\x01\0\x10\x10\x10\0\x01\0\x0­4\x00\xf0\0\0\0\x16\0\0\x00\x89PNG\x0d\x­0a\x1a\x0a\0\0\0\x0dIHDR\0\0\0\x10\0\0\0­\x10\x08\x06\0\0\0\x1f\xf3\xffa\0\0\x00\­xb7IDAT8\x8d\xa5S\xc1\x0d\x03!\x0csN\xb7­\x91w\xcaP\xde)3\xd1G\x09\x0a\x85\xab\xa­8\xea\x0f\x02\x82c\x1b0\x92x\x82\xbb\xb7­:\x8f\x08D\x84\xd5\xb5\x1b\x00H\xb6>N\x0­4uN\x12\x92\x10\x11S\xcd]\x0b\xbf\xa9\xe­9\x8a\x00\xa0I\x1a*\x06A\x97\xb7\x90\xd4­\x8e$A\x12\xee\xde\xb2vR\x90$\xc8q\xf6\x­03\xbc\x15Ldw]\x88zpc\xab*\x8c\x08H\xb2A­\x90\x1e\x97\xce\x1bd3\x00\xb8v\x9b\xa7p­\xf7\xb6\x10\x9cb\xc9\xe0Wd\x06\x17\x80v­\xe2\xfb\x09\x17\x00H\xfa\x8b\xc0\xba\x9­c\xe3CU\xf1\xc8@\xd2\x08fW\xf8i3?U\x12\x­18z\x16\xf5A\x9ddc_\xee\xbd~e{*z\x01|\xc­dnfT\x03\x0an\0\0\0\x00IEND\xaeB`\x82"
                }
            }
        });
    
        webs.on('start', function (WebServer) {
            console.log('WebServer listening on port ' + WebServer.port);
        });
        webs.on('request', function (request, response, parsedUrl, WebServer) {
            console.log('WebServer requested', parsedUrl);
        });
        webs.on('error', function (error, WebServer) {
            console.log('WebServer error', error);
        });
    
        webs.createServer();
    }
    
    function index_njs(req, res, uri, webs) {
        return {
            type: 'text/html',
            content: '<html>' +
                '<p>Hello from in memory server side javascript!</p>' +
                '<p><b>Espruino Memory Usage: </b><br>' + JSON.stringify(process.memory()) + '</p>' +
                '<p><b>Espruino Flash Usage: </b><br>' + JSON.stringify(require('Flash').getFree(­)) + '</p>' +
                '</html>'
        };
    }
    
    // setInterval(function () {
    //     eth.getIP();
    //     startServer();
    // }, 5000);
    
  • in Other Boards
    Avatar for user109783

    When I first time visited the device like this, http://192.168.1.111
    Ok,no matter how I pressed the F5 button for refreshing, the connection was ok.
    But when I write a new website like: http://www.google.com and then press the back history for visiting the http://192.168.1.111 again, it failed, the browser rejected for visiting, maybe the device did.

  • in Other Boards
    Avatar for user109783

    The page I load is very simple and little cotent, I just press the F5 for refreshing the website, but somehow the server reject for connecting.

    And I invoked WIZnet.getStatus(), it was still working.

    {
      state: "online",
      id: "W5500",
      phylink: "up",
      phypowmode: "normal",
      by: 0, mode: 1, speed: 100, duplex: 0 }
    

    But when I visit website by http://ip , the browser reject like this: ERR_CONNECTION_REFUSED

  • in Other Boards
    Avatar for user109783
    function pageRequest(req, res) {
      res.writeHead(200);
      res.end("Hello World");
    }
    require("http").createServer(pageRequest­).listen(8080); // port 8080
    

    The code like this, when the borad work, it's ok for visiting the pages which the server supply at the very first time. But when I jump for the other websites and visit back via return history of browser, the server stop. I can't visit the server website again. I have to invoke load() for restart then I access the server again.

    How to Keep web server working for long time?

Actions