UM0563
User manual
L9952GXP software driver user manual
Introduction
The L9952GXP is a complex device described in the L9952GXP datasheet and the
L9952GXP power management system IC application note (AN2751). For further
information on these documents, please contact STMicroelectronics. To simplify use of
L9952GXP device, an associated software driver has been developed. This document
decribes how to use the software driver to control the L9952GXP device.
September 2013
Rev 2
1/46
www.st.com
Contents
UM0563
Contents
1
2
3
Naming different releases of the L9952GXP software driver . . . . . . . . 5
Purpose of the L9952GXP software driver . . . . . . . . . . . . . . . . . . . . . . . 6
Architecture of the L9952GXP software driver . . . . . . . . . . . . . . . . . . . . 7
3.1
3.2
3.3
L9952GXP software driver file structure . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
L9952GXP software driver error detection . . . . . . . . . . . . . . . . . . . . . . . . . 9
L9952GXP low-level peripheral drivers . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4
5
6
L9952GXP software driver functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
L9952GXP software driver platform types . . . . . . . . . . . . . . . . . . . . . . 30
Dynamic view of the L9952GXP software driver functions . . . . . . . . . 36
6.1
L9952GXP software driver error handling function . . . . . . . . . . . . . . . . . 41
7
L9952GXP software driver system requirements . . . . . . . . . . . . . . . . . 42
7.1
7.2
7.3
Operating system, compiler and interrupts . . . . . . . . . . . . . . . . . . . . . . . . 42
Hardware requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Memory mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
8
Using the L9952GXP software driver . . . . . . . . . . . . . . . . . . . . . . . . . . 43
8.1
8.2
8.3
8.4
8.5
8.6
8.7
Main.c file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
L9952drv.C file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
L9952_Cfg file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Std_Types.h file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Platform_Types.h file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Compiler.h file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
L9952drv_AL.c and L9952drv_AL.h files . . . . . . . . . . . . . . . . . . . . . . . . . 44
9
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2/46
UM0563
List of tables
List of tables
Table 1.
Table 2.
Table 3.
Table 4.
Table 5.
Table 6.
Table 7.
Table 8.
Table 9.
Table 10.
Table 11.
Table 12.
Table 13.
Table 14.
Table 15.
Table 16.
Table 17.
Table 18.
Table 19.
Table 20.
Table 21.
Table 22.
Table 23.
Table 24.
Table 25.
Table 26.
Table 27.
Table 28.
Table 29.
Table 30.
Table 31.
Table 32.
Table 33.
Table 34.
Table 35.
Table 36.
Table 37.
Table 38.
Table 39.
Table 40.
Table 41.
Table 42.
Table 43.
Table 44.
Table 45.
Table 46.
Table 47.
L9952drv_Init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
L9952drv_SetStandbyMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
L9952drv_SetOutMode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
L9952drv_SetOutHSAutorecovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
L9952drv_SetRelayOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
L9952drv_SetVoltageReg2Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
L9952drv_SetTimer1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
L9952drv_SetTimer2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
L9952drv_SetDigOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
L9952drv_SetWUInputMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
L9952drv_DisableWakeupSource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
L9952drv_SetResetThresholdLevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
L9952drv_SetInputFilterMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
L9952drv_SetOutOLThresholdLevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
L9952drv_LinSetup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
L9952drv_ClearStatusRegisters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
L9952drv_SetVsLockoutMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
L9952drv_WdgTrigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
L9952drv_SetRelayShutdownMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
L9952drv_GetGlobalErrorStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
L9952drv_GetStatus0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
L9952drv_ReadStatus0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
L9952drv_GetStatus1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
L9952drv_ReadStatus1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
L9952drv_SetVReg1CurrentMonitorOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
L9952drv_SetIntMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
L9952drv_StandbyModeType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
L9952drv_OutModeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
L9952drv_OutHSAutorecoveryType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
L9952drv_RelayOutputType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
L9952drv_VoltageReg2ModeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
L9952drv_Timer1PeriodType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
L9952drv_Timer1ONTimeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
L9952drv_Timer2ONTimeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
L9952drv_DigOutputModeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
L9952drv_WUInputModeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
L9952drv_InputFilterModeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
L9952drv_ResetThresholdLevelType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
L9952drv_OutOLThresholdLevelType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
L9952drv_LinSetupType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
L9952drv_VsLockoutModeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
L9952drv_RelayShutdownModeType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
L9952drv_IntModeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
L9952drv_StatusRegType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
L9952drv_ReportError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Memory mapping examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3/46
List of figures
UM0563
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
Figure 7.
Figure 8.
Figure 9.
Figure 10.
Figure 11.
Figure 12.
Release names of the software driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Block diagram of the L9952GXP software driver and the L9952GXP device with its
associated microcontroller and peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Top level architecture of the L9952GXP software driver and the L9952GXP device with
its associated microcontroller and peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Software driver file structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Error detection flowchart of the software driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
L9952drv_Init() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
L9952drv_WdgTrigger() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
L9952drv_SetStandbyMode (L9952DRV_STANDBYMODE_V1) function. . . . . . . . . . . . . 38
L9952drv_ClearStatusRegister() function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Group of L9952GXP software driver functions with similar behavior . . . . . . . . . . . . . . . . . 39
L9952drv_ReadStatusx() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
L9952drv_GetGlobalErrorStatus() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4/46
UM0563
Naming different releases of the L9952GXP software driver
1
Naming different releases of the L9952GXP software
driver
A standardized naming system exists for naming different releases of the software driver for
the L9952GXP device. The name includes all relevant information, such as project name,
functionality, patch version and release type. An example of a release name is the
L9952drv_1-0-0_RC1, which is explained in
Figure 1.
Figure 1.
Release names of the software driver
L9952drv
1
0
0 RC1
Release
(5)
Patch version
(4)
Minor version
(3)
Major version
(2)
Name
(1)
1. Name: Project name
2. Major version: Major functionality
3. Minor version: Minor functionality
Odd numbers indicate the driver is still in development
Even numbers indicate the driver is mature and a public version is available.
4. Patch version: No additional functionality permitted, except bug fixing.
5. Release: Type of release
Official release (contains no additional marking)
Release candidate (contains additional marking)
5/46