You are reading a single comment by @Ollie and its replies. Click here to read the full conversation.
  • EDIT: Note all of the following actually had no bearing on issue. In end reflashing to the same firmware appears to have sorted it.

    @Gordon thanks for coming back on this thread, I'll try and explain what I mean. As I understand it the AT module wraps serial. So I've got two test functions now, one that is sending AT commands directly using Serial2 and another using the AT module.

    The first function (Serial2) and some calls with commented returns is/are below.

    Note the return on ATE0, but that's another story, though I'm starting to disagree :D

    // Serial Tests
    var serialTest = function(cmd, timeout) {
      var l = "";
      Serial2.setup(115200, { rx: A3, tx : A2 });
      Serial2.on('data', function(d) {l+=d;});
      Serial2.write(cmd + "\r\n");
      setTimeout(function() {console.log(l);}, timeout);
    };
    
    serialTest("ATE0", 1000); 
    // ATE0
    // no this fun
    
    serialTest("AT+CIPMUX=1", 1000);
    // AT+CIPMUX=1
    // OK
    
    serialTest("AT+CWMODE=1", 1000);
    //AT+CWMODE=1
    //no change
    
    serialTest("AT+CWJAP=\"xFxxxS\",\"xxebxx­x\"", 1000);
    //AT+CWJAP="xxxxxx","xxxxxx"
    //OK
    
    serialTest("AT+CIFSR", 1000);
    //AT+CIFSR
    //192.168.1.16
    
    serialTest("AT+CWLAP", 5000);
    //AT+CWLAP
    //+CWLAP:(0,"",0)
    //+CWLAP:(3,"Orxxxalign",-54)
    //+CWLAP:(4,"BIOxxxAMD",-83)
    //+CWLAP:(3,"CxxDUK",-52)
    //+CWLAP:(0,"CDxxUK-GxxUEST",-52)
    //+CWLAP:(4,"waxxdaroxxxWAP1xxx2ice",-64­)
    //CWLAP:(4,"Laxxxxxp",-67)  
    //etc
    

    Trying to test the AT module command at.cmd i have the test function below plus the calls and commented returns. Always one line whatever timeout is set. Never anything else.

    // AT Test
    Serial2.setup(115200, { rx: A3, tx : A2 });
    var at = require("AT").connect(Serial2);
    var atTest = function(cmd, timeout) {
      at.cmd(cmd + "\r\n", timeout, function(d) {
        console.log(d);
      });
    };
    
    atTest("ATE0", 1000); 
    // ATE0
    
    atTest("ATE0", 10000); 
    // ATE0
    
    atTest("AT+CIPMUX=1", 1000);
    //AT+CIPMUX=1
    
    atTest("AT+CIPMUX=1", 10000);
    //AT+CIPMUX=1
    
    atTest("AT+CWMODE=1", 1000);
    //AT+CWMODE=1
    
    atTest("AT+CWMODE=1", 10000);
    //AT+CWMODE=1
    
    atTest("AT+CIFSR", 5000);
    //AT+CIFSR
    
    

    When I added a few logging statements in the ESP module I downloaded and have locally I could see that in all cases I tested d was being evaluated against something that in the serial function is on the second line, but using AT it actually contained the first/only line (the command) - i.e AT+CIPMUX=1 != OK

    I doubt that has clarified things much, and it's fair to say I'm a bit out my depth here, so please tell me if I'm muddying the water ;) but I suppose the question I'm posing is why am I ok using Serial2 but not the AT module which wraps Serial. Is there an issue in there?

About

Avatar for Ollie @Ollie started