32x32 led matrix with de0-nano - Page 1
Forum section: electronics / general

author: Rigby
author_rank: Super Contributor
timestamp: August 28, 2014, 06:54:50 pm
content: Hi,I've got a few 32x32 LED matrices from Adafruit, and have been through their 32x16 FPGA howto. It runs, in a way, on my 32x32 matrices, but of course it doesn't look right.Is there anyone with one of these 32x32 matrices and an Altera FPGA in-hand that can offer me some guidance on how to make it work with these?The changes that need to be done to the existing VHDL:* 3 address lines to 4, with appropriate wiring change* 2x8 scan to 2x16I believe I have the first of these changes completed, and I am unsure about how to make the second.The code as I got it from Adafruit is here:https://github.com/adafruit/rgbmatrix-fpgaand it works on my matrices, except instead of drawing 16 contiguous rows, it draws the top 8 rows, then a gap of 8 rows, and then the bottom 8 rows followed again by a gap of 8. Making the first of those listed changes indeed allows the FPGA to draw on all 32-rows, and because I haven't made the 2nd change, all I see is garbage.I've scoured the Internet pretty well and I'm unable to find anyone that's adapted this code for the 32x32 matrix. I imagine it is an easy change to make, I'm just not there, yet.Anyone care to help? thanks.

author: miguelvp
author_rank: Super Contributor
timestamp: August 29, 2014, 12:48:47 am
content: Alvaro Lopes did some code for the Papilio Pro (Xilinx but that shouldn't matter) to drive 2 displays using the ZPUinoHe mentioned he will post the code but not sure when or where.This was shown in the updates for the Papilio Duo Kickstarter:https://www.kickstarter.com/projects/13588168/papilio-duo-drag-and-drop-fpga-circuit-lab-for-mak/posts/882177https://www.kickstarter.com/projects/13588168/papilio-duo-drag-and-drop-fpga-circuit-lab-for-mak/posts/884233Maybe he will post it on his site:http://www.alvie.com/zpuino/index.htmlHasmter_nz might know where Alvaro's sample code lives.

author: miguelvp
author_rank: Super Contributor
timestamp: August 29, 2014, 12:56:01 am
content: Also I found this:http://bikerglen.com/blog/driving-a-32x32-rgb-led-matrix-with-a-beaglebone-black-and-an-fpga/It has source code that seems to come from sparkfun (at least the matrix code) in Veriloghttps://github.com/bikerglen/beagle/blob/master/projects/led-panel-v01/fpga/rtl/matrix.v

author: Rigby
author_rank: Super Contributor
timestamp: August 29, 2014, 04:59:48 am
content: Thank you.I can't make much of the Verilog, it seems so much more unorganized than the VHDL I am trying to work with. I'll give it some more time and see if I can start to wrap my mind around it more.

author: Rigby
author_rank: Super Contributor
timestamp: September 02, 2014, 03:40:59 am
content: Got it working with the original code I had, and I even got it to draw across two panels successfully. three panels is proving a challenge, though; it seems the time it takes to send the pixels to all three panels is more time than the boards will actually hold the LEDs on, so I get 3 panels worth of data cycling across all three panels, which gives me a headache nearly instantly.Turning the output clock up to a certain point does help (that's what got me to two panels) but I can't seem to raise it high enough to get 3 panels playing nicely.more tinkering...

author: Rigby
author_rank: Super Contributor
timestamp: September 11, 2014, 06:38:49 pm
content: got this working a few days ago.Part of the problem was the color data I was sending, part of the problem was some tweaks I'd made in the VHDL. Those VHDL changes were reverted and now I can send images to the panels and see them.Now for the tweaking.The gamma on these panels is absolutely nutty. They have a gamma of 1/8 or something insane like that. A LED driven white for 1/256 duty cycle has about 50% apparent brightness. this makes the dynamic range very small and is just a difficult problem to think about, for me.I saw on one of Mike's videos where he has an annotation describing how to modulate brightness evenly among subframes using an 8-bit accumulator (presumably for 8-bit per color channel) and I'm wondering if anyone has an example of this code? I think I get what's going on, but I'm not sure. It's an 8-bit adder with carry, where the result of the previous operation is used as the 2nd operand for the current calculation, yes? The intended brightness is the first operand in the adder. When it overflows, light the LED; when it doesn't, don't. I can do this in C or Java easily enough, VHDL is eluding me at the moment.I can also I think safely assume that if I use 4 bits of color per channel that I need 4 bit accumulators, for example.Another problem:Driving the panels with a 25MHz clock at 24-bit color (8-bits per channel) causes a visible (31Hz) refresh at just 3 32x32 panels, and I'm looking to drive 6 panels. 24-bit color is out.Any ideas about speeding things up, while keeping apparent color-depth as high as possible?Thanks!

author: AndyBadger
author_rank: Newbie
timestamp: October 16, 2014, 04:23:19 pm
content: Can you post your changes. I am only getting two lines and a bad refresh rate.Andy

author: Rigby
author_rank: Super Contributor
timestamp: October 16, 2014, 04:32:09 pm
content: Yeah, gimme a few minutes.Are you sure your wiring is correct? Can you take a picture of what you're seeing?

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 16, 2014, 04:35:07 pm
content: Quote from: Rigby on September 11, 2014, 06:38:49 pmThe nice thing about FPGAs is you can duplicate stuff easily.Don't try to drive 6 panels from one bus - run multiple feeds - 2 sets of 3 or 3 sets of 2.I've never seen an RGB panel with more than a 16:1 row muxrate, 32x panels are usually two 16 panels with seperate data inputs for each half

author: Rigby
author_rank: Super Contributor
timestamp: October 16, 2014, 04:39:42 pm
content: It's a single panel but it's wired internally like two 32x16 panels. You have to add the 'd' address line in the VHDL which is pretty easy, then if you change the color depth, the processing sketches require a bit of work.Lately, I'm working on doing delta sigma PWM rather than the inherently terrible method used currently.I'm still too new to know how to duplicate the hardware in the FPGA properly, and I don't know how to send the correct imagery to the correct instance of the panel driver hardware yet, either.Getting there, though.

author: Rigby
author_rank: Super Contributor
timestamp: October 16, 2014, 04:43:01 pm
content: Quote from: AndyBadger on October 16, 2014, 04:23:19 pmI don't have the wiring documented, and I don't have my processing sketch changes here, but this will help you adjust the VHDL for the 32x32 panels:https://github.com/naikrovek/rgbmatrixtop_level.vhdl, ledctrl.vhdl, and config.vhdl contain the changes. Adding a 'd' address select line and widening the address bus from 3 bits to 4.You'll also have to modify the pin assignments and add 'd' to an output pin. IIRC, I used PIN_E9, which is GPIO_021 on the DE0-Nano.If you have a panel with two separate input and two separate output connectors, that's different entirely, and shouldn't require any changes to the VHDL.

author: miguelvp
author_rank: Super Contributor
timestamp: October 16, 2014, 05:02:39 pm
content: Now you made me get one from Sparkfun since they still honor their promo code FALL2014 for $10 off for $20 or more purchases.So pretty much I get free shipping for qty 1 if it was 2 then it would be $10 off for each so just got one.https://www.sparkfun.com/products/12584

author: AndyBadger
author_rank: Newbie
timestamp: October 16, 2014, 05:14:23 pm
content: I will check it out later tonight. Thanks!

author: Rigby
author_rank: Super Contributor
timestamp: October 16, 2014, 07:59:18 pm
content: Quote from: miguelvp on October 16, 2014, 05:02:39 pmI got all mine from Adafruit, BEFORE they lowered the price $30 per panel... bit miffed about that. The last batch I bought are ENTIRELY different from the first couple of batches, which also peeves me a bit. The new ones reverse G1 & B1, and G2 & B2, which means I can't put them in the same string as the first sets I have without modifying a cable (not a big deal, really) but I wouldnt put them in the same screen/string anyway because the color rendering is SO MUCH WORSE on the most recent ones I purchased.Going to probably buy from aliexpress.com from now on, for the panels, if I buy more.I spent well over $3k with Adafruit this year, and I'm pissed I got those crappy panels. I'm torn between being pissed because they're not what I expected and being OK with it because it was my employer's money, not mine. I should demand they replace them, and on the other hand I don't wanna bother them with it. Every other purchase I made with them was perfection in a box delivered to my door...

author: Rigby
author_rank: Super Contributor
timestamp: October 16, 2014, 09:01:48 pm
content: Quote from: AndyBadger on October 16, 2014, 05:14:23 pmYou're welcome. Don't forget the ground wire! The adafruit tutorial fails to mention that the ground wire should be connected; it assumes you know this and that you know where to hook it up.

author: SirNick
author_rank: Frequent Contributor
timestamp: October 16, 2014, 10:43:24 pm
content: Well, bear in mind:QuoteI bought a few of the 32x16 panels. First pair had screw terminals for power, and through-hole capacitors. Second pair had a 4-pin plug for power, SMD caps, and magnetic screw mounts. They look pretty much identical to me, but I'm not displaying video -- just simple spectrum analyzers driven by an ATmega.

author: Rigby
author_rank: Super Contributor
timestamp: October 17, 2014, 12:39:13 am
content: I wouldn't mind about the connections, provided the same SMD led parts were used between panels. Some have a perfectly transparent lens, the latest have a very yellow cloudy window, making the overall color pretty green and much dimmer than the other panels. They're shit.

author: ttt
author_rank: Regular Contributor
timestamp: October 17, 2014, 03:40:18 am
content: Quote from: Rigby on September 11, 2014, 06:38:49 pmI've done a project with these panels. A gamma value of 2.5 has worked very well for me so far. I put that in a table and drive my PWM based on that. The trick is that for very low values you need to be fairly accurate otherwise you get some nasty color banding. In my project I interleave the PWM/gamma handling with driving the LED panel so that at very low values the LEDs are only on for a few microseconds.Source code, pictures and demo video:https://github.com/tinic/rgb-led-panel-signI drive 8 panels with a single BeagleBoard Black at >60fps using both PRUs, no FPGA. The video data is simply piped from ffmpeg into my PRU feeder tool.Quote from: Rigby on September 11, 2014, 06:38:49 pmJust one suggestion: use dithering if you want to go that low.Quote from: Rigby on September 11, 2014, 06:38:49 pmI've had the same limitation with the BeagleBone, it starts to run at about 25Hz at 24bit for me which is of course very visible. With 8 panels.But 18bit stills looks very good if you apply a bayer dither and get the PWM/gamma timing just right. Look in the main.cpp file in the above project for a bayer 16x16 dithering table if you need one. Also, if you do any sort of animation you want to do some interlacing, i.e. do even rows first and then odd, while refetching the main frame buffer after each half picture. This cuts down on tearing quite a bit.I like these panels a lot and I am thinking how to extend mine to 8x2x32x32 :-)

author: Rigby
author_rank: Super Contributor
timestamp: October 17, 2014, 12:07:25 pm
content: That is all excellent information, thank you so much.Your workbench looks excellent, by the way. Envy!

author: miguelvp
author_rank: Super Contributor
timestamp: October 22, 2014, 09:25:49 am
content: I got my panel and since I was playing with the PSoC and there was a 32x16 demohttp://www.element14.com/community/message/84683/l/psoc-4-pioneer-kit-community-project060I tweaked it and got it to use the whole 32x32 I still have some repeated rows but should be easy to fix.The LED Matrix component from the example has a clock of 48MHz not sure how often the interrupt gets called, but I'll keep on playing with this. (the chip driving it is a $1 one from when they had the discount).

author: Rigby
author_rank: Super Contributor
timestamp: October 22, 2014, 03:52:16 pm
content: Those panels are so great. On AliExpress those are called "P6" or "PH6" panels, 6mm being the led pitch. I want to get some of the P3 variety and see how they look.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 22, 2014, 03:58:53 pm
content: Quote from: Rigby on October 22, 2014, 03:52:16 pmI have some 3 and 2.5mm panels, which look really nice. 3mm are pretty common now and can be had for less than $50 (2.5 cents per LED FFS!) 2.5 rather more expensive, but becoming more common2mm pitch panels exist but I've yet to find anywhere that will sell singles (Apollomi on Aliexpress list them but are a bunch of crooks - I ordered one, they sent a 3mm one then claimed it was the same as it had the same dimensions. Eventually got a partial refund via Aliexpress dispute but still way out of pocket from duty etc.)

author: Rigby
author_rank: Super Contributor
timestamp: October 22, 2014, 04:00:47 pm
content: I haven't been able to order anything from aliexpress yet since they keep wanting to investigate my CC info and have me prove I own the card. Annoying.

author: Rigby
author_rank: Super Contributor
timestamp: October 22, 2014, 04:02:02 pm
content: Do you recommend a good seller or panel for 3mm stuff? There are so many sellers and so many pics, and I REALLY don't want any of the junk I got from Adafruit in this last order I got from them.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 22, 2014, 05:02:25 pm
content: Quote from: Rigby on October 22, 2014, 04:02:02 pmI've had a few 3mm panels from a few suppliers without issues (apart from the ones that should have been 2mm).My only reccommendation is read feedback messages carefully - ignore ratings & numbers of stars etc., and Don't rely on Aliexpress's dispute resolution to help.A lot of Aliexpress sellers are just brokers, who order stuff when they get orders - I've often had orders get cancelled after a week or two, and although you get a refund, if your card account is not in US$ you may still lose due to currency fluctuation and foreign transaction charges.

author: Rigby
author_rank: Super Contributor
timestamp: October 22, 2014, 10:10:13 pm
content: Quote from: mikeselectricstuff on October 22, 2014, 05:02:25 pmOK. I'm not seeing many purchases on these, and only minimal feedback on what I am finding. I'm on mobile, though. That might be hindering me a bit.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 23, 2014, 12:31:51 am
content: A couple of sellers I've bought 3mm modules from :http://www.aliexpress.com/item/Free-shipping-Indoor-P3-SMD-led-display-module-full-color-screen/1912655818.htmlhttp://www.aliexpress.com/item/Free-Shipping-By-DHL-2014-European-style-indoor-led-sex-video-display-module/1949520538.html(no I don't know why they call it "indoor led sex video module" !)This is the 2.5mm module I gothttp://www.aliexpress.com/item/Free-shipping-Premium-Quality-Full-Color-Indoor-P2-5-LED-Display-Module-2-5mm-LED-Electronic/1947619793.html

author: SirNick
author_rank: Frequent Contributor
timestamp: October 23, 2014, 06:57:10 pm
content: Quote from: mikeselectricstuff on October 23, 2014, 12:31:51 amYou don't? .... then... what do YOU use them for?

author: paulie
author_rank: Frequent Contributor
timestamp: October 24, 2014, 04:02:45 am
content: They work very well with my "Arduino Vegetable Slicer" and "Arduino Childrens Tuxedo".

author: Rigby
author_rank: Super Contributor
timestamp: October 26, 2014, 10:47:18 pm
content: Quote from: mikeselectricstuff on October 16, 2014, 04:35:07 pmThis is pretty fortunate. Even on my tiny wee DE0-nano, this code only uses about 300/22,000 LEs, so there's room for many parallel instances of this logic.

author: firehopper
author_rank: Frequent Contributor
timestamp: January 26, 2015, 10:28:00 pm
content: so has anyone messed with these on altera fpga's? I have a cyclone II I'd like to get some use out of, but for now I'm going to drive the one 32x32 panel I got with a teensy 3.1

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: January 26, 2015, 10:49:43 pm
content: Quote from: firehopper on January 26, 2015, 10:28:00 pmYou can do it with any FPGA - clock speeds are pedestrian by FPGA standards and you don't need to use any special FPGA features.The only issue is whether there is enough onboard memory in the FPGA of a display buffer

author: firehopper
author_rank: Frequent Contributor
timestamp: January 27, 2015, 01:47:16 pm
content: Quote from: mikeselectricstuff on January 26, 2015, 10:49:43 pmI have a feeling my fpga might not.. its a lower end cyclone II, no built in memory, ep2c5 I think it is..

author: miguelvp
author_rank: Super Contributor
timestamp: January 27, 2015, 03:43:15 pm
content: If a $1 Cortex M0 running at 48MHz can do it, your Cyclone II can do it.What's the full part number of your chip? I believe on earlier Cyclones it was the switching speed in nano seconds, and as I recall the slowest is 8ns so it should be able of 125MHz switching speed but the datasheet should tell you.

author: JoeN
author_rank: Frequent Contributor
timestamp: January 27, 2015, 10:06:40 pm
content: Quote from: Rigby on October 16, 2014, 07:59:18 pmI've had generally good luck with Adafruit and I really appreciate all the work they put into their vids and tutorials, but I had one similar issue. Now, I have to say that I completely understand they get LEDs as remnants and can't guarantee brightness and color perfectly from one batch to the next - they say this on their site. But on one single order I ordered 10 of the smaller 8x8 monochrome matrices (e.g.http://www.adafruit.com/products/454) and they shipped 9 with a black front bezel and one with a grey bezel (unlike what is pictured on their website). Electrically they are the same but the bezels were different. Since I bought 10 specifically to use in a single project, that one grey one looked quite out of place. I complained and the explanation back from their customer service person was basically F.U. They wanted to hide behind the "can't guarantee batch to batch" policy, but this obviously isn't really part of that, it's all a single order and the difference is obvious to the naked eye. Whatever. It was worth the loss of the $5 because now I don't mind buying compatibles off of eBay now and using their code which has saved me much more money than $5. My latest purchase from eBay:]http://www.ebay.com/itm/181538726928$65 for two including shipping total, about $90 at Adafruit ($80 for the panels, $10 to ship -http://www.adafruit.com/products/1484). And their code works just as well on them (presumably, I actually am doing a CPLD implementation using a MAX II 1270).

author: JoeN
author_rank: Frequent Contributor
timestamp: January 27, 2015, 10:23:43 pm
content: Quote from: firehopper on January 27, 2015, 01:47:16 pmThat sucks, having no built-in memory, other than the 119,808 bits of memory built-in.Here is an explanation on how to use those bits...http://engineering.purduecal.edu/ece37100/lecture/lab/lecture9%28b%29.pdf

author: firehopper
author_rank: Frequent Contributor
timestamp: January 28, 2015, 12:10:44 am
content: Quote from: miguelvp on January 27, 2015, 03:43:15 pmep2c5t144c8none of those cheap ebay boards with no ram, just a configuration chip.

author: firehopper
author_rank: Frequent Contributor
timestamp: January 28, 2015, 12:12:16 am
content: Quote from: JoeN on January 27, 2015, 10:06:40 pmthats the same board I bought, cept I got one with a 8 amp psu as well..same exact auction I bought mine from

author: JoeN
author_rank: Frequent Contributor
timestamp: January 28, 2015, 12:49:07 am
content: Quote from: firehopper on January 28, 2015, 12:10:44 amHey, like I said before, that IC does have built-in SRAM, and a decent amount of it too. You can allocate it using VHDL and Verilog and use it as a buffer, you just have to respect the timing constraints. Yeah, there is no external SRAM or DRAM IC like you get on a decent development board, but the Cyclone II itself probably has more than enough M4K blocks for several 32x32 panels.http://engineering.purduecal.edu/ece37100/lecture/lab/lecture9%28b%29.pdfalso,http://engineering.purduecal.edu/ece37100/lecture/lab/lecture9%28a%29.pdfQuote from: firehopper on January 28, 2015, 12:12:16 amI skipped the PSU and got two. I am set for power supplies unless I buy an exceptional number of boards.

author: miguelvp
author_rank: Super Contributor
timestamp: January 28, 2015, 01:23:35 am
content: And on top of the twenty something M4K memory blocks (total I believe about1.1Mbitscorrection 119,808 but still plenty with 26 M4K RAM blocks, each with 512 extra parity bits, the ep2c70 is the one that has the 1.1Mbits ) you can drive it to up to 260MHz, LE count is low but depending on what you want to do with the display it should be plenty even doing 8 bits per color with PWM.

author: Rigby
author_rank: Super Contributor
timestamp: January 28, 2015, 02:38:39 pm
content: One instance of the logic to drive these panels takes up about 300 gates on my DE0-Nano (Altera) when I build it to drive 1-2 panels.This could fit on a tiny CPLD, given it has enough memory to drive the number of displays you're driving. Alternately, one could fit many instances of this on even a low-end FPGA, and drive LOTS of panels. At that point, the number of pins on the FPGA become the limiting factor.

author: miguelvp
author_rank: Super Contributor
timestamp: January 28, 2015, 03:32:08 pm
content: But since the panels are serial you can sacrifice some frame rate or levels per color, for example if 64 values per color is ok then you can drive 4 panels instead of one at the same frame rate or 8 at half the frame rate, but it might cause tearing if you are trying to do video with the panels.

author: JoeN
author_rank: Frequent Contributor
timestamp: January 28, 2015, 05:20:56 pm
content: Quote from: Rigby on January 28, 2015, 02:38:39 pmThis is exactly what I am trying to do, though I am using an external parallel flash memory (SST 6404). See how that goes...

author: bikerglen
author_rank: Newbie
timestamp: April 27, 2015, 04:23:52 am
content: Quote from: miguelvp on August 29, 2014, 12:56:01 amGlen here. I wrote the matrix.v verilog. There’s a more recent version that supports 2 rows of 3 32x32 panels with 12-bit color. Refresh rate if I remember correctly is about 200Hz. I used this code to build a 3x2 mini video wall last year.Project Description:http://bikerglen.com/blog/expanding-the-beaglebone-black-and-fpga-to-drive-6-or-more-panels/Source Code:https://github.com/bikerglen/beagle/tree/master/projects/led-panel-6upThere are two image buffers in FPGA SRAM. The image in the active buffer is displayed on the panels without any CPU intervention. The CPU can then update the other buffer and switch the updated buffer to be the active buffer once the update is complete.There’s a region of unused memory in the SRAMs between the last panel of the first row and the first panel of the next row that could be used to expand the project to 2 rows of 4 panels. I think I was fairly conservative on the clock rates so color could be expanded beyond 12 bits by a combination of reducing the refresh rate and increasing the clock rate used to shift data to the panels.-Glen

author: miguelvp
author_rank: Super Contributor
timestamp: April 27, 2015, 04:32:53 am
content: Thanks Glen and welcome to the forum!