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();
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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:
My File:
{
}