-
-
How to use USART1, USART2, SysTick, I/O and EEPROM emulation
on 
STM32F0-Discovery




Home Page
STM32F0xx Page


Introduction
What does this SW
How to see the contents of EEPROM emulation
Wiring diagram
Software & Doc





-
Introduction

Aim of this project is to give the basic information for using the:
This SW was tested on KEIL ver.4.60 - 32K free version and ST-LINK-v2.
This project is based on the STM32F0-Discovery.






-
What does this SW
  • If you press the Blue button the character '1' is sent via USART1 and USART2, otherwise it is send '0'.
  • In addition, when you press the Blue button, it is also written a progressive character (starting from character '1') in EEPROM (EEPROM emulation). This character indicates the number of times that was pressed the Blue button.
    For example, if you press the Blue button 4 times in the EEPROM you must see the character 4; see fig.1
    For more details on EEPROM emulation see: AN4061 and EEPROM emulation SW
  • If USART1 receives the character (RxChar) '1' the Blue Led is ON otherwise it is OFF.
    RxChar is received via USART1 under Interrupt.
  • If USART2 receives the character (RxChar_USART2) '1' the Green Led is ON otherwise it is OFF.
    RxChar_USART2 is received via USART2 under Interrupt.
  • SysTick flashing LED that must be connected from 3V and PC7, see the wiring diagram below.
  • The configuration of USART1 and USART2 is:
    USART_BaudRate = 38400;
    USART_WordLength = USART_WordLength_8b;
    USART_StopBits = USART_StopBits_2;
    USART_Parity = USART_Parity_No;
    USART_HardwareFlowControl = USART_HardwareFlowControl_None;
    USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
  • For using EEPROM emulation are necessary the files:
    eeprom.c
    eeprm.h
    that are in the: EEPROM emulation SW
    In the main.c is necessary include the: eeprom.h



Up





-
How to see the contents of EEPROM emulation

For more details on EEPROM emulation see: AN4061 and EEPROM emulation SW

To see the contents of the EEPROM emulation, use the ST-LINK Utility and look at the address 0x08002000, see below.

Fig.1


In Fig.1 we see that the blue button was pressed 14 times.
See the characters in red rectangles.
The numbering starts from character  '1' and the character '>' indicates that the blue button was pressed 14 times.
Character 1 2 3 4 5 6 7 8 9  :    ;    <   =   >
Num.Equ. 1 2 3 4 5 6 7 8 9 10 11 12 13 14

In any case the last value is the character before the:

For example, in Fig.2 (see below) the SW was run 3 times see the colored boxes.
In the first run (Orange box) the blue button was pressed 5 times.
In the second run (Yellow box) the blue button was pressed 1 time.
In the third run (Blue box) the blue button was pressed 2 times.


Fig.2


ATTENTION
If you don't need the EEPROM emulation comment the lines:

127, 129, 222 and 224
The flash endurance is 10K cycles.






-
Wiring diagram


The wiring diagram is very simply, see below.







-
Software and Doc


To download the Software and Doc click here and download: STM32F0-USART1/2-SysTick-I/O

This SW was tested on KEIL ver.4.60 - 32K free version.
For using the SW double click on the:
Project.uvproj

that is in the folder:
C:\......\Project\STM32F0xx_StdPeriph_Templates\MDK-ARM




Up
Home Page
STM32F0xx Page