UM0501 STMICROELECTRONICS | Alldatasheet
Document overview
- Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
- PDF pages: 19
Technical content
Datasheet sections
- 1 User interface
- 1.1 Menu structure
- 1.2 Documentation conventions
- 1.3 Navigating menus and sub-menus
- 2 Demonstration applications
- 2.1 Menu overview
- 2.2 Welcome screen and main menu
- 2.3 Help mode
- 2.4 ADC demo
- 2.5 ADC demo
- 2.6 ADC demo
- 2.7 TIMER demo
- 2.8 PWM demo
- 2.9 PWM demo
- 2.10 BEEPER demo
- 2.11 MICROSD demo
- 2.12 GAME demo
- 2.13 SYSTEM demo
- 2.14 About menu
- 3 Upgrading the demonstration firmw are
- 4 STM8S peripherals used
- 5 Demo firmware architecture
- 6 Revision history
June 2009 Doc ID 14320 Rev 3 5/23 UM0501 User manual STM8/128-EVAL demonstration firmware Introduction This document describes the demonstration firmware running on the STM8/128-EVAL evaluation board. Y ou can use it to evaluate the capabilities of the microcontroller and the on-board peripherals. The evaluation board is delivered with the demonstration firmware stored in the Flash program memory of the microcontroller. The firmware is based on the STM8S firmware library, and provides an example of how to use this library. It is divided into various smaller demonstration applications (demos). In case the STM8/128-EVAL evaluation board is not factory-programmed or the demonstration application has been erased, you can reprogram the demonstration firmware into the STM8S2xx Flash memory by following the instructions provided in Section 3. For more information about the evaluation board itself, please read the evaluation board user manual. Note: To run some of the demonstration applications, the option byte must be configured accordingly. Refer to Section 2.10: BEEPER demo.
1 User interface
1.1 Menu structure
submenus, item selection and back capability. Figure 1. Menu structure and navigation
1.2 Documentation conventions
In this document, the keywords in bold indicate user actions on the joystick (5-way switch). Table 1. Documentation conventions
1.3 Navigating menus and sub-menus
To navigate the menus and sub-menus, perform the following actions as required. RIGHT: Navigates to the next menu or sub-menu items on the right. LEFT: Navigates to the next menu or sub-menu items on the left. SEL: Enters sub-menu. UP: Exits from a sub-menu.
2 Demonstration applications
2.1 Menu overview
The Figure 2 shows all the menu and submenus of the demonstration applications. Figure 2. Menu overview
2.2 Welcome screen and main menu
Figure 3. Welcome message Figure 4. Main menu Note: Pressing the joystick in any direction (for around 1 second) ends the melody.
2.3 Help mode
displayed sequentially on the LCD screen with a few second delay. Figure 5. Help mode submenus To exit this demo, press the joystick UP.
2.4 ADC demo 1
potentiometer on the evaluation board. The converted value is displayed in different ways (see Figure 6).
- On the LCD first line: in percentage of the ADC range, in hexadecimal and decimal format
- On the LCD second line: in a bar graph from 0% to 100% of the ADC range.
- On the 4 LEDs: each LED represents approximately 25% of the ADC range. If KEY is pressed, the converted value is output also on USART1 and/or USART2 interfaces and/or a sound is played on the buzzer using the timer PWM.
Figure 6. ADC demo 1 message
UP: Press the joystick UP to exit this demo. KEY: Press KEY repeatedly to enable the output of each converted value option in turn.
2.5 ADC demo 2
used to enter the analog voltage to be converted. UP: Press the joystick UP to exit this demo. described in the previous section.
2.6 ADC demo 3
Note: The JP5 jumper must be inst alled for this demo to work. A first message is displayed with a few seconds delay with all LEDs OFF (see Figure 7). Figure 7. ADC demo 3 message UP: Press the joystick UP to exit this demo. KEY: Press KEY to enable/disable output values on USART1, USART2 and buzzer. Note: If no sound is detected, you can adjust the microphone level using the RV3 potentiometer. Y ou can also make a sound by touching the microphone.
2.7 TIMER demo
This mode demonstrates the Timer peripheral operation.
- To run the TIMER demo, enter the timer start value (from 1 to 18 minutes) using the
RV1 potentiometer (see Figure 8). Figure 8. Entering the timer start value
- Once the requested value is set, press SEL on the joystick to start the timer. The
remaining time is displayed on the LCD screen (see Figure 9). Figure 9. Remaining time message
- When the value reaches 00:10, a sound is heard for each second elapsed.
Figure 10. TIMER demo termination message UP: Press the joystick UP to exit this demo.
2.8 PWM demo 1
JP14 jumper is installed in the bottom position (closer to the LCD).
- Entering the melody (see Figure 11):
The first LCD line shows the position of the note to enter. o = Edit mode, the note is selected by using the RV1 potentiometer. x = Protect mode, the note cannot be changed. A lowercase letter represent a brief note, and an uppercase letter a long note. RV1 potentiometer. Then press SEL to confirm. Once all the notes have been defined, enter an end mark to play the melody.
- = End of notes, the melody is played only once.
Figure 11. Defining the melody to be played
- Playing and saving the melody
- Press SEL on the joystick to play the tune indefinitely.
- Press the joystick UP to stop the melody. Note: Keep the joystick pressed UP for a short time to allow the action to be taken into account.
- The second time UP is pressed, a message is displayed asking you whether you want to save the melody or not (see Figure 12). a) If you press the KEY button, the melody is saved in the external EEPROM. b) If you press UP on the joystick, you exit from the demo without saving the melody. o aaaBBBccdEE*
Figure 12. Saving the melody LEFT/RIGHT: Press the joystick LEFT or RIGHT to navigate the notes. SEL: Press SEL to confirm a note and go to the next one. KEY: Press KEY to switch between edit and protected modes. RV1: Use RV1 potentiometer to define the notes.
2.9 PWM demo 2
the JP14 jumper is installed in the bottom position (closer to LCD).
- Navigate between the melodies by pressing the joystick LEFT or RIGHT, and press
Figure 13. Selecting a melody
- The first time UP is pressed, the melody is stopped.
Note: Keep the joystick pressed UP for a short time to allow the action to be taken into account.
- The second time UP is pressed, a message is displayed asking you to save the melody
a) If you press the KEY button, the melody is saved in the external EEPROM. a) If you press UP, you exit from the demo without saving the melody. LEFT/RIGHT: Press the joystick LEFT or RIGHT to navigate the melodies. SEL: Press SEL to select a melody and play it.
2.10 BEEPER demo
This mode demonstrates the 3 different frequencies that can be output on the BEEP pin. Prior to running the BEEPER demo, perform the following operations.
- Install the JP14 jumper in the top position (closer to the STM8S chip).
- Enable the beep output functionality by setting bit AFR7 of OPT2 option byte to ‘1’ (refer to the datasheets for details). When this mode is entered, the LSI clock is calibrated. The message shown in Figure 14 is displayed at the end of calibration.
Figure 14. End of calibration message After a short time, another message shows the current output frequency. Press the KEY button repeatedly to change the frequency in this order. The LEDs also change depending on the selected frequency. Figure 15. Selecting the beep frequency UP: Press the joystick UP to exit the demo. KEY: Press the KEY button to change the beeper frequency.
2.11 MICROSD demo
This mode demonstrates the basic operation of the MicroSD card interface.
- When this mode is entered, it checks if a MicroSD card is inserted in the slot.
– If no card is found, the message shown in Figure 16 is displayed. Figure 16. No card found – When a MicroSD card is detected, another message is displayed (see Figure 17). Figure 17. Card detected
- Then the MicroSD card is initialized, followed by a Write block (512 bytes) and a Read
Figure 18. MicroSD card initialization
- When this phase is complete, the message shown in Figure 19 is displayed.
from the MicroSD card. The data should be equal to the address low byte.
Figure 19. Reading 512 bytes from the MicroSD card
2.12 GAME demo
This little game is a kind of “fruit machine”. When you press SEL the numbers start rolling. Use the KEY button to stop each number. Y ou hit the jackpot if you get 4 identical numbers (see Figure 20). Figure 20. Hitting the jackpot If you get 3 or 2 identical numbers you win a consolation prize (see Figure 21). Figure 21. Winning a consolation prize If all the numbers are different, you lose (see Figure 22). Figure 22. Losing the game UP: Press the joystick UP to exit this menu.
2.13 SYSTEM demo
This menu is used to display system information. Figure 23. Displaying the clock source Pressing SEL on the joystick displays the clock frequency (see Figure 24). Figure 24. Displaying the clock frequency Press SEL again to go back to the first screen. Y ou can monitor the master clock frequency with an oscilloscope connected to the MCO pin. you will need to press the buttons for longer in order to navigate the menus. UP: Press the joystick UP to exit this menu.
2.14 About menu
in Figure 25 is displayed on the LCD screen. Figure 25. Displaying the demonstration firmware version UP: Press the joystick UP to exit this menu.
16 MHz
UM0501 Upgrading the demonstration firmware Doc ID 14320 Rev 3 19/23
3 Upgrading the demonstration firmware
To upgrade the demonstration firmware running on your board, go through the following steps. 1. Download the latest version of STM8/128-EVAL demonstration firmware and related user manual from www.st.com/mcu/modules.php?name=mcu&file=familiesdocs&FAM=113 2. Extract the content of the downloaded zip file to the directory of your choice 3. Power on the STM8/128-EVAL board and connect it to the Debug instrument 4. Open STVD toolchain and proceed as follows. a) Open a demo.stw project by selecting File>Open Workspace and browsing the demo project under: \\STM8-128-EVAL_Demo\\Demo\\project\\STVD\\Cosmic\\ b) Configure the Debug instrument. Click Debug Instrument>Target Settings in the Debug Instrument Setting window Select the target Debug instrument used for the debug session (SWIM STICE or SWIM RLink) Click OK. c) Click Build>Rebuild All to rebuild all files d) Click Debug>Start Debugging to load the demonstration image 5. Select Debug>Run to run the demonstration. The demonstration firmware is now programmed and you can close the debugging session. Note: Y ou can also load a binary file of the demonstration firmware (.s19) by using the STVP toolchain (refer to the STVP online help for details). The binary file is available under \\STM8- 128-EVAL_Demo\\Image.
4 STM8S peripherals used
The following table lists the STM8S peripherals used in each demo. Table 2. Peripherals used
UM0501 Demo firmware architecture Doc ID 14320 Rev 3 21/23
5 Demo firmware architecture
This section describes the demo firmware architecture. It is divided into two parts.
- Library: contains the firmware library source files. These files do not need to be modified by the user.
- Application: contains the specific files of the demonstration firmware that can be modified. – stm8s_conf.h: this header file is used to configure the library – stm8s_it.h: header for the stm8s_it.c file – stm8s_it.c: this file provides all the interrupt sub-routines – stm8_interrupt_vector.c: this file provides the interrupt vector table – demo_xxx.h: header for the demo_xxx.c file – demo_xxx.c: this file provides all functions related to the xxx demo – functions.h: header for the functions.c file – functions.c: this file provides miscellaneous functions. – joystick_button.h: header for the joystick_button.c file – joystick_button.c: this file provides all functions related to the management of the joystick and button – mono_lcd.h: header for the mono_lcd.c file – mono_lcd.c: this file provides LCD management functions – main.h: header for the main.c file – main.c: this file provides the main function – menu.h: header for the menu.c file – menu.c: this file provides menu functions and menu definition
6 Revision history
Table 3. Document revision history 08-Dec-2008 1 Initial release. 02-Mar-2009 2 Added Section 3: Upgrading the demonstration firmware. 17-Jun-2009 3 Added note about JP5 in Section 2.6 on page 11. Updated KEY sequence in Section 2.7 on page 12.