Espruino with Glediator & LED matrix #901
Replies: 37 comments
-
Posted at 2015-11-16 by @gfwilliams Well, I think the main one is that Espruino's 'console' works over the same USB connection as you're trying to send data on, so you want to move it out of the way. Maybe try When you do that you might want to avoid using You are also printing quite a lot of data - I guess it's for debugging, but that could slow things down a lot. To help you out, you might want to get a USB-TTL converter and attach it to Serial1 (B6/B7 on the Pico). You can then interact with the Pico and debug it while using the USB connection to receive data. ... or you can do it the other way (might be easier to debug) - send the data from Glediator to the USB-TTL converter on Serial1, and then keep using USB to uploading code and debugging. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-16 by Owen I do have a USB-TTL converter, I'll give that a good tonight after work. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-16 by Owen I've tried a few different things but nothing fully working yet. I've confirmed that serial data is being correctly sent out of the PC, Espruino just can't seem to read it. After running my test code .on('data' still isn't receiving anything. As a basic test I tried the following code with nothing connected and the results are strange, am I doing something wrong?
After uploading code:
Nothing is outputted? After entering save():
Serial3 is outputted but not the "Hello world" |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-17 by @gfwilliams I'm not quite sure I understand. You'd expect Or you've left C10/C11 completely disconnected and you were expecting things to be echoed back? It might be worth trying:
That'll make sure that if there are nonprintable characters, they get escaped so you can see them. Are you using an up to date (1v81) firmware? Some of the older ones had issues with Serial3/4. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-17 by DrAzzy Can you confirm that serial is seeing sensible data? maybe console.log(line); in there? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-17 by Owen I've tried console.log(line) but when Serial3 is being sent data USB don't respond. The only time I got something back from Espruino it was a "Out of memory" warning. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-17 by Owen Maybe it's not an issue with detecting the line ending but rather then matrix encoding. Do you know what format SPI2.send4bit() expects? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-18 by DrAzzy It expects an array of bytes which are to be sent. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-18 by Owen Using an SD card I saved the raw data of "line" to a file and have attached it here. Does it make any sense to anyone?Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-18 by @gfwilliams The 'out of memory' error sounds like you're not getting a newline, so are just making a huge string with all the data from multiple frames? Actually, if you look at that Arduino file you sent, it seems to me like it's sending binary data and is using a simple Try:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-18 by @gfwilliams Just to add that you could also be having some electrical issues if you get flickering - I think there's a note on the WS2811 page about using a pullup resistor and putting SPI into Open Drain mode? It might be needed if you're running the panel off a separate 5v supply. ... finally I don't know if Glediator handles the zig-zag pattern of the LEDs? It could be a pain to try and re-order them quickly. About the only thing I can think is to use |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-18 by Owen Success! You're a genius Gordon \1 was it! It works perfectly and with great frame rates. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-19 by @gfwilliams Wow, that works well! So is your finished code literally just what was posted above? And glediator handles the zig-zag automatically? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-19 by Owen I had a to change a few little bits. For example I had to remove the call to onInit(); other wise the serial on(data) was getting fired twice on boot which messed up the output.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-09 by Owen Hi Gordon,
This outputs the following:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-09 by @gfwilliams The first thing I noticed was you changed:
to
Obviously that's going to change the value of |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-09 by Owen I changed that because idx will always been greater than -1 after the first loop because it's get added the value of bufIdx. The output now is a very low number of idx, basically every bit of data received. The fps count jumps way up to over 200. See the example output below:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-09 by @gfwilliams Please can you change console.log so it outputs buf.length and line.length as well? And can you paste up the code you used and the results? It'd be handy to see the data that was in Also, do you still get the FIFO_FULL errors? It might be that even with this, you still have the same problem. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-09 by Owen I've attached the exact code I used and below is the console output.
With the attached code "line" is only 4 bits in length;
Using the original working code I managed to get a complete frame of data in line which I've pasted below.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-11 by @gfwilliams I'm not sure the code is attached - please could you try to attach it again? And sorry - when I said |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-11 by Owen Here is the full output for two seconds: http://pastebin.com/M5Gien3D
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-12 by @gfwilliams So it works if you lower the data rate? Is it possible to just lower the Baud rate on Serial then? Also, if you remove the print statements, that should help a lot. The Pico has a 512 byte input buffer I think - I guess it's possible that so much data is arriving while the last data is being sent to the LEDs that it gets full up... 150 pixels * 24 bits = 3600, and each bit takes 1.25us to send, so that's 4.5ms. If you're receiving data at 1000000 baud then that's 100,000 bytes/sec, so in 4.5ms you're receiving 450 bytes. Add some overhead for executing JS and you're dangerously close to overflowing that buffer... So the solution would either be to:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-12 by Owen The slowest baud-rate Glediator has is 115200 which might still be too fast. If I could get Glediator to pause after each frame to allow Espruino to shift out the data it might work better but I don't think that's possible. You can't even limit the frame-rate from Glediator which may also be causing problems. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-12 by @gfwilliams 115200 would be a huge help - the maximum frame rate Glediator could send over that would be 51fps (20ms), but it only takes 6.75ms to send it to the LEDs - so I think you stand a good chance with that. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-12 by @gfwilliams You could also try using USB, rather than serial. USB has some rate-limiting built in, so you shouldn't have the FIFO_FULL error. To do USB, you just swap |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-13 by Owen Success! I've got it running the full 225 pixels at 25fps! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-04-13 by @gfwilliams Great! You can always do something like:
So if you've saved and want to debug again, you can just plug the board in with the button pressed down, and you'll get access to the console again. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-11-26 by user69728 Hi Owen, could you post the finished code? I am just starting with Espruino, LED Matrix projects and glediator, it would be wonderful not to reinvent the color wheel :-) Thanks! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-11-30 by Owen Hi,
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-15 by Owen
I'm trying to use Espruino as the controller to take LED matrix data from the Glediator over USB and output it onto an RGB LED matrix.
The Matrix is made up on 16x8 WS2812B pixels. I've attached the example code from Glediator for using an Arduino as the controller which I've tried ported to JS (see below).
I've tried using the example USART code from here: http://www.espruino.com/USART along with other code I found on the forum but so far nothing has worked. Is there something I'm missing in the code below? I'm unsure if data is being received but Espruino as I can't connect while data is being sent to check.
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions