FSM-55: Difference between revisions

From Noisebridge
Jump to navigation Jump to search
Unixjazz (talk | contribs)
No edit summary
Unixjazz (talk | contribs)
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:


== 1. Intro ==
== Intro ==


Having fun with LED matrices!
Having fun with LED matrices!


== Getting Started ==


== 2. Connecting your board ==
You have to clone the repository with the FSM-55 firmware first:


  git clone --branch cortex-m0-support git://git.gniibe.org/chopstx/chopstx.git


== 3. Creating your message ==
Second step is to install and configure a cross-compiler for the ARM Cortex-m0:
 
After configuring the cross-compiling environment, can compile the firmware by:
 
* Change to directory where we have the code examples:
 
  example-fsm-55/
 
* Create a symbolic link to the FSM-55 board:
 
  ln -s ../board/board-fsm-55.h board.h
 
* Compile the firmware:
 
  make
 
Now, we are ready to upload the firmware to the board, but first we need to connect the board to the JTAG programmer.
 
 
== 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:
 
 
== Creating your message ==


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


The user does not need to change the low-level threads (LED and Button), only the Application thread.
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.
Messages are encoded in a 5 x 5 grid of LEDs. The 'led' thread loops through each column of 5x5 grid.
Line 28: Line 58:
     -----
     -----


Each message is encoded as such:
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,
    };
 
== Uploading your code ==
 
 
== Authors ==


    -
Gniibe is the author of the FSM-55. Unixjazz and Gniibe are the authors of this tutorial.
    -
It is released under [https://creativecommons.org/licenses/by-sa/2.1/jp/deed.en_US CC-BY-SA-2.1 JP]. Feel free to redistribute it and modify it for your needs.
    -
    -
    -


== 4. Uploading your code ==


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

Latest revision as of 14:03, 22 March 2015

Intro

[edit | edit source]

Having fun with LED matrices!

Getting Started

[edit | edit source]

You have to clone the repository with the FSM-55 firmware first:

 git clone --branch cortex-m0-support git://git.gniibe.org/chopstx/chopstx.git

Second step is to install and configure a cross-compiler for the ARM Cortex-m0:

After configuring the cross-compiling environment, can compile the firmware by:

  • Change to directory where we have the code examples:
 example-fsm-55/
  • Create a symbolic link to the FSM-55 board:
 ln -s ../board/board-fsm-55.h board.h
  • Compile the firmware:
 make

Now, we are ready to upload the firmware to the board, but first we need to connect the board to the JTAG programmer.


Connecting your board

[edit | edit source]

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:


Creating your message

[edit | edit source]

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,
    };

Uploading your code

[edit | edit source]

Authors

[edit | edit source]

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


References

[edit | edit source]