FSM-55: Difference between revisions

From Noisebridge
Jump to navigation Jump to search
Unixjazz (talk | contribs)
Unixjazz (talk | contribs)
No edit summary
Line 7: Line 7:
== 2. Connecting your board ==
== 2. Connecting your board ==


To program the board, we need to use a programmer with support to the SWD protocol. The most common tool is the proprietary device from ST-Electronics, ST-Link v.2. We are not very happy with it, since it has a proprietary firmware. Tentatively, you could try to use a Bus Pirate, which is supposed to support SWD.
Usually, you just need two wires to connect your STM32: clock and data lines, but, for the FSM-55 we need the 'reset' line as well.
So, here is the pinout:


== 3. Creating your message ==
== 3. Creating your message ==
Line 62: Line 66:


== 4. Uploading your code ==
== 4. Uploading your code ==
== 5. Authors ==
Gniibe is the author of the FSM-55.
Unixjazz and Gniibe are the authors of this tutorial.
It is released under CC-BY-SA-4.0 Japan. Feel free to redistribute it and modify it for your needs.




== 5. References ==
== 5. References ==

Revision as of 13:48, 22 March 2015

1. Intro

Having fun with LED matrices!


2. Connecting your board

To program the board, we need to use a programmer with support to the SWD protocol. The most common tool is the proprietary device from ST-Electronics, ST-Link v.2. We are not very happy with it, since it has a proprietary firmware. Tentatively, you could try to use a Bus Pirate, which is supposed to support SWD.

Usually, you just need two wires to connect your STM32: clock and data lines, but, for the FSM-55 we need the 'reset' line as well. So, here is the pinout:

3. Creating your message

The fun of this exercise is to create your own message and convert it to a C program.

The program is organized in three threads:

  • LED thread (dynamic LED control)
  • Button thread (watchdog)
  • Application thread (text screen control)

The user does not need to change the low-level threads (LED and Button), only the Application thread. The data flows from Application -> (some sort of) Video RAM -> LED control

Messages are encoded in a 5 x 5 grid of LEDs. The 'led' thread loops through each column of 5x5 grid.

    -----
    -----
    -----
    -----
    -----

Each LED is addressed as such:

    - 0x00   * 0x00   * 0x00   * 0x00   * 0x00   * 0x00  
    -        -        *        *        *        *
    -        -        -        *        *        *
    -        -        -        -        *        *
    -        -        -        -        -        *

In other to present the message "Happy Hacking!" only the characters we use (including exclamation point and space) are described:

    { 3, 0 },                                             /* SPACE */
    { 4, DATA55V (0x1f, 0x04, 0x04, 0x1f, 0x00) },        /* H */
    { 3, DATA55V (0x17, 0x15, 0x0f, 0x00, 0x00) },        /* A */
    { 4, DATA55V (0x1f, 0x14, 0x14, 0x08, 0x00) },        /* P */
    { 4, DATA55V (0x19, 0x05, 0x05, 0x1e, 0x00) },        /* Y */
    { 4, DATA55V (0x0e, 0x11, 0x11, 0x0a, 0x00) },        /* C */
    { 4, DATA55V (0x1f, 0x04, 0x0c, 0x13, 0x00) },        /* K */
    { 3, DATA55V (0x11, 0x1f, 0x11, 0x00, 0x00) },        /* I */
    { 4, DATA55V (0x1f, 0x08, 0x06, 0x1f, 0x00) },        /* N */
    { 4, DATA55V (0x0e, 0x11, 0x15, 0x07, 0x00) },        /* G */
    { 2, DATA55V (0x1d, 0x1c, 0x00, 0x00, 0x00) },        /* ! */

The message is represented as a string:

    static uint8_t hh[] = {
         CHAR_H, CHAR_A, CHAR_P, CHAR_P, CHAR_Y,
         CHAR_SPC,
         CHAR_H, CHAR_A, CHAR_C, CHAR_K, CHAR_I, CHAR_N, CHAR_G,
         CHAR_EXC,
         CHAR_SPC, CHAR_SPC, CHAR_SPC,
    };

4. Uploading your code

5. Authors

Gniibe is the author of the FSM-55. Unixjazz and Gniibe are the authors of this tutorial. It is released under CC-BY-SA-4.0 Japan. Feel free to redistribute it and modify it for your needs.


5. References