Home
L9952GXP software driver user manual
Contents
1. Syntax Void Service ID 0 Sync async Synchronous Reentrancy Non reentrant Parameters in None Return value None This function initializes the software driver It has no affect on the device the Description L9952GXP SPI adaptation layer or the SPI interface However The SPI must be initialized prior to the function being used Caveats L9952drv controlsonly one L9952 device This function should not be called when an operation is running Configuration None 11 46 L9952GXP software driver functions UM0563 12 46 Table 2 L9952drv_SetStandbyMode Service name L9952drv_SetStandbyMode Void L9952drv_SetStandbyMode Aynar L9952drv_StandbyModeType mode Service ID 1 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter mode defines the type of standby mode to be set Return value None This module sets selected standby modes of the L9952GXP device Description The registers affected are the CRO 20 21 CR2 20 by L9952drv_SetVReg1CurrentMonitorOn 2 3 Power consumption of all components connected to the V1 voltage regulator must be decreased after standby mode V1 is set This is done by setting halt c t mode in the microcontroller The watchdog should be set in its regular watchdog pala time window to avoid triggering it by calling L9952drv WdgTrigger This function waits until both control registers are c
2. Description The registers affected are the CR1 A2 14 1X2 The modes of digital outputs 3 and 4 are coupled due to the internal Caveats construction of the L9952GXP This function waits until the data are completely transferred to the L9952GXP via the SPI Configuration None 1 This function updates the software driver s internal copy of control register 1 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 1 register from the L9952GXP via the SPI ky UM0563 L9952GXP software driver functions Table 10 L9952drv_SetWUInputMode Service name L9952drv_SetWUInputMode Void L9952drv SetWUlnputMode Syntax uint8 mask L9952drv WUlnputModeType mode Service ID 9 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter mask sets the wakeup WU input mode as current source active or current sink not active Address range 0x00 OxOF Bit 0 1 Mask active for WU1 O Mask not active for WU1 Bit 1 1 Mask active for WU2 0 Mask not active for WU2 Bit 2 1 Mask active for WU3 0 Mask not active for WU3 Bit 3 1 Mask active for WU4 0 Mask not active for WU4 The following constants are defined in the L9952drv h file define L9952DRV MASK WU1 0x01 define L9952DRV MASK WU2 0x02 define L9952DRV MASK WU3 0x04 define L9952DRV MASK WU4 0x08 Example L9952DRV MASK WU2 L
3. L9952drv LinSetup L9952drv SetVsLockoutMode L9952drv SetRelayShutdownMode L9952drv GetStatus0 L9952drv GetStatus 1 L9952drv SetVReg1CurrentMonitorOn L9952drv SetlntMode Figure 10 Group of L9952GXP software driver functions with similar behavior L9952GXP L9952GXP s w L9952GXP s w SPI adaptation SPI driver L9952GXP driver user driver device layer l l i l I L9952drv_Func i l tionGroup1 p10 L9952DRV AL SPI 24 bit SPI WR communication LE transfer PERETE 1 The hardware layer is depicted with a grey background and the software layer is depicted with a white background KYT 39 46 Dynamic view of the L9952GXP software driver functions UM0563 40 46 The ReadStatusx function is comprised of two similarly behaved functions L9952drv ReadStatus0 L9952drv ReadStatus1 Figure 11 L9952drv ReadStatusx function L9952GXP L9952GXP siw L9952GXP siw SPI adaptation SPI driver L9952GXP driver user driver device layer l l L9952drv_Read l StatusX X lt 0 1 gt I 1 The hardware layer is depicted with a grey background and the software layer is depicted with a white background Figure 12 L9952drv_GetGlobalErrorStatus function L9952GXP L9952GXP s w L9952GXP s w SPI adaptation SPI driver L9952GXP driver user driver device layer i l I L9952drv_GetGl obalErrorStatus l L9952DRV_AL_ SPI WR I SPI communicatio
4. L9952DRV DO WU3 HIZ Sets Dig Out3 to loopback of WU3 Sets Dig Dut4 to high impedance L9952DRV DO WU3 OLHS 2 Sets Dig Out3 to loopback of WU3 Sets Dig Out4 to loopback of open load state of OUT2 L9952DRV DO OLHS1 WU 4 Sets Dig Out3 to loopback of open load state of OUT1 Sets Dig Out4 to loopback of WU4 L9952DRV DO OLHS1 OL HS2 Sets Dig Out3 to loopback of open load state of OUT1 Sets Dig Out4 to loopback of open load state of OUT2 L9952DRV DO OLHS1 HIZ Sets Dig Out3 to loopback of open load state of OUT1 Sets Dig Out4 to high impedance L9952DRV DO HIZ OLHS2 Sets Dig Out3 to high impedance Sets Dig Out4 to loopback of open load state of OUT2 Description Defines which signals are looped to digital outputs Dig Out3 and Dig_Out4 Table 36 Type Range L9952drv_WUInputModeType L9952DRV_WU_INPUT_MODE_CUR_SINK enum Defines the current sink pull down mode for related WU inputs L9952DRV_WU_INPUT_MODE_CUR_SOURCE Defines the current source pull up mode for related WU inputs Description Defines current source current sink modes for related WU inputs Table 37 L9952drv_InputFilterModeType Type Range L9952DRV_IN_FILTER_64 enum Defines the input filter time value as 64 us and leaves it unsynchronized L9952DRV_IN_FILTER_80_TIMER2 L9952DRV_IN_FILTER_800_TIMER2 Defines the input filter time value as 80 us and synchroniz
5. kyy 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 Naming different releases of the L9952GXP software driver 5 2 Purpose of the L9952GXP software driver aa aaa 6 3 Architecture of the L9952GXP software driver 7 3 1 L9952GXP software driver file structure aaa 8 3 2 L9952GXP software driver error detection 2 2005 9 3 3 L9952GXP low level peripheral drivers 2 2020000005 10 4 L9952GXP software driver functions 0 000 c eee eee eee 11 5 L9952GXP software driver platform types 30 6 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 Operating system compiler and interrupts n asaan anaana 42 7 2 Hardware requirements 2 42 7 3 Memory mapping sasaaa aaaea 42
6. Bit 4 1 Mask active for openload of OUT1 wakeup source 0 Mask not active for openload of OUT1 wakeup source Bit 5 1 Mask active for openload of OUT2 wakeup source 0 Mask not active for openload of OUT2 wakeup source Bit 6 1 Mask active for openload of OUT3 wakeup source 0 Mask not active for openload of OUT3 wakeup source Bit 7 1 Mask active for openload of OUT4 wakeup source Parameters in 0 Mask not active for openload of OUT4 wakeup source The following constants are defined in the L9952drv h file define L9952DRV MASK WU1 0x01 define L9952DRV MASK WU2 0x02 define L9952DRV MASK WU3 0x04 define L9952DRV MASK WU4 0x08 define L9952DRV MASK OUT1 0x10 define L9952DRV MASK OUT2 0x20 define L9952DRV MASK OUT3 0x40 define L9952DRV MASK OUT4 0x80 Example L9952DRV MASK OUT1 L9952DRV MASK WUA mask is active for WU1 and openload of OUT4 Parameter bitpattern disables enables wakeup functionality separately for each wakeup source Particular bits correspond with specifice wakeup sources in the same order as defined by mask see above Bits with a value of 1 disable a corresponding wakeup source Bits with a value of 0 enable a corresponding wakeup source a 18 46 UM0563 L9952GXP software driver functions 4 Table 11 L9952drv_DisableWakeupSource continued Service name L9952drv_DisableWakeupSource Example L9952drv_DisableWakeupSource 0x32 0x12 A better method is t
7. Parameters in Parameter Errorld defines ID of the error True The software driver continues in an interrupted function in run mode without the L9952DRV_DEV_ERROR_DETECT False The software driver stops execution of the interrupted function by returning avoiding any communication with the L9952GXP device Return value Description Service for reporting errors especially during the development phase This function is originally implemented as a dummy function It allows the user Caveats to implement the required functionality for example error logging setting of some user global error variables for detailed error localization and so on Configuration None 1 The return value is driven in the L9952drv_Cfg h file by DEFINE L9952DRV DEV ERROR DETECT EXEC CONTINUE 41 46 L9952GXP software driver system requirements UM0563 7 7 1 7 2 7 3 42 46 L9952GXP software driver system requirements Operating system compiler and interrupts The L9952GXP driver is written in ANSI C and is MISRA II compliant No operating system is required or directly supported No interrupts are used or required The compiler depends on the microcontroller being used Hardware requirements There are no special hardware requirements for the L9952GXP software driver For hardware details please refer to the L9952GXP datasheet Memory mapping Memory mapping depends on the microcontroller being used and
8. Table 47 Document revision history Date Revision Changes 08 Jul 2008 1 Initial release 22 Sep 2013 2 Updated Disclaimer 45 46 UM0563 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 intellectual 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
9. Figure 6 L9952drv_Init function 1 L9952GXP s w L9952GXP s w driver user driver l l L99s2drv_init L9952GXP SPI adaptation layer SPI driver LERRHe device The hardware layer is depicted with a grey background and the software layer is depicted with a white background UM0563 Dynamic view of the L9952GXP software driver functions 4 Figure 7 L9952drv_WdgTrigger function L9952GXP maton pee SPI adaptation SPI driver L925 2OKE s w driver user s w driver device layer l l L9952drv_Wdg Trigger L9952DRV_AL_ SPI WR SPI 24 bit communication data transfer SPI_WR Right time window is mandatory L9952drv_Wdg Trigger L9952DRV_AL_ SPI_WR SPI 24 bit communication data transfer Right time window is mandatory L9952drv Wdg l l l i l l l l l Trigger I L9952DRV_AL_ SPLWR SPI 24 bit communication data transfer 1 The hardware layer is depicted with a grey background and the software layer is depicted with a white background 37 46 Dynamic view of the L9952GXP software driver functions UM0563 Figure 8 L9952drv_SetStandbyMode L9952DRV STANDBYMODE V1 function L9952GXP L9952GXP L9952GXP a n L9952GXP a a S layer l l T L9952drv_Wdg Trigger I I I L9952DRV AL SPIWR 1 l 1 SPI 24 bit communication data
10. 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 ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN A SAFETY CRITICAL APPLICATIONS SUCH AS LIFE SUPPORTING ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS B AERONAUTIC APPLICATIONS C AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS AND OR D AEROSPACE APPLICATIONS OR ENVIRONMENTS WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE THE PURCHASER SHALL USE PRODUCTS AT PURCHASER S SOLE RISK EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR AUTOMOTIVE AUTOMOTIVE SAFETY OR MEDICAL INDUSTRY DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS PRODUCTS FORMALLY ESCC QML OR JAN QUALIFIED ARE DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY 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 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
11. driver s internal copy of control register 2 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 0 register from the L9952GXP via the SPI Table 5 L9952drv_SetRelayOutput Service name L9952drv_SetRelayOutput Void L9952drv_SetRelayOutput Syntax L9952drv_RelayOutputType value Service ID 4 Sync Async Asynchronous Reentrancy Non reentrant Parameters in Parameter value describes the state a relay is set to or not set to Return value None This function controls the low side LS relay outputs of the L9952GXP Desempuon The registers affected are the CRO 15 16 1 2 This function waits until the data are completely transferred to the L9952GXP Caveats i via the SPI Configuration None 1 This function updates the software driver s internal copy of control register O and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 0 register from the L9952GXP via the SPI ky UM0563 L9952GXP software driver functions 4 Table 6 L9952drv_SetVoltageReg2Mode Service name L9952drv_SetVoltageReg2Mode Void L9952drv_SetVoltageReg2Mode Aynar L9952drv_VoltageReg2ModeType mode Service ID 5 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter mode defines
12. driver s internal copy of status 1 register from the L9952GXP via the SPI 15 46 L9952GXP software driver functions UM0563 16 46 Table 8 L9952drv_SetTimer2 Service name L9952drv_SetTimer2 Void L9952drv_SetTimer2 Syntax L9952drv_Timer2ONTimeType ontime Service ID 7 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter ontime defines the part of the timing period in which the L9952GXP timer 2 output is set to 1 Return value None This function controls timer2 of the L9952GXP Pescnpuon The register affected is the CR1 19 N2 This function waits until the data are completely transferred to the L9952GXP Caveats via the SPI Configuration None 1 This function updates the software driver s internal copy of the control register 1 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of the status 1 register from the L9952GXP via the SPI Table 9 L9952drv_SetDigOutput Service name L9952drv_SetDigOutput Void L9952drv_SetDigOutput ee L9952drv DigOutputModeType mode Service ID 8 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter mode describes the modes for digital outputs Dig_Out3 and Dig_Out4 of the L9952GXP Return value None This function controls digital outputs 3 and 4 of the L9952GXP
13. eee ee 22 Table 16 L9952drv_ClearStatusRegisters 0 0 eee 22 Table 17 L9952drv_SetVsLockoutMode 00 cece eee 23 Table 18 L9I952drv WdgTrigger 0 eee 24 Table 19 L9952drv_SetRelayShutdownMode aana 25 Table 20 L9952drv_GetGlobalErrorStatus 0 0 0 0 00 ee eens 26 Table 21 L9952drv_GetStatus0 nnana 0 000 eee 27 Table 22 L9952drv_ReadStatusO 0 02 eee 27 Table 23 L9952drv_GetStatus1 0 0 000 eee 28 Table 24 L9952drv_ReadStatus1 0 0002 cee 28 Table 25 L9952drv_SetVReg1CurrentMonitorOn 002 cee 29 Table 26 L9952drv SetintMode 002 ce ete 29 Table 27 L9952drv_StandbyModeType 0 0 30 Table 28 L9952drv_OutModeType 0 eee 30 Table 29 L9952drv_OutHSAutorecoveryType 1 6 eee 30 Table 30 L9952drv_RelayOutputType 0 eee 31 Table 31 L9952drv_VoltageReg2ModeType 0 eee 31 Table 32 L9952drv_Timer1PeriodType 0 eee 32 Table 33 L9952drv Timer1ONTimeType 0 0 0 eee 32 Table 34 L9I952drv Timer2ONTimeType anaa aaaeeeaa 32 Table 35 L9952drv_DigOutputModeType 0 00 eee 33 Table 36 L9952drv WUlnputModeType 000 33 Table 37 L9I952drv InputFilterModeType 0 00 cee eee 33 Table 38 L9952drv_ResetThresholdLevelType 00 0 cece ee ete ee 34 Table 39 L9952drv_OutOLThresholdLevelType anaana aaae 34 Table 40 L995
14. exiting the L9952drv ReportError function Figure 5 Error detection flowchart of the software driver Start of L9952GXP function L9952DRV_DEV_ ERROR_DETECT defined Check input parameters Yes L9952drv Report Error 19952DRV DEV ERRORN DETECT EXEC CONTINUE defined Function body 9 46 Architecture of the L9952GXP software driver UM0563 3 3 10 46 L9952GXP low level peripheral drivers Hardware of the low level peripheral drivers depend on the microcontroller being used together with the L9952GXP device Functionality of the peripherals lies outside the scope of the software driver being described in this document However an example of low level ST7 peripheral driver implementation with the software driver for the L9952GXP and an ST7 microcontroller was developed This example is delivered with the L9952GXP software driver UM0563 L9952GXP software driver functions 4 L9952GXP software driver functions The L9952GXP sofware driver mainly carries out simple functions It does not perform its own timing or processes However it must service the watchdog trigger in the correct time window of the L9952GXP device Other timing functions are checked by the user application The following tables summarize the main functions of the L9952GXP software driver Table 1 L9952drv Init Service name L9952drv Init Void L9952drv Init
15. platform types for an 8 bit microcontroller platform 6 Compiler h File contains the compiler dependent definitions 7 Arbitrary microcontroller reg h file contains the microcontroller dependent definitions This is not necessary for the L9952GXP driver itself which is hardware independent This file is useful when the Std_Types h Compiler h file is shared with other modules 8 L9952drv_AL c and L9952drv_AL h files adapt the L9952GXP software driver to the low level SPI driver which allows the software driver to control the L9952GXP device a UM0563 Architecture of the L9952GXP software driver 3 2 L9952GXP software driver error detection Errors are detected in the software driver by checking library usage at runtime see flowchart in Figure 5 When the L9952DRV_DEV_ERROR_DETECT preprocessor switch is defined the L9952GXP software driver function checks the initialization status of the library and the value range of the input parameters at runtime If an error is detected the L9952drv_ReportError function is called Inside the L9952drv_ReportError function the L9952DRV_DEV_ERROR_DETECT_EXEC_CONTINUE switch allows the user to define the behavior of the library function If the L9952DRV DEV ERROR DETECT EXEC CONTINUE switch is not activated the library function is terminated immediately If the L9952DRV DEV ERROR DETECT EXEC CONTINUE switch is defined the function body of the library function is executed after
16. replaces all information previously supplied The ST logo is a registered trademark of STMicroelectronics All other names are the property of their respective owners 2013 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 a 46 46
17. the setup of the compiler Table 46 gives two setups of the ST7L3 microcontroller which is compiled by Cosmic C version 4 5 5 Table 46 Memory mapping examples Map file items Setup 1 Setup 2 Microcontroller ST7L3 ST7L3 Memory model Compact memory Long stack a model short inode rodal Version Run Debug Not defined Defined Version note L9952DRV_DEV_ERROR_DETECT L9952DRV_DEV_ERROR_DETECT Filename 19952drv T5 1 R c map 19952drv T5 1 D sl map Map file items Result Text ROM 1445 3183 Const ROM 4 4 Ubsct RAM 23 8 Share RAM 15 0 Data RAM 0 1 Bss RAM stack 0 15 UM0563 Using the L9952GXP software driver 8 8 1 Note 8 2 8 3 8 4 8 5 Using the L9952GXP software driver The L9952GXP software driver includes a set of source files which can be modified by the user if necessary to customize the driver Some changes are essential for example see Section 8 7 L9952drv AL c and L9952drv AL h files below Main c file Before beginning this file is empty because it exists to compile the software driver for the L9952GXP device The user must regularly service the L9952GXP device watchdog L9952drv C file The L9952_drv c file contains all functionality of the L9952GXP software driver It is recommended to change nothing in this file except the L9952drv_ReportError function The L9952drv_ReportError function is called from the L9952GXP software d
18. voltage recovery of the L9952GXP Table 42 L9952drv_RelayShutdownModeType Type Range enum Enables shutdown of relay outputs during Vs L9952DRV_RELAY_SHUTDOWN_EN over under voltage of the L9952GXP ABLE REL1 2 turned off in case of Vs over under voltage Disables shutdown of relay outputs during L9952DRV_RELAY_SHUTDOWN_DIS Vs over under voltage of the L9952GXP ABLE REL1 2 remain on in case of Vs over under voltage Description Table 43 Defines modes which control Vs over under voltage shutdown of REL1 2 low side drivers L9952drv_IntModeType Type Range enum L9952DRV_INT_DISABLE Disables interrupt mode L9952DRV_INT_ENABLE Enables interrupt mode Description Defines modes which control the interrupt mode of the L9952GXP Table 44 Type Range L9952drv_StatusRegType uint32 0 0xOOFFFFFF Description The L9952drv_StatusRegType defines global data types for access to a complete local copy of the L9952GXP status registers 0 and 1 Access to the internal structure and particular bit variables of each status register is provided by a set of masks related to each bit variable inside the status register 4 35 46 Dynamic view of the L9952GXP software driver functions UM0563 6 36 46 Dynamic view of the L9952GXP software driver functions The following figures give a dynamic overview of the L9952GXP software driver functions
19. 2drv GetStatus1 Void L9952drv GetStatus1 Aynar L9952drv_StatusRegType DataPtr Service ID 22 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter DataPtr points to variables which are filled with data from the status 1 register Return value None This function reads the current status from the L9952GXP via the SPI and then Description files the data structure in the staus 1 register This function waits until the data are completely transferred to the L9952GXP Caveats h via the SPI Configuration None 1 Control register 1 is refreshed to the L9952GXP via the SPI using the software driver s interanl copy of it Table 24 L9952drv_ReadStatus1 Service name L9952drv_ReadStatus1 Void L9952drv_ReadStatus1 AYAR L9952drv_StatusRegType DataPtr Service ID 23 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter DataPtr points to variables which are filled with data from the status 1 register Return value None This function files data structure with the most recent software driver internal Deseupiah copy of status 1 data Caveats This function returns the internal copy of the data The status 1 register is not refreshed by reading its status from the L9952GXP via the SPI Configuration None 1 Use the L9952drv_GetStatus1 function to get actual refreshed data via t
20. 2drv_LinSetupType 000 e eee 34 Table 41 L9I952drv VsLockoutModeType 0 00 eee 35 Table 42 L9952drv_RelayShutdownModeType 0 00 cee eee eee 35 Table 43 L9I952drv IntModeType 000 eee eee 35 Table 44 L9952drv_StatusRegType 0 eee 35 Table 45 L9952drv_ReportError 00000 cee eee 41 Table 46 Memory mapping examples 000 000 cee eee eee eee 42 Table 47 Document revision history 0 0 0 ee eee 45 ky 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 4 46 Release names of the software driver cece ee eee 5 Block diagram of the L9952GXP software driver and the L9952GXP device with its associated microcontroller and peripherals 20200 c cece e eae 6 Top level architecture of the L9952GXP software driver and the L9952GXP device with its associated microcontroller and peripherals 00020 0c e eee eee eee 7 Software driver file structure 2 0 00 8 Error detection flowchart of the software driver eee eee eee 9 L9952drv Init function 36 L9952drv_WdgTrigger function 00 00 ee 37 L9952drv_SetStandbyMode L9952DRV STANDBYMODE V1 function 38 L9952drv_ClearStatusRegister function ee 38 Group of L9952GXP software driver functi
21. 8 Using the L9952GXP software driver 000e eee e ee eeee 43 8 1 Main c file deeri en a eee eee 43 8 2 L9952drv C file nuanua naa 43 8 3 E9952 Cfg file ocd tees eenaa AA AA AA Eaa ea a E 43 8 4 Std Types h file 20 0 0 0 eee 43 8 5 Platform Types h file 20 0000 00 0c 43 8 6 Compiler h file 2 0 0 0 00 cee 44 8 7 L9952drv_AL c and L9952drv AL h files 2 005 44 9 Revision history wana ses bore eee ee ede See se ee ec DARNA NG 45 2 46 ky UM0563 List of tables List of tables Table 1 L9Q52divIAit22 2 ieee bpi ha plea deeiad a tea eee ie lia LANA KAN DD 11 Table 2 L9952drv_SetStandbyMode 0 ete eae 12 Table 3 L9O952drv_SetOutMode 1 ee ee ee eens 13 Table 4 L9952drv_SetOutHSAutorecovery 0 ee eae 14 Table 5 L9952drv SetRelayOutput 2 0 0 2 14 Table 6 L9952drv SetVoltageReg2Mode eee eae 15 Table 7 L9952drv_SetTimer1 0 000 aa pa i a eee 15 Table 8 L9952drv SetTimer2 000 eee 16 Table 9 L9952drv_SetDigOutput 2 20 00 0 eee 16 Table 10 L9952drv SetWUlnputMode 2 000 ee 17 Table 11 L9952drv_DisableWakeupSource 000 cee eee eee 18 Table 12 L9952drv_SetResetThresholdLevel 0 000 cee eee eee 19 Table 13 L9952drv_SetlnputFilterMode 0202s 20 Table 14 LI952drv SetQOutOLThresholdLevel 0 0 0 0 0 ees 21 Table 15 L9952drv_LinSetup 000
22. 9952DRV MASK WUB mask is active for WU2 and WU3 Parameter mode describes the modes current source current sink of the digital WU inputs Return value None This function sets the mode current source or current sink for the digital Description wakeup inputs WU1 WU2 WU3 and WU4 of the L9952GXP The registers affected are the CR1 8 11 N2 This function waits until the data are completely transferred to the L9952GXP Caveats h via the SPI Configuration None 1 This function updates the software driver s internal copy of control register 1 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 1 register from the L9952GXP via the SPI 4 17 46 L9952GXP software driver functions UM0563 Table 11 L9952drv_DisableWakeupSource Service name L9952drv_DisableWakeupSource Void L9952drv_DisableWakeupSource Syntax uint8 mask uint8 bitpattern Service ID 10 Sync async Asynchronous Reentrancy Non reentrant Parameter mask sets the wakeup source It disables the wakeup source from OUT1 and WU2 and enables the wakeup source from OUT2 Address range 0x00 OxFF Bit 0 1 Mask active for WU1 0 Mask not active for WU1 Bit 1 1 Mask active for WU2 0 Mask not active for WU2 Bit 2 1 Mask active for WU3 0 Mask not active for WU3 Bit 3 1 Mask active for WU4 0 Mask not active for WU4
23. Example OUT MODE MASK OUT1 OUT MODE MASK OUT72 mask is active for OUT1 and OUT2 Parameter mode sets the mode for selected outputs Return value None This function controls high side HS outputs of the L9952GXP Description The registers affected are the CR0 0 14 12 This function waits until the data are completely transferred to the L9952GXP Caveats h via the SPI Configuration None 1 This function updates the software driver s internal copy of control register O and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 0 register from the L9952GXP via the SPI 4 13 46 L9952GXP software driver functions UM0563 14 46 Table 4 L9952drv_SetOutHSAutorecovery Service name L9952drv_SetOutHSAutorecovery Void L9952drv_SetOutHSAutorecovery suns L9952drv_OutHSAutorecoveryType mode Service ID 3 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter mode sets the autorecovery functionality of the OUT HS output Return value None This function enables disables the autorecovery functionality of the OUT HS Description outputs of the L9952GXP The register affected is the CR2 5 0 2 This function waits until the data are completely transferred to the L9952GXP Caveats via the SPI Configuration None 1 This function updates the software
24. GXP SPI adaptation layer A thin layer which adapts the software driver SPI interface to the microcontroller dependent SPI driver 4 Low level peripheral drivers Provide the user application layer with all the functions necessary to control the L9952GXP device They control the peripherals of the microncontroller at the lowest power level 7 46 Architecture of the L9952GXP software driver UM0563 3 1 8 46 L9952GXP software driver file structure The L9952GXP sofware driver includes a set of source files which are shown in Figure 4 These files are described in more detail in Section 8 Using the L9952GXP software driver on page 43 Figure 4 Software driver file structure Include Include 3 L9952drv c 1 L9952drv h L9952drv Cfg H Include 4 Include 5 Std_Types h Platform_Types h Include Include optionally I Arbitrary micro Compiler controller reg h Include L9952drv AL c 8 Include L9952dry AL 1 L9952drv c file contains all functionality of the L9952GXP software driver 2 L9952drv h file contains the headers of the L9952GXP software driver functions 3 L9952drv_Cfg h file contains the configuration of the L9952GXP software driver functions 4 Std Types h file contains the standard platform types of the L9952GXP software driver functions 5 Platform_Types h file contains the standard
25. P Range Enables the autorecovery a aaa aaa a functionality for the OUT HS outputs of the L9952GXP PET Defines the states for the OUT HS outputs which control autorecovery Description functionality a UM0563 L9952GXP software driver platform types 4 Table 30 L9952drv_RelayOutputType Type enum RELAYOUTPUT OFF OFF Switches both relays off RELAYOUTPUT ON OFF Switches relay REL1 on and REL2 off RELAYOUTPUT_OFF_ON Switches relay REL1 off and REL2 on RELAYOUTPUT_ON_ON Switches both relays on RELAYOUTPUT OFF X Switches relay REL1 off and refreshes Range the previous state of REL2 Switches relay REL1 on and refreshes REL OUT REE ens the previous state of REL2 RELAYOUTPUT X OFF Switches relay REL2 off and refreshes moy ng the previous state of REL 1 Switches relay REL2 on and refreshes RELAY DUTE UN IGAN the previous state of REL1 Description Defines the states to control the relay outputs Table 31 L9952drv_VoltageReg2ModeType Type enum L9952DRV_VOLTAGE_REG2_OFF Switches voltage regulator 2 off L9952DRV_VOLTAGE_REG2_ON_AC Switches voltage regulator 2 on when TIVE the L9952GXP is in active mode Range Switches voltage regulator 2 on when L9952DRV VOLTAGE REG2 ON V1 the L9952GXP is in active or V1 standby mode L9952DRV VOLTAGE REG2 ON Switches voltage regulator 2 on Description Defines the voltage regulator 2 modes of the L9952GXP 31 46 L9952GXP so
26. SPI Configuration None 1 This function updates the software driver s internal copy of control register 2 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 0 register from the L9952GXP via the SPI 19 46 L9952GXP software driver functions UM0563 20 46 Table 13 L9I952drv SetInputFilterMode Service name L9952drv SetInputFilterMode Void L9952drv SetInputFilterMode Syntax uint8 mask L9952drv InputFilterModeType mode Service ID 12 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter mask sets the filter timing of the wakeup inputs Address range 0x00 OxOF Bit 0 1 Mask active for WU1 O Mask not active for WU1 Bit 1 1 Mask active for WU2 0 Mask not active for WU2 Bit 2 1 Mask active for WU3 0 Mask not active for WU3 Bit 3 1 Mask active for WU4 0 Mask not active for WU4 The following constants are defined in the L9952drv h file define L9952DRV MASK WU1 0x01 define L9952DRV MASK WU2 0x02 define L9952DRV MASK WU3 0x04 define L9952DRV MASK WU4 0x08 Example L9952DRV MASK WU1 L9952DRV MASK WLUA mask is active for WU1 and WU4 Parameter mode sets filter timing for related WU inputs Return value None This function controls the filter timing for digital wakeup inputs WU1 WU2 WU3 Description and WU4 of the L9952GXP The registers affec
27. ameter DataPtr points to variables which are filled with data from the status 0 register Return value None This function reads the current status from the L9952GXP via the SPI and then Description files the data structure in the staus 0 register This function waits until the data are completely transferred to the L9952GXP Caveats h via the SPI Configuration None 1 Control register 2 is refreshed to the L9952GXP via the SPI using the software driver s interanl copy of it Table 22 L9952drv ReadStatus0 Service name L9952drv ReadStatus0 Void L9952drv ReadStatus0 AYAR L9952drv_StatusRegType DataPtr Service ID 21 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter DataPtr points to variables which are filled with data from the status 0 register Return value None This function files data structure with the most recent software driver internal Deseupiah copy of status O data Caveats This function returns the internal copy of the data The status 0 register is not refreshed by reading its status from the L9952GXP via the SPI Configuration None 1 The internal copy of the status O register is refreshed at every watchdog trigger every 10 ms by calling the L9952drv_WdgTrigger function 27 46 L9952GXP software driver functions UM0563 Table 23 L9952drv GetStatus1 Service name L995
28. e driver s internal copy of status 0 register from the L9952GXP via the SPI L9952drv_ClearStatusRegisters Service name Void L9952drv_ClearStatusRegisters L9952drv_ClearStatusRegisters Syntax id Service ID 15 Sync async Asynchronous Reentrancy Non reentrant Parameters in None Return value None This function clears the content of both L9952GXP status registers Description The register affected is the CR1 21 N2 This function waits until the data are completely transferred to the L9952GXP Caveats via the SPI Configuration None 1 This function updates the software driver s internal copy of control register 1 and sends it immediately to the L9952GXP via the SPI It then changes the internal copy of control register 1 and sends it again to the L9952GXP via the SPI SPI This function refreshes the software driver s internal copy of status 1 register from the L9952GXP via the ky UM0563 L9952GXP software driver functions 4 Table 17 L9952drv_SetVsLockoutMode Service name L9952drv_SetVsLockoutMode Void L9952drv_SetVsLockoutMode Aynar L9952drv_VsLockoutModeType mode Service ID 16 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter mode selects the behavior of the L9952GXP after Vs power supply voltage recovery Return value None This function enables automatic recovery of outp
29. es it with timer 2 Defines the input filter time value as 800 us and synchronizes it with timer 2 L9952DRV_IN_FILTER_800_TIMER1 Defines the input filter time value as 800 us and synchronizes it with timer 1 Description Defines the input filter configuration for related WU inputs 4 33 46 L9952GXP software driver platform types UM0563 34 46 Table 38 L9952drv_ResetThresholdLevelType Type enum L9952DRV RESET THRESHOLD 465 Defines the reset threshold level as 0 4 65 V Range L9952DRV RESET THRESHOLD 435 Defines the reset threshold level as 0 4 35 V Description Defines the reset threshold level value Table 39 L9952drv OutOLThresholdLevelType Type enum L9952DRV OUT OLTHRESHOLD 2 Defines the output openload threshold im level value as 2 MA Range L9952DRV OUT OLTHRESHOLD 8 Defines the output openload threshold a level value as 8 MA Description Defines the output openload threshold level value for related outputs Table 40 L9952drv LinSetupType Type enum Enables master pullup LINPU and L9952DRV LIN SL DI TIM EN PUP EN TxD dominant timeout for LIN disables alternative LIN slope Disbles master pullup LINPU and L9952DRV LIN SL DI TIM EN PUP DI alternative LIN slope enables TxD dominant timeout for LIN Enables master pullup LINPU L9952DRV LIN SL DI TIM DI PUP EN disables TxD dominant timeo
30. ftware driver platform types UM0563 32 46 Table 32 L9952drv_Timer1PeriodType Type enum L9952DRV_TIMER1PERIOD_500 Sets timer 1 period to 0 5 s L9952DRV TIMER1PERIOD 1000 Sets timer 1 period to 1s L9952DRV_TIMER1PERIOD_1500 Sets timer 1 period to 1 5 s L9952DRV_TIMER1PERIOD_2000 Sets timer 1 period to 2 s Range L9952DRV TIMER1PERIOD 2500 Sets timer 1 period to 2 5 s L9952DRV TIMER1PERIOD 3000 Sets timer 1 period to 3 s L9952DRV TIMER1PERIOD 3500 Sets timer 1 period to 3 5 s L9952DRV TIMER1PERIOD 4000 Sets timer 1 period to 4 s Description Defines the timer 1 period of the L9952GXP Table 33 L9952drv Timer1ONTimeType Type enum R L9952DRV_TIMER1ONTIME_10 Defines the on time value as 10 ms ange L9952DRV_TIMER1ONTIME_20 Defines on time value as 20 ms Description Defines the on time of timer 1 of the L9952GXP Table 34 L9952drv_Timer2ONTimeType Type enum L9952DRV_TIMER2ONTIME_01 Defines the on time value as 100 us Range L9952DRV_TIMER2ONTIME_1 Defines the on time value as 1 ms Description Defines the on time of timer 2 of the L9952GXP a UM0563 L9952GXP software driver platform types Table 35 L9952drv_DigOutputModeType Type Range L9952DRV_DO_WU3_WU4 enum Sets Dig_Out3 to loopback of WU3 Sets Dig_Dut4 to loopback of WU4 L9952DRV DO HIZ WU4 Sets Dig Out3 to high impedance Sets Dig Dut4 to loopback of WU4
31. he SPI a UM0563 L9952GXP software driver functions 4 Table 25 L9952drv_SetVReg1CurrentMonitorOn Service name L9952drv_SetVReg1CurrentMonitorOn Void L9952drv_SetVReg1CurrentMonitorOn Syntax Void Service ID 24 Sync async Asynchronous Reentrancy Non reentrant Parameters in None Return value None This function switches on voltage regulator 1 of the L9952GXP in stand by Description mode The register affected is the CR2 20 1 This function waits until the data are completely transferred to the L9952GXP Caveats via the SPI Configuration None 1 This function updates the software driver s internal copy of control register 2 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 0 register from the L9952GXP via the SPI Table 26 L9952drv SetlntMode Service name L9952drv SetintMode Void L9952drv SetlntMode Syntax L9952drv_IntModeType mode Service ID 25 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter mode selects the interrupt mode of L9952GXP Return value None This function selects the interrupt mode of L9952GXP Description The register affected is the CR1 20 1 2 This function waits until the data are completely transferred to the L9952GXP Caveats via the SPI Configuration None 1 Thi
32. n SPI_WR 1 The hardware layer is depicted with a grey background and the software layer is depicted with a white background a UM0563 Dynamic view of the L9952GXP software driver functions 6 1 Note 4 L9952GXP software driver error handling function Runtime error handling is supported via the L9952drv_ReportError function This function is called from any of the L9952GXP driver functions when an error is detected It is originally implemented as a dummy function Runtime error handling allows the user to implement the required functionality for example error logging setting some user global error variables or flags for detailed error localization and so on The function is available only if the preprocessor switch L9952DRV DEV ERROR DETECT is set For further details please refer to Section 3 2 L9952GXP software driver error detection on page 9 The error handling function does not care about the arbitrary SPI communication driver All SPI errors and timeouts must be solved inside the SPI driver If there is an error lock and the the watchdog expires the microcontroller may be reset by the L9952GXP device Table 45 L9952drv ReportError Service name L9952drv_ReportError Bool L9952drv_ReportError Syntax uint8 Serviceld uint8 Errorld Service ID Sync async Asynchronous Reentrancy Non reentrant Parameter Serviceld defines the ID of the failing function service
33. o use the predefined constants below Parameters in L9952drv_DisableWakeupSource L9952DRV_MASK_OUT1 cont d L9952DRV_MASK_OUT2 L9952DRV_MASK_WU2 L9952DRV MASK OUT1 L9952DRV_MASK_WU2 This example disables the wakeup source from OUT1 and WU2 and enables wakeup source from OUT2 The rest reminds unchanged Return value None This function enables disables wakeup functionality separately for each Description wakeup source defined by mask The registers affected are the CR1 0 7 1X2 This function waits until the data are completely transferred to the L9952GXP Cad via the SPI Configuration None 1 This function updates the software driver s internal copy of control register 1 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 1 register from the L9952GXP via the SPI Table 12 L9952drv_SetResetThresholdLevel Service name L9952drv_SetResetThresholdLevel Void L9952drv_SetResetThresholdLevel sinipa L9952drv_ResetThresholdLevelType level Service ID 11 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter level defines the reset threshold level value Return value None Description Ue spa he sets the reset threshold pine the L9952GXP gisters affected are the CR2 8 9 Caveats This function waits until the data are completely transferred to the L9952GXP via the
34. ompletely transferred to the L9952GXP device via the SPI Configuration None 1 The L9952drv_SetVReg1CurrentMonitorOn function is called before control register O is modified prior to entering standby mode This is for security reasons 2 This function updates the software driver s internal copy of control register 0 and sends it immediately to the L9952GXP via the SPI 3 This function refreshes the software driver s internal copy of status 0 register from the L9952GXP device via the SPI a UM0563 L9952GXP software driver functions Table 3 L9952drv SetOutMode Service name L9952drv SetOutMode Void L9952drv_SetOutMode Syntax uint8 mask L9952drv_OutModeType mode Service ID 2 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter mask defines the outputs which should be configured Address range 0x00 OxF1 Bit 0 1 Mask is active for OUTHS 0 Mask is not active for OUTHS Bit 4 1 Mask is active for OUT1 0 Mask is not active for OUT1 Bit 5 1 Mask is active for OUT2 0 Mask is not active for OUT2 Bit 6 1 Mask is active for OUT3 0 Mask is not active for OUT3 Bit 7 1 Mask is active for OUT4 0 Mask is not active for OUT4 The following constants are defined in L9952drv h file define L9952DRV MASK OUTHS 0x01 define L9952DRV MASK OUT1 0x10 define L9952DRV MASK OUT2 0x20 define L9952DRV MASK OUT3 0x40 define L9952DRV MASK OUT4 0x80
35. ons with similar behavior 39 L9952drv_ReadStatusx function 0 0 0 0 ee eae 40 L9952drv_GetGlobalErrorStatus function 40 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 0J 0 RC1 p gt Release p Patch version gt Minor version p Major version gt Namel Name Project name Major version Major functionality 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 Release Type of release Official release contains no additional marking Release candidate contains additional marking 4 5 46 Purpose of the L9952GXP software driver UM0563 2 Purpose of the L9952GXP software driver The L9952GXP device is generally used with a microcontroller The microcontroller is sup
36. ool L9952drv_GetGlobalErrorStatus Syntax Void Service ID 19 Sync async Synchronous Reentrancy Non reentrant Parameters in None Return value True Global error status is set at least one error flag is set False Global error status is reset no error Description This function gets the status of the cumulative error bit of the L9952GXP It is implemented using the L9952drv_GetStatus0 function Caveats Reading the DO bit of the SPI while the chip select CS pin is active is not standard SPI operation The microcontroller related SPI driver may not support such functionality and problems may arise in the SPI adaptation layer This function waits until the data are completely transferred to the L9952GXP via the SPI Configuration None 1 Itis possible to get the status of the cumulative error bit by regularly reading status register 0 1 or by reading the first byte of either register An alternative and quicker method is to read the DO bit of the SPI while the SPI is not clocked and the chipselect CS pin is active The SPI must not be communicating during this procedure a L9952GXP software driver functions 4 Table 21 L9952drv GetStatus0 Service name L9952drv GetStatus0 Void L9952drv GetStatus0 Aynar L9952drv_StatusRegType DataPtr Service ID 20 Sync async Asynchronous Reentrancy Non reentrant Parameters in Par
37. or the Cosmic C compiler The L9952GXP software driver is hardware independent therefore the Compiler h file does not include any microcontroller dependent file No user changes are necessary L9952drv_AL c and L9952drv_AL h files These files adapt the L9952GXP software driver to the low level SPI driver which allows the software driver to control the L9952GXP device see Section 3 The L9952drv_AL h file contains the macro define L9952DRV AL SPI WR SPI Send This macro assigns a function SPl_Send to transfer the SPI driver to the L9952GXP device SPI Send replaces the general function L9952DRV AL SPI WR By default SPI Send exists as a dummy function which needs to be updated or replaced If it does not exist it must be created in the L9952drv_AL c file The SPI Send prototype is extern void SPI Send uint8 DataTX uint8 DataRX A description of SPIl_Send is as follows DataTX defines a pointer to 3 bytes of data to be transmitted via the SPI DataRX defines a pointer to 3 bytes of data to be received via the SPI Data transmitted via the SPI are 3 bytes 24 bits in length They are transmitted in the order byte 1 byte 2 and byte 3 The MSB is always transmitted as the first bit from the byte Data are received in the same order as those transmitted The SPI driver must be initialized before the L9952GXP software driver is used for the first time UM0563 Revision history 9 Revision history
38. plied from the device and the two communicate via a standard SPI interface The software driver for the L9952GXP is used to control the device see Figure 2 Please refer to the L9952GXP datasheet for further details Note The source code of the software driver is MISRA Il compliant and follows Autosar requirements Figure 2 Block diagram of the L9952GXP software driver and the L9952GXP device with its associated microcontroller and peripherals me Voltage Regulator 2 bga yy Voltage Regulator 1 Ware Up IN Microcontroller e g LED Z N Hail Sensor EN ail ik Cap 1 Cyclic Contact Monitoring l wu2 ad 6 46 Ti UM0563 Architecture of the L9952GXP software driver 3 Architecture of the L9952GXP software driver The software driver for the L9952GXP is independent from the microcontroller which physically controls the device It is controlled by the user application layer of the software driver see Figure 3 The glue layer between the software driver and the low level peripheral drivers of the microcontroller is the L9952GXP SPI adaptation layer This layer adap
39. river function if the L9952DRV_DEV_ERROR_DETECT switch is active This function is originally implemented as a dummy function It allows the user to implement the required functionality for example error logging settings of some user global error variables for detailed error localization and so on See Section 3 2 L9952GXP software driver error detection on page 9 L9952 Cfg file The source file L9952 Cfg h is a dedicated area where L9952GXP software driver configuration items are placed Before the L9952GXP is configured two preprocessor switches allow the user to tune driver behavior No changes are required but it is possible to make them For more details about preprocessor switches see Section 3 2 L9952GXP software driver error detection on page 9 Std Types h file The Std Types h file is an Autosar compliant file It defines standard platform types of the L9952GXP software driver functions No user changes are necessary Platform Types h file File Platform Types h is an Autosar compliant file which defines global symbols depending on the microcontroller platform 8 bit 16 bit or 32 bit By default this file contains values for an 8 bit microcontroller platform for which no user changes are necessary 43146 Using the L9952GXP software driver UM0563 8 6 8 7 Note 44 46 Compiler h file File Compiler h is an Autosar compliant file which defines compiler types Currently this file contains values f
40. s dedicated bit positions of the main internal variables This function writes internal copies of control register 0 to the L9952GXP device via the SPI This function refreshes the software driver s internal copy of status 0 register from the L9952GXP via the SPI a UM0563 L9952GXP software driver functions 4 Table 19 L9952drv SetRelayShutdownMode Service name L9952drv_SetRelayShutdownMode Void L9952drv_SetRelayShutdownMode Aynar L9952drv_RelayShutdownModeType mode Service ID 18 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter mode selects the behavior of the relay output of the L9952GXP after under over voltage Return value None This function enables automatic shutdown of the relay outputs during Vs Description over under voltage of the L9952GXP The register affected is the CR2 19 1 2 This function waits until the data are completely transferred to the L9952GXP Caveats via the SPI Configuration None 1 This function updates the software driver s internal copy of control register 2 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 0 register from the L9952GXP via the SPI 25 46 L9952GXP software driver functions UM0563 26 46 Table 20 L9952drv_GetGlobalErrorStatus Service name L9952drv_GetGlobalErrorStatus B
41. s function updates the software driver s internal copy of control register 1 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 1 register from the L9952GXP via the SPI 29 46 L9952GXP software driver platform types UM0563 5 30 46 L9952GXP software driver platform types The following tables summarize the L9952GXP software driver platform types Table 27 L9952drv_StandbyModeType Type enum L9952DRV STANDBYMODE V1 sasang L 9952GXP le Banay Range f L9952DRV_STANDBYMODE_VBAT pai 19952GXP to Vbatstahd iby Description Defines the standby modes of the L9952GXP Table 28 L9952drv_OutModeType Type enum L9952DRV_OUT_MODE_OFF Driver is off in all modes L9952DRV_OUT_MODE_ON Driver is on in active mode and off in standby mode L99572DRV OUT MODE TIMER1 Driver is cyclic It is on when Timer is a in active or standby mode Range er MORE L99572DRV OUT MODE TIMER 2 Driver is cyclic It is on when Timer2 is in active or standby mode Driver is controlled by the pulse width Eee oR OUT MODE modulation 1 PWM1 input L9952DRV_OUT_MODE_PWM2 Driver is controlled by the PWM2 input Description Defines the output modes of the HS outputs Table 29 L9952drv OutHSAutorecoveryType Type enum Disables the autorecovery L9952DRV OUTHS AUTORECOVERY F OFF functionality for the OUT HS outputs of the L9952GX
42. ted are the CR2 10 17 N2 This function waits until the data are completely transferred to the L9952GXP Caveats i via the SPI Configuration None 1 This function updates the software driver s internal copy of control register 2 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 0 register from the L9952GXP via the SPI a UM0563 L9952GXP software driver functions Table 14 L9952drv_SetOutOLThresholdLevel Service name L9952drv_SetOutOLThresholdLevel Void L9952drv_SetOutOLThresholdLevel Syntax uint8 mask L9952drv_OutOLThresholdLevelType level Service ID 13 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter mask sets the openload detection level OLT for related HS outputs Address range 0x00 OxFO Bit 4 1 Mask active for OUT 1 0 Mask not active for OUT 1 Bit 5 1 Mask active for OUT 2 0 Mask not active for OUT 2 Bit 6 1 Mask active for OUT 3 0 Mask not active for OUT 3 Bit 7 1 Mask active for OUT 4 0 Mask not active for OUT 4 Following constants are defined in L9952drv h file define L9952DRV MASK OUT1 0x10 define L9952DRV MASK OUT2 0x20 define L9952DRV MASK OUT3 0x40 define L9952DRV MASK OUT4 0x80 Example L9952DRV MASK OUT1 L9952DRV MASK OUT 4 mask is active for OUT1 and OUT4 Parameter level defines level for open load detection for related HS ou
43. the voltage regulator 2 mode to be set Return value None This function controls the voltage regulator 2 mode of the L9952GXP Description The registers affected are the CRO0 17 1802 This function waits until the data are completely transferred to the L9952GXP Caveats via the SPI Configuration None 1 This function updates the software driver s internal copy of control register O and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 0 register from the L9952GXP via the SPI Table 7 L9952drv_SetTimer1 Service name L9952drv_SetTimer1 Void L9952drv SetTimer1 Syntax L9952drv_Timer1PeriodType period L9952drv_Timer1ONTimeType ontime Service ID 6 Sync async Asynchronous Reentrancy Non reentrant Parameters in Return value Parameter period defines the timer 1 period of the L9952GXP Parameter ontime defines the period where the L9952GXP timer 1 output is set to 1 None This function controls timer1 of the L9952GXP Description The registers affected are the CR1 15 18 112 This function waits until the data are completely transferred to the L9952GXP Caveats a via the SPI Configuration None 1 This function updates the software driver s internal copy of control register 1 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software
44. tputs Return value None This function sets the openload detection level for selected HS outputs 1 4 of Description the L9952GXP The registers affected are the CR2 0 3 N2 PB This function waits until the data are completely transferred to the L9952GXP via the SPI Configuration None 1 This function updates the software driver s internal copy of control register 2 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the software driver s internal copy of status 0 register from the L9952GXP via the SPI 4 21 46 L9952GXP software driver functions UM0563 22146 Table 15 L9952drv LinSetup Service name Void L9952drv LinSetup L9952drv LinSetup Aynes L9952drv_LinSetupType value Service ID 14 Sync async Asynchronous Reentrancy Non reentrant Parameters in Parameter value LIN setup values for pull up on bits 0 2 which enables dominant TxD timeout and LIN slope Return value None This function sets the LIN configuration Description The registers affected are the CR2 6 2 7 2 18 N 2 This function waits until the data are completely transferred to the L9952GXP Caveats via the SPI Configuration None 1 Table 16 This function updates the software driver s internal copy of control register 2 and sends it immediately to the L9952GXP via the SPI 2 This function refreshes the softwar
45. transfer SPI_WR Should be close to l watchdog triggering baa L9952DRV AL SPI_WR SPI 24 bit communication data transfer L9952DRV_AL_ SPI_WR SPI 24 bit communication data transfer Microcontroller should go to halt mode now Na aaa 1 The hardware layer is depicted with a grey background and the software layer is depicted with a white background Figure 9 L9952drv_ClearStatusRegister function L9952GXP L9952GXP L9952GXP a L9952GXP a a Paes layer l l l l l L9952drv_Clear StatusRegisters l L9952DRV_AL_ SPI_WR SPI 24 bit communication data transfer L9952DRV_AL_ SPI WR SPI 24 bit communication data transfer 1 The hardware layer is depicted with a grey background and the software layer is depicted with a white background 38 46 a UM0563 Dynamic view of the L9952GXP software driver functions The L9952drv_SetStandbyMode L9952DRV_STANDBYMODE_VBAT is one of a group of functions of the L9952GXP which have the same behavior Other functions in this group include L9952drv SetOutMode L9952drv SetRelayOutput L9952drv SetVoltageReg2Mode L9952drv SetOutHSAutorecovery L9952drv SetTimer1 L9952drv SetTimer2 L9952drv SetDigOutput L9952drv SetWUlnputMode L9952drv DisableWakeupSource L9952drv SetResetThresholdLevel L9952drv_SetlnputFilterMode L9952drv SetOutOLThresholdLevel
46. ts the SPI interface of the software driver to the microcontroller dependent SPI driver Such a mechanism decouples the software driver and makes its hardware independent see Figure 3 A detailed description of the low level peripheral drivers is ouside the scope of this document They are dependent on the microcontroller in question but decouple the user application layer making it hardware indpendent see Figure 3 They provide the user application layer with all the functions necessary to control the L9952GXP device A detailed description of the user application layer is also outside the scope of this user manual Please refer to the AN2751 L9952GXP power management system IC application note for further details Figure 3 Top level architecture of the L9952GXP software driver and the L9952GXP device with its associated microcontroller and peripherals User application layer L9952GXP software driver 2 sw L9952GXP SPI adaptation layer 3 Low level peripheral drivers ports timers SPI HO Microcontroller HW t SPI Tress free 5 V ji Aux L9952GXP 1 User application layer User software which uses the application programming interface API of the software driver to control the device Such software is ouside the scope of this document 2 Software driver for the L9952GXP The software driver for the L9952GXP which interfaces the user application layer 3 L9952
47. ut for LIN and alternative LIN slope Disbles master pullup LINPU TxD L9952DRV LIN SL DI TIM DI PUP DI dominant timeout for LIN and alternative LIN slope Range 19952DRY LIN SLEN TIM EN Pup Ee Erables master pullup LINPU TxD dominant timeout for LIN and N a alternative LIN slope Disbles master pullup LINPU enables L9952DRV_LIN_SL_EN_TIM_EN_PUP_DI TxD dominant timeout for LIN and alternative LIN slope Enables master pullup LINPU and L9952DRV LIN SL EN TIM DI PUP EN alternative LIN slope disables TxD dominant timeout for LIN Disbles master pullup LINPU and TxD L9952DRV LIN SL EN TIM DI PUP DI dominant timeout for LIN enables alternative LIN slope PE Defines all possible configurations related to the L9952GXP LIN interface One Description f configuration must be chosen a UM0563 L9952GXP software driver platform types Table 41 L9952drv_VsLockoutModeType Type Range enum Disables Vs lockout after a Vs over under voltage condition has disappeared Outputs automatically recover according to the output settings in the CRO register L9952DRV_VS_LOCKOUT_DISABLE Enables Vs lockout After a Vs over under voltage recovery outputs remain off until the L9952DRV_VS_LOCKOUT_ENABLE status register 1 bits O and 1 are cleared by the CLR command using bit 21 of control regsiter 1 Description Defines Vs lockout modes for controlling automatic recovery after Vs over under
48. uts after Vs over under voltage Description recovery of the L9952GXP The register affected is the CR2 4 1 2 This function waits until the data are completely transferred to the L9952GXP Caveats via the SPI Configuration None 1 This function updates the software driver s internal copy of control register 2 and sends it immediately to the L9952GXP via the SPI SPI This function refreshes the software driver s internal copy of status 0 register from the L9952GXP via the 23 46 L9952GXP software driver functions UM0563 24146 Table 18 L9952drv WdgTrigger Service name L9952drv_WdgTrigger Void L9952drv_WdgTrigger Syntax Void Service ID 17 Sync async Synchronous Reentrancy Non reentrant Parameters in None Return value None Description This function triggers the watchdog hardware It is called cyclically by the upper layer function usually the watchdog manager to prevent the watchdog hardware from expiring Right timing is essential For more details see the L9952GXP datasheet The register affected is the CR0 19 N 2 3 This function ensures the user pays attention to special conditions such as watchdog handling after wakeup from standby mode Caveats Configuration This function waits until the data are completely transferred to the L9952GXP via the SPI None 1 For security reasons this function periodically refreshe
Download Pdf Manuals
Related Search
Related Contents
Manuel de Maintenance - awel GE FUF17SVR User's Manual Manuel d`installation Samsung P2770HD Керівництво користувача Philips Forecast Fisher Island OME-PIO-DA Hardware Manual RollCall-Pro Installation and Setup Manual Terms & Conditions ADSL Emergency Stop with a Configurable Safety Relay Copyright © All rights reserved.
Failed to retrieve file