Home

STM8/128-EVAL demonstration firmware

image

Contents

1. N UM0501 J User manual STM8 128 EVAL demonstration firmware Note June 2009 Introduction This document describes the demonstration firmware running on the STM8 128 EVAL evaluation board You 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 STMB8S 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 To run some of the demonstration applications the option byte must be configured accordingly Refer to Section 2 10 BEEPER demo Doc ID 14320 Rev 3 5 23 www st com Contents UMO0501 Contents 1 UserinterfaCe scu tae pwns iea cadens ewe Row RC 7 1 1 Menu structure leleee hrs 7 1 2 Documentation conventions 00 ce eee ee Rh 7 1 3 Navigating menus and sub menus 20000000 ee eee 8 2 Demonstration applications llllseeeeesss 9 2 1 Menu
2. Install the JP14 jumper in the top position closer to the STM8S chip e 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 Calibration OK After a short time another message shows the current output frequency Press the KEY button repeatedly to change the frequency in this order 1 kHz 2 kHz 4 kHz 1 2 4 kHz OFF 1 kHz etc The frequency selected is displayed on the LCD screen see Figure 15 The LEDs also change depending on the selected frequency Figure 15 Selecting the beep frequency BEEPER 1kHz Press KEY UP Press the joystick UP to exit the demo KEY Press the KEY button to change the beeper frequency Doc ID 14320 Rev 3 15 23 Demonstration applications UMO501 2 11 16 23 MICROSD demo This mode demonstrates the basic operation of the MicroSD card interface 1 When this mode is entered it checks if a MicroSD card is inserted in the slot f nocard is found the message shown in Figure 16 is displayed Figure 16 No card found Please Insert MicroSD When a MicroSD card is detected another message is displayed see Figure 17 Figure 17 Card detected MicroSD
3. Overview eR RR rss 9 2 2 Welcome screen and main menu lene 9 2 3 Help ModE scria on e WR KR RRRAREE ERA aet EVENING 10 2 4 ADC demo 1 xekbeRLESTRGURPDeu EEG e AS weed Ewen Pes 10 2 5 ADC demo 2 Rua KE ORE Dea HSS GIES wR eS 11 2 6 ADC demno S vs sb Baswedan bees wuAers dud Ard 11 2 7 TIMER demo eR RR Rene 12 2 8 PWM demo1 eR RR RR rr hrs 13 2 9 PWM demo 2 eR rrr 14 2 10 BEEPER demo erre 15 2 11 MICROSD demo es 16 2 12 GAME demo eres 17 2 13 SYSTEM demo i e BER be Swe Rees b yaw we ees iR 18 2 14 About menu ee ee eee ee ees 18 3 Upgrading the demonstration firmware 19 4 STM8S peripherals used leeellllles 20 5 Demo firmware architecture leues nn nn 21 6 Revision history iussus oie a ee ra dad d ae EORR RC ia 22 6 23 Doc ID 14320 Rev 3 ky UMO0501 User interface 1 User interface 1 1 Menu structure The demonstration firmware user interface is based on a circular navigation menu with submenus item selection and back capability Figure 1 shows the menu system of the demonstration The top row of items represents the main menu Figure 1 Menu structure and navigation WELCOME MESSAGE Left Right Left Right gt ITEM2 3 ITEM ITEM 1 n 2 n v v 1 2 Documentatio
4. sound is played on the buzzer using the timer PWM Figure 6 ADC demo 1 message 065 29Eh 0670d Doc ID 14320 Rev 3 ky UMO501 Demonstration applications 2 5 2 6 Note Note UP Press the joystick UP to exit this demo KEY Press KEY repeatedly to enable the output of each converted value option in turn LCD only LCD Buzzer LCD USART1 LCD USART2 LCD USART1 USART2 LCD USART1 USART2 Buzzer LCD only etc ADC demo 2 This is the same as ADC demo 1 except that the CN3 connector on the evaluation board is used to enter the analog voltage to be converted UP Press the joystick UP to exit this demo KEY Press KEY to enable disable output values on USART1 USART2 and buzzer as described in the previous section ADC demo 3 This is the same as ADC demo 1 and ADC demo 2 except that the microphone U8 is used The JP5 jumper must be installed 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 Clap 3 times to wake me up After 3 noises are heard the demo starts and the LCD displays the same messages as in ADC demo 1 and demo 2 UP Press the joystick UP to exit this demo KEY Press KEY to enable disable output values on USART1 USART2 and buzzer If no sound is detected you can adjust the microphone level using the RV3 potentiometer You can als
5. LOSE UP Press the joystick UP to exit this menu Doc ID 14320 Rev 3 17 23 Demonstration applications UMO0501 2 13 Note 2 14 18 23 SYSTEM demo This menu is used to display system information The message displayed on the LCD screen shows the clock source which is used HSI LSI or LSE see Figure 23 Figure 23 Displaying the clock source CLOCK SOURCE HSI Pressing SEL on the joystick displays the clock frequency see Figure 24 Figure 24 Displaying the clock frequency CLOCK FREQ 16 MHz Press SEL again to go back to the first screen During any of the above two messages you can press KEY repeatedly to divide the HSI clock frequency by a divider factor 1 2 4 8 1 The new clock frequency is then displayed You can monitor the master clock frequency with an oscilloscope connected to the MCO pin If you select an HSI divider greater than 1 you slow down the whole application As a result you will need to press the buttons for longer in order to navigate the menus UP Press the joystick UP to exit this menu About menu This menu shows the firmware version When this submenu is selected the message shown in Figure 25 is displayed on the LCD screen Figure 25 Displaying the demonstration firmware version STM8 128 EVAL Version x y z UP Press the joystick UP to exit this menu Doc ID 14320 R
6. by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever any liability of ST ST and the ST logo are trademarks or registered trademarks of ST in various countries Information in this document supersedes and replaces all information previously supplied The ST logo is a registered trademark of STMicroelectronics All other names are the property of their respective owners 2009 STMicroelectronics All rights reserved STMicroelectronics group of companies Australia Belgium Brazil Canada China Czech Republic Finland France Germany Hong Kong India Israel Italy Japan Malaysia Malta Morocco Philippines Singapore Spain Sweden Switzerland United Kingdom United States of America www st com ky Doc ID 14320 Rev 3 23 23
7. card Detected 2 Then the MicroSD card is initialized followed by a Write block 512 bytes and a Read block operation See Figure 18 for the messages displayed consecutively on the LCD screen Figure 18 MicroSD card initialization Init PASS Write Block PASS Read Block PASS 3 When this phase is complete the message shown in Figure 19 is displayed By pressing the joystick to LEFT or RIGHT you can display the 512 bytes of data read from the MicroSD card The data should be equal to the address low byte Doc ID 14320 Rev 3 ky UMO501 Demonstration applications 2 12 Figure 19 Reading 512 bytes from the MicroSD card LEFT or RIGHT to see data Addr 0x0001 Data 0x01 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 The first time the KEY button is pressed it stops the first number then the second number etc You hit the jackpot if you get 4 identical numbers see Figure 20 Figure 20 Hitting the jackpot 5 5 5 5 JACKPOT 10000 If you get 3 or 2 identical numbers you win a consolation prize see Figure 21 Figure 21 Winning a consolation prize 778 6 You Win 10 If all the numbers are different you lose see Figure 22 Figure 22 Losing the game 1234 YOU
8. d UMO501 4 20 23 STMSS peripherals used The following table lists the STM8S peripherals used in each demo Table 2 Peripherals used Peripheral Demo ADC2 ADC TIMER and PWM demos EXTIT MicroSD demo GPIO All demos buttons LEDs Clock Controller All demos BEEPER Beeper demo SPI All demos LCD MicroSD 12C PWM demos save restore melody TIM1 PWM and ADC demos Buzzer TIM2 All demos time base UART1 ADC demos UART3 ADC demos Doc ID 14320 Rev 3 UMO501 Demo firmware architecture 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 t
9. e and a melody is played see Figure 3 The introduction melody can be changed by using either PWM demo 1 or PWM demo 2 see Section 2 8 and Section 2 9 Figure 3 Welcome message STM8 128K Demo ST Once the melody is played the main menu is activated and the message shown in Figure 4 is displayed Figure 4 Main menu MENU HELP push SEL Pressing the joystick in any direction for around 1 second ends the melody Doc ID 14320 Rev 3 9 23 Demonstration applications UMO0501 2 3 2 4 10 23 Help mode Pressing SEL from the main menu enters the Help mode The following messages are displayed sequentially on the LCD screen with a few second delay Figure 5 Help mode submenus LEFT or RIGHT to scroll menu Press SEL to enter sub menu Move UP to exit sub menu To exit this demo press the joystick UP ADC demo 1 This mode demonstrates the ADC operation that are performed using the RV1 potentiometer on the evaluation board The converted value is displayed in different ways see Figure 6 e OntheLCD first line in percentage of the ADC range in hexadecimal and decimal format e OntheLCD second line in a bar graph from 0 to 100 of the ADC range e Onthe4 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
10. ev 3 ky UMO501 Upgrading the demonstration firmware 3 Note 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 amp file familiesdocs amp FAM 1 13 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 Opena demo stw project by selecting File gt Open Workspace and browsing the demo project under STM8 128 EVAL_Demo Demo project STVD Cosmic b Configure the Debug instrument Click Debug Instrument gt 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 gt Rebuild All to rebuild all files d Click Debug gt Start Debugging to load the demonstration image 5 Select Debug gt Run to run the demonstration The demonstration firmware is now programmed and you can close the debugging session You can also load a binary file of the demonstration firmware 519 by using the STVP toolchain refer to the STVP online help for details The binary file is available under STM8 128 EVAL_Demo lmage Doc ID 14320 Rev 3 19 23 STM8S peripherals use
11. he management of the joystick and button mono lcd h header for the mono cd 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 Doc ID 14320 Rev 3 21 23 Revision history UMO501 6 22 23 Revision history Table 3 Document revision history Date Revision Changes 08 Dec 2008 1 Initial release 02 Mar 2009 2 Added Section 3 Upgrading the demonstration firmware 17 Jun 2009 Added note about JP5 in Section 2 6 on page 1 1 Updated KEY sequence in Section 2 7 on page 12 Doc ID 14320 Rev 3 UMO501 Please Read Carefully Information in this document is provided solely in connection with ST products STMicroelectronics NV and its subsidiaries ST reserve the right to make changes corrections modifications or improvements to this document and the products and services described herein at any time without notice All ST products are sold pursuant to ST s terms and conditions of sale Purchasers are solely responsible for the choice selection and use of the ST products and services described herein and ST assumes no liability whatsoever relating to the choice selection or use of the ST products and services described herein No license express or implied by estoppel or otherwise to any in
12. n conventions In this document the keywords in bold indicate user actions on the joystick 5 way switch The KEY button 1 way switch and the RV1 potentiometer follow the conventions shown in Table 1 Table 1 Documentation conventions Keyword User action LEFT Press joystick to the left RIGHT Press joystick to the right UP Press joystick up DOWN Press joystick down SEL Press joystick center KEY Press KEY button RV1 Rotate RV1 potentiometer ky Doc ID 14320 Rev 3 7 23 User interface UMO0501 1 3 8 23 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 Doc ID 14320 Rev 3 ky UMO501 Demonstration applications 2 2 1 2 2 Note Demonstration applications Menu overview The Figure 2 shows all the menu and submenus of the demonstration applications Figure 2 Menu overview WELCOME MESSAGE MAIN MENU MICROSD SYSTEM ADC DEMO1 ADC DEMO2 ADC DEMO3 The following sections provides a detailed description of each part of the demonstration firmware Welcome screen and main menu After a board RESET a welcome message is displayed on the first line the ST logo is displayed moving on the second lin
13. o make a sound by touching the microphone Doc ID 14320 Rev 3 11 23 Demonstration applications UMO0501 2 7 TIMER demo This mode demonstrates the Timer peripheral operation 1 Torun 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 TIMER DEMO 03 00 2 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 Remaining 01 45 3 When the value reaches 00 10 a sound is heard for each second elapsed When the value reaches 00 00 the four LEDs flash and the message shown in Figure 10 is displayed Figure 10 TIMER demo termination message Terminated 00 00 UP Press the joystick UP to exit this demo KEY Press KEY repeatedly to divide counter pulse duration by 2 1 second 0 5 second 0 25 second 31 25 ms 1 second 12 23 Doc ID 14320 Rev 3 ky UMO501 Demonstration applications 2 8 Note PWM demo 1 This mode demonstrates the Timer peripheral operating in PWM mode Make sure that the JP14 jumper is installed in the bottom position closer to the LCD 1 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 potenti
14. ometer X Protect mode the note cannot be changed The second LCD line shows the notes to be played with the following convention a A LA b B SI c C DO d D RE e E MI f F FA g G SOL s S silence or pause A lowercase letter represent a brief note and an uppercase letter a long note To modify a note press the joystick LEFT or RIGHT to navigate the notes and use the 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 8 End of melody the melody is played in a loop with varying octaves and note durations Figure 11 Defining the melody to be played Oo aaaBBBccdEE 2 Playing and saving the melody e Press SEL on the joystick to play the tune indefinitely e Pressthe joystick UP to stop the melody Keep the joystick pressed UP for a short time to allow the action to be taken into account e 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 Doc ID 14320 Rev 3 13 23 Demonstration applications UMO0501 2 9 Note 14 23 Figure 12 Saving the melody Save melody KEY YES UP NO LEFT RIGHT Press the jo
15. tellectual property rights is granted under this document If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein UNLESS OTHERWISE SET FORTH IN ST S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE ST PRODUCTS ARE NOT RECOMMENDED AUTHORIZED OR WARRANTED FOR USE IN MILITARY AIR CRAFT SPACE LIFE SAVING OR LIFE SUSTAINING APPLICATIONS NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY DEATH OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE ST PRODUCTS WHICH ARE NOT SPECIFIED AS AUTOMOTIVE GRADE MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER S OWN RISK Resale of ST products with provisions different from the statements and or technical features set forth in this document shall immediately void any warranty granted
16. ystick 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 PWM demo 2 This demo also demonstrates the Timer peripheral operating in PWM mode Make sure that the JP14 jumper is installed in the bottom position closer to LCD This demo allows to select and play one melody among a selection stored in the Flash memory see Figure 13 1 Navigate between the melodies by pressing the joystick LEFT or RIGHT and press SEL to select and play the melody see Figure 13 Figure 13 Selecting a melody Select Melody Bon Tabac 2 The first time UP is pressed the melody is stopped Keep the joystick pressed UP for a short time to allow the action to be taken into account 3 The second time UP is pressed a message is displayed asking you to save the melody or not 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 Doc ID 14320 Rev 3 ky UMO501 Demonstration applications 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 e

Download Pdf Manuals

image

Related Search

Related Contents

Copyright © All rights reserved.
Failed to retrieve file