Introduction
The NUCLEO-8S208RB (built around the STM8S208RBT6 device) and the NUCLEO-8L152R8 (built around the
STM8L152R8T6 device) are boards that allow the evaluation of the main features of all the STM8S Series and STM8L Series
microcontrollers.
This application note provides a short description on how to use the GPIOs and the interrupt controllers on the
NUCLEO-8S208RB and on the NUCLEO-8L152R8 to drive a set of LEDs.
Once the microcontroller (STM8S208RBT6 or STM8L152R8T6 in this example) has been powered-up through a USB cable
connected to the host PC, the LD2 and LD5 LEDs (not on-board LEDs) start blinking. Each time that the "push" button is
pressed, the interrupt controller assets an interrupt that is used to control the I/Os, and changes the LED behavior.
Table 1. Applicable products
Type Part number
Evaluation boards
NUCLEO-8S208RB
NUCLEO-8L152R8
Reference documents
STM8 Nucleo-64 boards data brief (DB3591)
STM8L152R8T6 Nucleo-64 board user manual (UM2351)
STM8S208RBT6 Nucleo-64 board user manual (UM2364)
Using the GPIOs and interrupt controller to drive LEDs on STM8 Nucleo-64
boards
AN5178
Application note
AN5178 - Rev 1 - June 2018
For further information contact your local STMicroelectronics sales office.
www.st.com
1 Application description
This section describes the hardward requirements, the application's schematics and the application's principle to
use the GPIOs and the interrupt controller to drive a set of LEDs on the NUCLEO-8S208RB or the
NUCLEO-8L152R8 boards.
1.1 Hardware requirements
No on-board resources are required other than the user push-button.
The external components required by the application are listed on the table below.
Table 2. External hardware components required
External components Value Comments
LD2, LD3, LD4, LD5 - Standards LEDs
R2, R3, R4, R5 510 Ω Protective resistors
1.2 Application schematics
The figure below shows how to interface the LEDs and the push button with the NUCLEO-8S208RB or the
NUCLEO-8L152R8 boards. For details on NUCLEO-8S208RB or NUCLEO-8L152R8 boards implementation,
refer to the board schematics provided in the corresponding user manual (UM2351 or UM2364).
Protective resistors, R2, R3, R4, and R5, are mandatory to limit the current to a value that does not harm the
LEDs. The push button requires a debounce filter (RC) and a pull-up resistor (R1) to avoid triggering several
interrupts due to the mechanical bouncing of the button.
Figure 1. STM8S Series application schematic
R5 R4 R3 R2
LD5 LD4 LD3 LD2
PB2
R1
V
DD
STM8S208RBT6
PB3 PB4 PB5
PE4
C
R
User’s push button
AN5178
Application description
AN5178 - Rev 1
page 2/11