STMicroelectronics STLUX385A User Manual

May 2014 DocID026248 Rev 1 1/21
UM1753
User manual
Description of STLUX385A peripheral library
Introduction
This user manual provides complete information for SW developers on the STLUX385A library, a library of APIs useful to get familiar developing applications for the STLUX385A digital controller and its peripherals.
The STLUX385A is an STMicroelectronics
®
digital device tailored for lighting applications. The heart of the STLUX is the SMED (“State Machine Event Driven”) technology which allows the device to operate several independently configurable PWM clocks with up to
1.3 ns resolution. A SMED is a powerful autonomous state machine which is programmed to react to both external and internal events and may evolve without any software intervention. The tools provided by this Kit will help you understand the SMEDs and how to program them in your applications.
SMEDs are configured and programmed via the STLUX internal low-power microcontroller (STM8). This manual describes the tools provided in this kit.
www.st.com
Contents UM1753
2/21 DocID026248 Rev 1
Contents
1 Reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 STLUX library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 STLUX385A clock (stlux_clk) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 STLUX385A SMEDs (stlux_smed) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.4 STLUX385A analog comparator unit (stlux_acu) . . . . . . . . . . . . . . . . . . . .11
3.5 STLUX385A analog-to-digital converter (stlux_adc) . . . . . . . . . . . . . . . . .11
3.6 STLUX385A system timer (stlux_stmr) . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.7 STLUX385A general purpose I/O (stlux_gpio) . . . . . . . . . . . . . . . . . . . . . 15
3.8 STLUX385A auxiliary timer (stlux_atm) . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.9 STLUX385A auto wake-up unit (stlux_awu) . . . . . . . . . . . . . . . . . . . . . . . 16
3.10 STLUX385A universal asynchronous receiver/transmitter (stlux_uart) . . 17
4 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
DocID026248 Rev 1 3/21
UM1753 List of tables
21
List of tables
Table 1. List of acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Table 2. STLUX385A clock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Table 3. STLUX385A SMEDs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Table 4. STLUX385A analog comparator unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Table 5. STLUX385A analog-to-digital converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Table 6. STLUX385A system timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Table 7. STLUX385A general purpose I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 8. STLUX385A auxiliary timer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 9. STLUX385A auto wake-up unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 10. STLUX385A universal asynchronous receiver/transmitter . . . . . . . . . . . . . . . . . . . . . . . . . 17
Table 11. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Reference documents UM1753
4/21 DocID026248 Rev 1
1 Reference documents
For hardware information on the STLUX385A controller and product specific SMED
configuration, please refer to the STLUX385A product datasheet.
For information on programming, erasing and protection of the internal Flash memory
please refer to the STM8 Flash programming manual (PM0047).
For information about the debug and SWIM (single-wire interface module) refer to the
STM8 SWIM communication protocol and debug module user manual (UM0470).
For information on the STM8 core and assembler instruction please refer to the STM8
CPU programming manual (PM0044).
For information on the SMED configurator please refer to the UM1760 “STLUX™
SMED configurator 1.0” user manual.
DocID026248 Rev 1 5/21
UM1753 Acronyms
21
2 Acronyms
A list of acronyms used in this document:
Table 1. List of acronyms
Acronym Description
ACU Analog comparator unit
ADC Analog-to-digital converter
ATM Auxiliary timer
AWU Auto wake-up unit
BL Bootloader - used to load the user program without the emulator
CCO Configurable clock output
CKC Clock control unit
CKM Clock master
CPU Central processing unit
CSS Clock security system
DAC Digital-to-analog converter
DALI Digital addressable lighting interface
ECC Error Correction Code
FSM Finite state machine
FW Firmware loaded and running on the CPU
GPIO General purpose input output
HSE High-speed external crystal - ceramic resonator
HSI High-speed internal RC oscillator
I2C Inter-integrated circuit interface
IAP In-application programming
ICP In-circuit programming
ITC Interrupt controller
IWDG Independent watchdog
LSI Low-speed Internal RC oscillator
MCU Microprocessor central unit
MSC Miscellaneous
PM Power management
RFU Reserved for future use
ROP Read-out protection
RST Reset control unit
RTC Real-time clock
Acronyms UM1753
6/21 DocID026248 Rev 1
SMED State machine event driven
STMR System timer
SW Software, is the firmware loaded and running on the CPU (synonymous of FW)
SWI Clock switch interrupt
SWIM Single-wire interface module
UART Universal asynchronous receiver/transmitter
WWDG Window watchdog
Table 1. List of acronyms (continued)
Acronym Description
DocID026248 Rev 1 7/21
UM1753 STLUX library
21
3 STLUX library
3.1 Introduction
The STLUX385A library is a collection of APIs aiming to simplify the usage of the STLUX SMEDs and peripherals to application developers. Each collection of APIs is dedicated to a specific device or functionality and named so “stlux_xxx” where “xxx” stands for the name of the peripheral. The library is developed using the C language compatible with the IAR™ and Raisonance tools and is composed of the “stlux_xxx.c” and “stlux_xxx.h” relative files to be included in your application.
3.2 STLUX385A clock (stlux_clk)
Table 2. STLUX385A clock
Header Input parameters
Output
parameters
Functionality
CLK_Reset
Sets the clock internal
registers to their default
initialization values.
CLK_HSECmd
NewState: it can be ENABLE or
DISABLE.
Enables/disables HSE.
CLK_HSICmd
NewState: it can be ENABLE or
DISABLE.
Enables/disables HSI.
CLK_LSICmd
NewState: it can be ENABLE or
DISABLE.
Enables/disables LSI.
CLK_CCOCmd
NewState: it can be ENABLE or
DISABLE.
Enables/disables CCO.
CLK_ClockSwitchCmd
NewState: it can be ENABLE or
DISABLE.
Manually starts/stops the
clock switch execution.
CLK_FastHaltWakeUpCmd
NewState: it can be ENABLE or
DISABLE.
When enabled, the HSI
oscillator is automatically
switched-on and selected
as a next master clock
when resuming from
HALT/active-halt modes.
CLK_SlowActiveHaltWakeUpCmd
NewState can be ENABLE or
DISABLE.
Configures the slow active-
halt wakeup.
CLK_PeripheralClockConfig
CLK_Peripheral can be one of
the following peripherals: I
2
C,
GPIO0, UART, DALI, STMR,
GPIO1, AWU, ADC, SMEDx,
MSC.
NewState can be ENABLE or
DISABLE.
Enables/disables the
specified peripheral CLK.
Loading...
+ 14 hidden pages