-
-
-
-
-
Hi, Gordon, Hi all!
It's me again.
I have some question to community.
STM323F4 includes USB-COM to connect with PC.
But I did not get to use this feature.
Now I'm use external USB-COM converter.
Converter connected to pins {rx:A3,tx:A2}.My working code:
Serial2.setup(9600, {rx:A3,tx:A2});
Tried to use:
USB.setup(9600);
and
USB.setup(9600, {dm:A11,dp:A12});
Can I use internal converter? How can I do this?
-
-
-
-
SUCCESS (9600 baudrate)
Before transmitting the file (400 bytes) process.memory() returns:
{"free":5296,"usage":154,"total":5450,"history":134,"stackEndAddress":536984008,"flash_start":134217728,"flash_binary_end":1ERROR (9600 baudrate)
After transmitting the file (400 bytes) process.memory() returns:
{"free":58,"usage":5392,"total":5450,"history":1,"stackEndAddress":536984008,"flash_start":134217728,"flash_binary_end":134413196,"flash_code_start":135135232,"flash_length":1048576}SUCCESS (115200 baudrate)
After transmitting the file (2 528 bytes) process.memory() returns:
{"free":1195,"usage":4255,"total":5450,"history":140,"stackEndAddress":536984008,"flash_start":134217728,"flash_binary_end":134413196,"flash_code_start":135135232,"flash_length":1048576} -
Error:
0) send 1) send 2) send 3) send 4) send 5) send 6) send 7) send 8) send 9) send 10) send 11) send 12) send 13) send ... ... ... 126) send 127) send 128) send 129) send 130) send 131) send 132) send ERROR: Out of Memory! WARNING: Unable to create string as not enough memory ERROR: Out of Memory! ERROR: Out of Memory! WARNING: Unable to create string as not enough memory ERROR: Out of Memory! ERROR: Out of Memory! WARNING: Unable to create string as not enough memory ERROR: Out of Memory! ERROR: Out of Memory! WARNING: Unable to create string as not enough memory ERROR: Error processing Serial data handler - removing it. Execution Interrupted during event processing. at line 3 col 18 process.memory(); in function called from system WARNING: String buffer overflowed maximum size (512) WARNING: String buffer overflowed maximum size (512) ... ... ... WARNING: String buffer overflowed maximum size (512) WARNING: String buffer overflowed maximum size (512) WARNING: String buffer overflowed maximum size (512) ERROR: Out of Memory! ERROR: Out of Memory! ... ... ... ERROR: Out of Memory! ERROR: Out of Memory! Execution Interrupted during event processing. at line 2 col 18 if (arr == null) return; in function called from system { "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" >
-
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" }
}
I helped Andrey change project to fix this.
1) In \Espruino\targets\linux\jshardware.c we cut function
to
2) In \Espruino\targets\mbed\jshardware.cpp
to
3) In \Espruino\targets\stm32\jshardware.c
to
We have a working result. Thank you!