• Hi, Gordon, Hi all!
    Working with the board STM32F4.
    I have a problem when I try to transfer file from PC to UART (pins PA2, PA3).
    If the file size small (less 200 bytes) all is well.
    If the file size a bit more, then sometimes console shows the error memory.
    If the file size like 2000 bytes, then always console shows the error memory.

    I try change baudrate of UART from 9600 to 115200, and have a successful file transfer size in 2 528 bytes. But after a few hours situation with the problem persists.
    STM32F4 has a lot of memory. Why this error occurs?

    My project:

    var LED_ORANGE = LED1;
    var LED_GREEN  = LED2;
    var LED_RED    = LED3;
    var LED_BLUE   = LED4;
    var arr = null;
    
    
    function Toggle_Led(LED) {
     on = !on;
     digitalWrite(LED, on);
     return 1;
    }
    
    function Show(str) {
      console.log('**' + str);
    }
    
    function Thread1() {
      Toggle_Led(LED_ORANGE);
    
    }
    
    var Counter = 0;
    Show("Start!");
    
    
    // Тест UART
    //==================================================================
    Serial2.setup(9600, {rx:A3,tx:A2});
    //USB.setup(9600, {dm:A11,dp:A12});
    Serial2.on('data', function (data) {  // Receive function
      console.log(Counter + ") send");
      process.memory();
      if (data.length > 0) {  
        digitalWrite(LED_GREEN, 1);
        //console.log(data + "\n");
        
        if (arr == null)  {
          arr = new Array();
        }
        arr.push(data);          // Add new element
    
        // Таймаут приёма
        //==============================================================
        setTimeout(function (e) {
          if (arr == null)  return;
          //for (var i=0; i<arr.length; i++)
          //{
          //  console.log(arr[i]);
          //}
          var str = arr.join("");
          console.log(str);
          
          arr = null;
          Serial2.println(str);        // Send
          
          digitalWrite(LED_GREEN, 0);
          digitalWrite(LED_RED, 0);
        }, 5000);
        //==============================================================
      } else {
        digitalWrite(LED_RED, 1);
        console.log("Bad");
      }
      
      Counter++;
    });
    //==================================================================
    
    
    
    setInterval(Thread1,3000);
    Show("Stop!");
    save();
    
    
    

    My File:
    {

    "crosstime": {
        "1": [
            1, 
            10, 
            3, 
            3
        ], 
        "2": [
            1, 
            10, 
            3, 
            3
        ], 
        "3": [
            1, 
            20, 
            3, 
            1
        ]
    }, 
    "racks": {
        "1": {
            "1": 1, 
            "2": 1, 
            "3": 0, 
            "4": 0, 
            "5": 5, 
            "6": 5
        }, 
        "2": {
            "1": 2, 
            "2": 2, 
            "3": 0, 
            "4": 0, 
            "5": 5, 
            "6": 5
        }, 
        "3": {
            "1": 1, 
            "2": 1, 
            "3": 0, 
            "4": 0, 
            "5": 5, 
            "6": 5
        }, 
        "4": {
            "1": 2, 
            "2": 2, 
            "3": 0, 
            "4": 0, 
            "5": 5, 
            "6": 5
        }
    }, 
    "groups": {
        "1": {
            "1": [
                1, 
                3, 
                4, 
                5
            ], 
            "2": [
                2, 
                2, 
                2, 
                2
            ], 
            "3": [
                2, 
                2, 
                2, 
                2
            ]
        }, 
        "2": {
            "1": [
                2, 
                2, 
                2, 
                2
            ], 
            "2": [
                1, 
                3, 
                4, 
                5
            ], 
            "3": [
                2, 
                2, 
                2, 
                2
            ]
        }, 
        "3": {
            "1": [
                2, 
                2, 
                2, 
                2
            ], 
            "2": [
                2, 
                2, 
                2, 
                2
            ], 
            "3": [
                2, 
                3, 
                4, 
                2
            ]
        }
    }, 
    "desc": {
        "note": "\u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0441\u0432\u0435\u0442\u043e\u0444\u043e\u0440 \u0438\u0437 3 \u0433\u0440\u0443\u043f\u043f \u0438 3 \u0444\u0430\u0437.", 
        "phases": "3", 
        "name": "\u0422\u0435\u0441\u0442", 
        "groups": "3", 
        "addr": "\u0421\u0442\u0435\u043d\u0434"
    }
    

    }

About

Avatar for user7265 @user7265 started