To test the LED circuit planned for M1r4 in practice, I built
the "ledm" 3x4x2 LED matrix board from

http://projects.qi-hardware.com/index.php/p/wernermisc/source/tree/master/m1/ledravaganza/

and wrote a simple 24-channel PWM controller for it:

https://github.com/milkymist/milkymist/blob/ledmtrx/cores/ledm/rtl/ledm.v

This is what it looks like:

http://downloads.qi-hardware.com/people/werner/m1/leds/ledm-in-m1.jpg

It's plugged into the J21 extension header of my M1rc3, and seen
through the light blue case top (actually, it's the bottom - this
M1rc3 has a purple case and I borrowed the piece from the
M1pre-rc4.)

I used LTST-C190KRKT LEDs, which are about 5 times less bright
than the LEDs we plan to use for M1r4. In this matrix, each LED
has a maximum duty cycle of 16%, which can be scaled in 256
steps down to 0.  The matrix is refreshed at 1 kHz.

The registers of the LED matrix controller can be written from
the RTEMS shell when running Flickernoise:

mdump 0xe0009000 0x60

  Shows the brightness settings of all LEDs. Each value is
  encoded as one byte in a 32 bit word. E.g., the ramp in the
  picture looks like this:

  0xe0009000 00 00 00 00 00 00 00 01-00 00 00 02 00 00 00 03 ................
  0xe0009010 00 00 00 04 00 00 00 05-00 00 00 06 00 00 00 07 ................
  0xe0009020 00 00 00 08 00 00 00 09-00 00 00 0A 00 00 00 0C ................
  0xe0009030 00 00 00 0F 00 00 00 14-00 00 00 1A 00 00 00 22 ..............."
  0xe0009040 00 00 00 2B 00 00 00 38-00 00 00 48 00 00 00 5D ...+...8...H...]
  0xe0009050 00 00 00 78 00 00 00 9A-00 00 00 C6 00 00 00 FF ...x............

mfill 0xe0009000 255 0x60

  Sets all the LEDs to their maximum brightness.

mfill 0xe0009000 0 0x60

  Turns off all the LEDs.

medit 0xe0009000 20

  Sets the first LED to a medium brightness.

medit 0xe0009004 20

  Does the same to the next LED, i.e., the other one in the
  pair. The next after that would be in the next column, etc.

The LED controller also has a configurable 8 bit prescaler.
Its value affects the refresh rate. It is calculated as

  prescaler = 80 MHz / 256 / 6 / refresh

mdump 0xe0009400 4

  Shows the prescaler value. The default is 52, for a refresh
  rate of 1 kHz.

medit 0xe0009400 255

  This would set it to 203 Hz, the lowest possible setting.

Last but not least, here is the script that I used to generate
the ramp shown in the picture:

http://projects.qi-hardware.com/index.php/p/wernermisc/source/tree/master/m1/ledravaganza/ramp.pl

Exponentially increasing the duty cycles produces a ramp
that looks somewhat linear.

- Werner
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to