Jump to content
L.R.A

WS2812B Matrix

Recommended Posts

@L.R.A

Have you considered using the 129x's External Peripheral Interface (EPI)

In general purpose mode it looks like it can handle up to 32 output bits at once.  (The bits appear on a smattering of different ports).

Can drive it with processor outputs or with uDMA.

 

So should be able to use one DMA and one PWM and one GPIO interrupt for 32 outputs.

 

(I was just reading about the device, haven't tried using it.)

 

Depending on port overlap may still be able to use some of the regular GPIO ports to drive even more strings.

 

[Edit: Addition - I assume that if one is using a 32 output EPI, one would set the uDMA to output 32bit items, expanding that 1024 item DMA limit to

4096 bytes.]

Share this post


Link to post
Share on other sites

The problem is the receive address. The GPIO data address from diferent GPIO modules aren't adjacent to each other.

 

The idea of DMA is to free up the processor do to something else. If i use a interrupt to control the GPIO it will keep the processor busy more frequently. And note that the timing can betwen changes can be as low as 0.6uS. That can be hard for a interrupt even for a ARM at 120Mhz. The fastest i've done with something similar was 0.8uS and it was to control a TLC5940 (then i used the SPI of course)

 

I can't say anything about the EPI, never read it up... yet.

Share this post


Link to post
Share on other sites

The problem is the receive address. The GPIO data address from diferent GPIO modules aren't adjacent to each other.

 

I can't say anything about the EPI, never read it up... yet.

 

The point of suggesting the EPI was that it does things differently than GPIO.  It lets you write up to 32 output pins with a single (32bit) write to a particular address.  (At least that is what it does in one mode.)

Those 32 output pins are spread across several GPIO ports, but the EPI hardware takes care of that (well you have to configure the pins to begin with, but once it is set up then you can access the I/O pins all together).  So one could think of it as a way to make those chunks of GPIO register be adjacent to each other.

 

The I/O pins it uses are fixed (i.e. you can't use it to combine just any pins, although a few of the pins have alternates).

 

You don't have to use 32 bits at once - can select from 8, 16, or 32 

 

The GPIO interrupt I mention was just the same as mentioned in the posts above (i.e. the PWM triggers the GPIO which triggers the DMA transfer).

Share this post


Link to post
Share on other sites

The point of suggesting the EPI was that it does things differently than GPIO.  It lets you write up to 32 output pins with a single (32bit) write to a particular address.  (At least that is what it does in one mode.)

Those 32 output pins are spread across several GPIO ports, but the EPI hardware takes care of that (well you have to configure the pins to begin with, but once it is set up then you can access the I/O pins all together).  So one could think of it as a way to make those chunks of GPIO register be adjacent to each other.

 

The I/O pins it uses are fixed (i.e. you can't use it to combine just any pins, although a few of the pins have alternates).

 

You don't have to use 32 bits at once - can select from 8, 16, or 32 

 

The GPIO interrupt I mention was just the same as mentioned in the posts above (i.e. the PWM triggers the GPIO which triggers the DMA transfer).

 

Hum interesting. I have to read that up later today if i can. Thanks Igor

Share this post


Link to post
Share on other sites

@ I'm thinking of posting it on the blog but i haven't gotten into organizing and commenting the code.

This weekend i have to get some resources ready so maybe i will post the code too.

 

 

Btw 1 update: i tested in each output (all 32) with 120 LEDs so hurray it works. 

 

@@igor i can't seem to find a register like in the GPIO to control the state of the pins. Do you know which one it is? Just for the sake of lazyness, i don't want to read the entire EPI part :P
 

Share this post


Link to post
Share on other sites

Hi,

FYI: a better alternative to WS chip is APA102/APA102C with a true SPI interface, no timing constraints as this one based on one-wire.

L

Share this post


Link to post
Share on other sites

Yes they are Lyon :P But they are still to new and i have to do it with the ws2812. Note that you can't get has many paralel outputs as the WS2812 unless you do SPI by software.

 

They also have a higher speed with also a re-shaping function (so lenght isn't a problem for the signal). They will for sure get more popular

Share this post


Link to post
Share on other sites

 

 


@@igor i can't seem to find a register like in the GPIO to control the state of the pins. Do you know which one it is? Just for the sake of lazyness, i don't want to read the entire EPI part :P

 

Trick question - there is no register for reading/writing pins (like in GPIO), it uses a memory address instead.

The main thing the EPI is used for is interfacing to external memory devices.

You could look at the General Purpose mode as something like an external memory device with just data lines and no address lines (i.e. an external "memory" with only 1 location).

 

So the reading/writing happens at a particular memory address (memory as in SRAM/Flash/etc.) rather than to one of the I/O registers.

 

Main bits to focus on in the EPI documentation are the ones that talk about the general purpose mode.

I do not remember off hand what address it winds up being for the EPI GP mode.  It might be 0x60000000 

I did find some code that used GP EPI (and DMA) - site was in German, but code comments in English.  

I am out of time at the moment and can't find my bookmark, will post link when I find it.

Share this post


Link to post
Share on other sites

Well i put a example code here for 8 outputs. Hope it helps :P

https://sites.google.com/site/luiselectronicprojects/rgb-matrix/ws2812-dma-ping-pong-mode

 

@@igor I don't realy got time to read into the EPI just for that. It's working and the it's not like i have a shortage of GPIO. It's more of more priority to reduce the RAM usage but i've been a bit busy with the start of university and all 

I've been also teaching how to program Tiva and some other things on the robotics club so i don't really got time :/

Share this post


Link to post
Share on other sites

More on EPI - 

the address one writes or reads from is selected from a few options.

EPIAddressMapSet( ... ) - for the GP mode can select 0x60000000 or 0x80000000

 

The example I found of using EPI in GP mode is here (site is in German, but automated translation gives a reasonable idea of what says, and the code is mostly in English).:

https://sebastianfoerster86.wordpress.com/2014/06/02/2048-pixel-rgb-led-matrix-basic/

 

I was reading about EPI to see if it would be useful in driving an RGB LED matrix - 

got as far as figuring out one would need an external AND gate to get the clocking right for the device I am interested in (not WS2812).

Then I found the above site, where somebody had already done what I was contemplating.

 

Not related to EPI - the code there is also somewhat interesting/relevant in that it uses the TM4C129 to emulate WS2801 controller.

 

As noted above, EPI might help get around some of the problems that were noted (1024 item limit, trying to figure out which DMA expired when using separate tables for the 0x00 and 0xFF).  Mostly figured EPI was kind of an interesting option to be aware of.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×