COMP

所属分类:单片机开发
开发工具:C/C++
文件大小:174KB
下载次数:3
上传日期:2018-09-27 14:17:37
上 传 者lhy_520
说明:  STM32Cube的COMP例程,可以用system workbench for stm32打开
(The COMP routine of STM32Cube can be opened with system workbench for STM32.)

文件列表:
COMP_AnalogWatchdog (0, 2018-09-25)
COMP_AnalogWatchdog\EWARM (0, 2018-09-25)
COMP_AnalogWatchdog\EWARM\Project.ewd (45356, 2018-01-03)
COMP_AnalogWatchdog\EWARM\Project.ewp (29982, 2018-01-03)
COMP_AnalogWatchdog\EWARM\Project.eww (161, 2018-01-03)
COMP_AnalogWatchdog\EWARM\startup_stm32h743xx.s (40194, 2018-01-03)
COMP_AnalogWatchdog\EWARM\stm32h743xx_flash.icf (1598, 2018-01-03)
COMP_AnalogWatchdog\Inc (0, 2018-09-25)
COMP_AnalogWatchdog\Inc\main.h (3367, 2018-01-03)
COMP_AnalogWatchdog\Inc\stm32h7xx_hal_conf.h (14978, 2018-01-03)
COMP_AnalogWatchdog\Inc\stm32h7xx_it.h (3175, 2018-01-03)
COMP_AnalogWatchdog\MDK-ARM (0, 2018-09-25)
COMP_AnalogWatchdog\MDK-ARM\Project.uvoptx (16232, 2018-01-03)
COMP_AnalogWatchdog\MDK-ARM\Project.uvprojx (19813, 2018-01-03)
COMP_AnalogWatchdog\MDK-ARM\startup_stm32h743xx.s (44971, 2018-01-03)
COMP_AnalogWatchdog\Src (0, 2018-09-25)
COMP_AnalogWatchdog\Src\main.c (15709, 2018-01-03)
COMP_AnalogWatchdog\Src\stm32h7xx_hal_msp.c (5373, 2018-01-03)
COMP_AnalogWatchdog\Src\stm32h7xx_it.c (5625, 2018-01-03)
COMP_AnalogWatchdog\Src\system_stm32h7xx.c (11335, 2018-01-03)
COMP_AnalogWatchdog\SW4STM32 (0, 2018-09-25)
COMP_AnalogWatchdog\SW4STM32\startup_stm32h743xx.s (36196, 2018-01-03)
COMP_AnalogWatchdog\SW4STM32\STM32H743ZI-Nucleo (0, 2018-09-25)
COMP_AnalogWatchdog\SW4STM32\STM32H743ZI-Nucleo\.cproject (11651, 2018-01-03)
COMP_AnalogWatchdog\SW4STM32\STM32H743ZI-Nucleo\.project (4798, 2018-01-03)
COMP_AnalogWatchdog\SW4STM32\STM32H743ZI-Nucleo\STM32H743ZITx_FLASH.ld (4832, 2018-01-03)
COMP_Interrupt (0, 2018-09-25)
COMP_Interrupt\EWARM (0, 2018-09-25)
COMP_Interrupt\EWARM\Project.ewd (45356, 2018-01-03)
COMP_Interrupt\EWARM\Project.ewp (30118, 2018-01-03)
COMP_Interrupt\EWARM\Project.eww (161, 2018-01-03)
COMP_Interrupt\EWARM\startup_stm32h743xx.s (40194, 2018-01-03)
COMP_Interrupt\EWARM\stm32h743xx_flash.icf (1600, 2018-01-03)
COMP_Interrupt\Inc (0, 2018-09-25)
COMP_Interrupt\Inc\main.h (3360, 2018-01-03)
COMP_Interrupt\Inc\stm32h7xx_hal_conf.h (14978, 2018-01-03)
COMP_Interrupt\Inc\stm32h7xx_it.h (3168, 2018-01-03)
COMP_Interrupt\MDK-ARM (0, 2018-09-25)
COMP_Interrupt\MDK-ARM\Project.uvoptx (16677, 2018-01-03)
... ...

/** @page COMP_Interrupt COMP Interrupt example @verbatim ******************** (C) COPYRIGHT 2017 STMicroelectronics ******************* * @file COMP/COMP_Interrupt/readme.txt * @author MCD Application Team * @version V1.2.0 * @date 29-December-2017 * @brief Description of the COMP Interrupt example. ****************************************************************************** * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** @endverbatim @par Example Description This example shows how to configure the COMP peripheral to compare the external voltage applied on a specific pin with the Internal Voltage Reference. At the beginning of the main program the HAL_Init() function is called to reset all the peripherals, initialize the Flash interface and the systick. The SystemClock_Config() function is used to configure the system clock for STM32H743xx Devices : - The CPU at 400MHz - The HCLK for D1 Domain AXI and AHB3 peripherals , D2 Domain AHB1/AHB2 peripherals and D3 Domain AHB4 peripherals at 200MHz. - The APB clock dividers for D1 Domain APB3 peripherals, D2 Domain APB1 and APB2 peripherals and D3 Domain APB4 peripherals to run at 100MHz When the comparator input crosses (rising edge) the internal reference voltage VREFINT (1.22V), the comparator generates an interrupt and exit from STOP mode. The System enters STOP mode 5 seconds after the comparator is started and after any system wake-up triggered by the comparator interrupt. In this example, the comparator input is connected on the pin PB.00 the user shall apply a voltage on and each time the comparator input crosses VREFINT,MCU is awake, system clock is reconfigured and LED2 is ON. If LED3 is toggling continuously without any voltage update, it indicates that the system generated an error. @note In case of noise on voltage applied on COMP_INPUT, The MCU may be awake at a voltage level with an uncertainty of tens of mV. @note Care must be taken when using HAL_Delay(), this function provides accurate delay (in milliseconds) based on variable incremented in SysTick ISR. This implies that if HAL_Delay() is called from a peripheral ISR process, then the SysTick interrupt must have higher priority (numerically lower) than the peripheral interrupt. Otherwise the caller ISR process will be blocked. To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function. @note The example need to ensure that the SysTick time base is always set to 1 millisecond to have correct HAL operation. @Note If the application is using the DTCM/ITCM memories (@0x20000000/ 0x0000000: not cacheable and only accessible by the Cortex M7 and the MDMA), no need for cache maintenance when the Cortex M7 and the MDMA access these RAMs. If the application needs to use DMA(or other masters) based access or requires more RAM, then the user has to: - Use a non TCM SRAM. (example : D1 AXI-SRAM @ 0x24000000) - Add a cache maintenance mechanism to ensure the cache coherence between CPU and other masters(DMAs,DMA2D,LTDC,MDMA). - The addresses and the size of cacheable buffers (shared between CPU and other masters) must be properlydefined to be aligned to L1-CACHE line size (32 bytes). @Note It is recommended to enable the cache and maintain its coherence, but depending on the use case It is also possible to configure the MPU as "Write through", to guarantee the write access coherence. In that case, the MPU must be configured as Cacheable/Bufferable/Not Shareable. Even though the user must manage the cache coherence for read accesses. Please refer to the AN4838 “Managing memory protection unit (MPU) in STM32 MCUs” Please refer to the AN4839 “Level 1 cache on STM32F7 Series” @par Directory contents - COMP/COMP_Interrupt/Inc/stm32h7xx_hal_conf.h HAL configuration file - COMP/COMP_Interrupt/Inc/stm32h7xx_it.h Interrupt handlers header file - COMP/COMP_Interrupt/Inc/main.h Header for main.c module - COMP/COMP_Interrupt/Src/stm32h7xx_it.c Interrupt handlers - COMP/COMP_Interrupt/Src/main.c Main program - COMP/COMP_Interrupt/Src/stm32h7xx_hal_msp.c HAL MSP file - COMP/COMP_Interrupt/Src/system_stm32h7xx.c STM32H7xx system source file @par Hardware and Software environment - This example runs on STM32H743xx devices. - This example has been tested with STM32H743ZI-Nucleo board and can be easily tailored to any other supported device and development board. - STM32H743ZI-Nucleo Set-up - Apply an external variable voltage on PB.00 (connected on pin 31 on CN10) with average voltage 1.22V. @par How to use it ? In order to make the program work, you must do the following : - Open your preferred toolchain - Rebuild all files and load your image into target memory - Run the example *

© COPYRIGHT STMicroelectronics

*/

近期下载者

相关文件


收藏者