Sorry to reopen topic but I think it's the best place. Since my last post here I've built a much bigger RGB LED matrix (15x15) and beginning to run into some serial data issues.
On my 15x15 board I can easily output the first 168 pixels but any more and it all goes wrong. I'm not sure if this is an issue with Glediator, USB2Serial, Espruino reading the serial data or Espruino outputting the SPI data?
I don't believe Espruino is the issue but I'm really not sure what is. The code below does the same as above but outputs the "line" length (the graphic SPI data). For 15x15 it should always be 675 but rarely is..
function onInit() {
SPI2.setup({baud:3200000, mosi:B15});
var cmd = "";
Serial1.setup(1000000, {tx:B6,rx:B7});
Serial1.on('data', function (data) {
cmd+=data;
var idx = cmd.indexOf("\1");
while (idx>=0) {
var line = cmd.substr(0,idx);
cmd = cmd.substr(idx+1);
idx = cmd.indexOf("\1");
console.log(line.length);
SPI2.send4bit(line, 0b0001, 0b0011);
}
});
}
675 only appears a couple of time while 504 appears many but again there are lots of other seemly random lengths.
Is the problem the serial data that's being sent from Glediator or the way I'm detecting a new frame "\1" ?
Let me know if there is anything I can try to debug this or if the magic length 504 means anything? Thanks
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.
Sorry to reopen topic but I think it's the best place. Since my last post here I've built a much bigger RGB LED matrix (15x15) and beginning to run into some serial data issues.
On my 15x15 board I can easily output the first 168 pixels but any more and it all goes wrong. I'm not sure if this is an issue with Glediator, USB2Serial, Espruino reading the serial data or Espruino outputting the SPI data?
I don't believe Espruino is the issue but I'm really not sure what is. The code below does the same as above but outputs the "line" length (the graphic SPI data). For 15x15 it should always be 675 but rarely is..
And the console returns:
675 only appears a couple of time while 504 appears many but again there are lots of other seemly random lengths.
Is the problem the serial data that's being sent from Glediator or the way I'm detecting a new frame "\1" ?
Let me know if there is anything I can try to debug this or if the magic length 504 means anything? Thanks