I2C_SMBus

所属分类:单片机开发
开发工具:C/C++
文件大小:4837KB
下载次数:79
上传日期:2016-10-12 15:51:14
上 传 者ling52yu
说明:  STM32 实现I2C SMBus ,实现SMBus方面 具有一定的参考意义。
(STM32 I2C SMBus )

文件列表:
I2C_SMBus (0, 2009-10-20)
I2C_SMBus\EWARMv5 (0, 2009-10-20)
I2C_SMBus\EWARMv5\Project.dep (31748, 2009-10-20)
I2C_SMBus\EWARMv5\Project.ewd (17888, 2009-09-16)
I2C_SMBus\EWARMv5\Project.ewp (25634, 2009-10-20)
I2C_SMBus\EWARMv5\Project.eww (161, 2009-06-23)
I2C_SMBus\EWARMv5\settings (0, 2009-10-20)
I2C_SMBus\EWARMv5\settings\Project.cspy.bat (2479, 2009-10-20)
I2C_SMBus\EWARMv5\settings\Project.dbgdt (3802, 2009-10-20)
I2C_SMBus\EWARMv5\settings\Project.dni (550, 2009-10-20)
I2C_SMBus\EWARMv5\settings\Project.wsdt (2903, 2009-10-20)
I2C_SMBus\EWARMv5\settings\Project_STM3210E-EVAL.jlink (205, 2009-09-16)
I2C_SMBus\EWARMv5\STM32F103ZE-EK (0, 2009-10-20)
I2C_SMBus\EWARMv5\STM32F103ZE-EK\Exe (0, 2009-10-20)
I2C_SMBus\EWARMv5\STM32F103ZE-EK\List (0, 2009-10-20)
I2C_SMBus\EWARMv5\STM32F103ZE-EK\Obj (0, 2009-10-20)
I2C_SMBus\EWARMv5\stm32f10x_flash.icf (1355, 2009-06-23)
I2C_SMBus\EWARMv5\stm32f10x_flash_extsram.icf (1392, 2009-09-16)
I2C_SMBus\EWARMv5\stm32f10x_nor.icf (1341, 2009-09-16)
I2C_SMBus\EWARMv5\stm32f10x_ram.icf (1341, 2009-09-16)
I2C_SMBus\main.c (7144, 2009-06-23)
I2C_SMBus\RVMDK (0, 2016-10-12)
I2C_SMBus\RVMDK\CopyHex.bat (18, 2009-10-20)
I2C_SMBus\RVMDK\Exe (0, 2009-10-20)
I2C_SMBus\RVMDK\ExtNOR.ini (1728, 2009-06-23)
I2C_SMBus\RVMDK\ExtRAM.ini (2897, 2009-11-16)
I2C_SMBus\RVMDK\JLinkArm_extsram.ini (248, 2009-09-16)
I2C_SMBus\RVMDK\JLinkArm_flash.ini (248, 2009-09-15)
I2C_SMBus\RVMDK\JLinkArm_nor.ini (248, 2009-09-16)
I2C_SMBus\RVMDK\JLinkArm_ram.ini (248, 2009-09-15)
I2C_SMBus\RVMDK\JLinkLog.txt (18575, 2009-09-21)
I2C_SMBus\RVMDK\List (0, 2016-10-11)
I2C_SMBus\RVMDK\List\RunInRam.map (73808, 2016-10-11)
I2C_SMBus\RVMDK\List\startup_stm32f10x_hd.lst (61249, 2016-10-11)
I2C_SMBus\RVMDK\note.txt (1779, 2009-06-23)
I2C_SMBus\RVMDK\Obj (0, 2016-10-11)
I2C_SMBus\RVMDK\Obj\core_cm3.crf (3555, 2016-10-11)
I2C_SMBus\RVMDK\Obj\core_cm3.d (113, 2016-10-11)
... ...

/** @page I2C_SMBus I2C_SMBus @verbatim ******************** (C) COPYRIGHT 2009 STMicroelectronics ******************* * @file I2C/SMBus/readme.txt * @author MCD Application Team * @version V3.1.0 * @date 06/19/2009 * @brief Description of the I2C SMBus mode example. ****************************************************************************** * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. ****************************************************************************** @endverbatim @par Example Description This example provides a description of how to send an ARP command from I2C1 to I2C2 in SMBus mode. After configuring the I2C1 and I2C2 as SMBus Host and Device, respectively, both I2Cs are enabled. The PEC calculation is enabled for both I2Cs. The ARP capability is enabled for the slave I2C2. Following the start condition generation, the master I2C1 sends the SMBus default header and I2C2 responds by setting its SMBDEFAULT flag. The master I2C1 then issues the "Prepare to ARP" command to the slave I2C2. PEC transfer is then enabled for both I2Cs, and the PEC value received on I2C2 is stored into the PEC_Value variable. A correct transmission leads to obtaining the following variable values: - Status = 0x01 (the flag SMBDEFAULT has been set) - ReceivedCommand = 0x01 (the Command value has been correctly received) The communication clock speed is set to 20KHz. @par Directory contents - I2C/SMBus/stm32f10x_conf.h Library Configuration file - I2C/SMBus/stm32f10x_it.c Interrupt handlers - I2C/SMBus/stm32f10x_it.h Interrupt handlers header file - I2C/SMBus/main.c Main program @par Hardware and Software environment - This example runs on STM32F10x Connectivity line, High-Density, Medium-Density and Low-Density Devices. - This example has been tested with STMicroelectronics STM3210E-EVAL (STM32F10x High-Density) and STM3210B-EVAL (STM32F10x Medium-Density) evaluation boards and can be easily tailored to any other supported device and development board. This example can't be tested with STMicroelectronics STM3210C-EVAL (STM32F10x Connectivity-Line) evaluation board since the I2C2 pins (PB10 and PB11) are already used by Ethernet PHY module. - STM3210E-EVAL Set-up - Connect I2C1 SCL pin (PB.06) to I2C2 SCL pin (PB.10) - Connect I2C1 SDA pin (PB.07) to I2C2 SDA pin (PB.11) - Check that a pull-up resistor is connected on one I2C SDA pin - Check that a pull-up resistor is connected on one I2C SCL pin - STM3210B-EVAL Set-up - Connect I2C1 SCL pin (PB.06) to I2C2 SCL pin (PB.10) - Connect I2C1 SDA pin (PB.07) to I2C2 SDA pin (PB.11) - Check that a pull-up resistor is connected on one I2C SDA pin - Check that a pull-up resistor is connected on one I2C SCL pin @note The pull-up resitors are already implemented on the STM3210B-EVAL and STM3210E-EVAL evaluation boards. @par How to use it ? In order to make the program work, you must do the following : - Create a project and setup all project configuration - Add the required Library files : - stm32f10x_gpio.c - stm32f10x_i2c.c - stm32f10x_rcc.c - system_stm32f10x.c (under Libraries\CMSIS\Core\CM3) - Edit stm32f10x.h file to select the device you are working on. @b Tip: You can tailor the provided project template to run this example, for more details please refer to "stm32f10x_stdperiph_lib_um.chm" user manual; select "Peripheral Examples" then follow the instructions provided in "How to proceed" section. - Link all compiled files and load your image into target memory - Run the example @note - Low-density devices are STM32F101xx and STM32F103xx microcontrollers where the Flash memory density ranges between 16 and 32 Kbytes. - Medium-density devices are STM32F101xx and STM32F103xx microcontrollers where the Flash memory density ranges between 32 and 128 Kbytes. - High-density devices are STM32F101xx and STM32F103xx microcontrollers where the Flash memory density ranges between 256 and 512 Kbytes. - Connectivity-line devices are STM32F105xx and STM32F107xx microcontrollers. *

© COPYRIGHT 2009 STMicroelectronics

*/

近期下载者

相关文件


收藏者