/**
@page OptimizedI2Cexamples AN2824 Optimized I2C examples Readme File
@verbatim
******************** (C) COPYRIGHT 2010 STMicroelectronics *******************
* @file OptimizedI2Cexamples/readme.txt
* @author MCD Application Team
* @version V4.0.0
* @date 06/18/2010
* @brief Description of the STM32 I2C examples using Polling, DMA and IT.
******************************************************************************
* 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 Description
This software allows the STM32 I2C to operate as master transmitter/receiver
using Polling or DMA or Interrupt or as slave transmitter/receiver using DMA
or Interrupt.
If the user wants to perform an I2C communication between two boards based on
the STM32, he just has to compile the project for slave and then for master.
The master transmits/receives a buffer of bytes (with prefixed size by the user),
into/from the slave.
In the provided routines, direct I2C registers' accesses are performed. The
purpose is to provide optimized examples. The I2C standard library is used only
for I2C initialization (mode, clock etc...)
The communication clock speed is set to 400KHz. You can change it in the I2CRoutines.h.
@par Directory contents
- inc: contains the header files
- Optimized I2C examples/inc/I2Routines.h Header for I2CRoutines.c
- Optimized I2C examples/inc/stm32f10x_conf.h Library Configuration files
- Optimized I2C examples/inc/stm32f10x_it.h Interrupt handlers header files
- src: contains the source files
- Optimized I2C examples/src/stm32f10x_it.c Interrupt handlers
- Optimized I2C examples/src/main.c Main program
- Optimized I2C examples/src/I2CRoutines.c Contains the I2C read and
write routines ,I2Cx(1 or 2), GPIOB and DMA Channels configurations.
@par Hardware and Software environment
- This example runs on STM32F10x Connectivity line, High-Density, Medium-Density,
XL-Density, Medium-Density Value line, Low-Density and Low-Density Value line Devices.
- The example using I2C1, has been tested with STMicroelectronics STM32100B-EVAL (Medium-Density
Value line), STM3210C-EVAL (Connectivity line), STM3210E-EVAL (High-Density and
XL-Density) and STM3210B-EVAL (Medium-Density) evaluation boards and can be easily
tailored to any other supported device and development board.
The example using I2C2 can't be tested with STMicroelectronics STM3210C-EVAL (STM32F10x
Connectivity-Line) evaluation boards since the I2C2 pins (PB10 and PB11) are
already used by Ethernet PHY module.
The example using I2C2 can't be tested with STMicroelectronics STM32100B-EVAL (STM32F10x
Medium-Density Value line) evaluation boards since the I2C2 pins (PB10 and PB11)
are already used by HDMI-CEC module.
- If the user wants to perform an I2C communication between two boards based on
the STM32:
- Connect I2Cx SCL pin (PB.06 or PB.10) to the other I2Cx SCL pin (PB.06 or PB.10).
- Connect I2Cx SDA pin (PB.07 or PB.11) to the other I2Cx SDA pin (PB.07 or 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
@par How to use it ?
In order to make the program work, you must do the following:
1. Load the Master code in the Master Board (see below)
2. Load the Slave code in the Slave Board (see below)
3. Run program in Slave Board
4. Run program in Master Board
In order to load the code, you have do the following:
- EWARM:
- Open the Optimized I2C examples.eww workspace
- In the workspace toolbar select the project config:
- STM3210B-EVAL: to configure the project for STM32 Medium-density devices
- Rebuild all files: Project->Rebuild all
- Load project image: Project->Debug
- Run program: Debug->Go(F5)
- RIDE
- Open the Optimized I2C examples.rprj project
- In the configuration toolbar(Project->properties) select the project config:
- STM3210B-EVAL: to configure the project for STM32 Medium-density devices
- Rebuild all files: Project->build project
- Load project image: Debug->start(ctrl+D)
- Run program: Debug->Run(ctrl+F9)
- RVMDK
- Open the Optimized I2C examples.Uv2 project
- In the build toolbar select the project config:
- STM3210B-EVAL: to configure the project for STM32 Medium-density devices
- Rebuild all files: Project->Rebuild all target files
- Load project image: Debug->Start/Stop Debug Session
- Run program: Debug->Run (F5)
- HiTOP
- Open the HiTOP toolchain, a "using projects in HiTOP" window appears.
- Select open an existing project.
- Browse to open the Optimized I2C examples.htp:
- under STM32F10B_EVAL directory: to select the project for STM32 Medium-density devices.
- under STM32F10C_EVAL directory: to select the project for STM32 Connectivity-Line devices.
- under STM32F10E_EVAL directory: to select the project for STM32 High-density devices
- under STM32F10E_EVAL_XL directory: to select the project for STM32 XL-density devices
- "Download application" window is displayed, click "cancel".
- Rebuild all files: Project->Rebuild all
- Click on ok in the "download project" window.
- Run program: Debug->Go(F5).
- TrueSTUDIO
- Open the TrueSTUDIO toolchain.
- Click on File->Switch Workspace->Other and browse to TrueSTUDIO workspace
directory.
- Click on File->Import, select General->'Existing Projects into Workspace'
and then click "Next".
- Browse to the TrueSTUDIO workspace directory and select the project:
- STM3210B-EVAL: to load the project for STM32 Medium-density devices
- STM3210E-EVAL: to load the project for STM32 High-density devices
- STM3210E_EVAL_XL: to load the project for STM32 XL-density devices
- Under Windows->Preferences->General->Workspace->Linked Resources, add
a variable path named "CurPath" which points to the "FIRMWARE" folder.
- Rebuild all project files: Select the project in the "Project explorer"
window then click on Project->build project menu.
- Run program: Select the project in the "Project explorer" window then click
Run->Debug (F11)
@note
- Low-density Value line devices are STM32F100xx microcontrollers where the
Flash memory density ranges between 16 and 32 Kbytes.
- Low-density devices are STM32F101xx, STM32F102xx and STM32F103xx
microcontrollers where the Flash memory density ranges between 16 and 32 Kbytes.
- Medium-density Value line devices are STM32F100xx microcontrollers where
the Flash memory density ranges between 64 and 128 Kbytes.
- Medium-density devices are STM32F101xx, STM32F102xx and STM32F103xx
microcontrollers where the Flash memory density ranges between 64 and 128 Kbytes.
- High-density devices are STM32F101xx and STM32F103xx microcontrollers where
the Flash memory density ranges between 256 and 512 Kbytes.
- XL-density devices are STM32F101xx and STM32F103xx microcontrollers where
the Flash memory density ranges between 512 and 1024 Kbytes.
- Connectivity line devices are STM32F105xx and STM32F
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
STM32F10xxx I2C optimized examples,I2C master programming examples (DMA, interrupts,polling) 说STM32 I2C不能用的下这个了,这是ST官方经过修改和优化的I2C通讯库,并带有主从I2C应用的例子,本人已经在STM32F103C8T6上应用过,读Cypress PSOC3芯片的I2C已经成功,应用时要注意地址要左移1位,即SLAVE I2C地址左移一位,因为最低位为读写控制位,修改注意: #define ClockSpeed 400000,开始调试时速度用100000即100K #define OwnAddress1 0x28 #define OwnAddress2 0x30 此地址要修改为设备实际地址,注意实际地址左移一位,即Addr*2 Status I2C_Master_BufferRead(I2C_TypeDef* I2Cx, uint8_t* pBuffer, uint32_t NumByteToRead, I2C_ProgrammingModel Mode, uint8_t SlaveAddress)中的SlaveAddress即从设备地址填设备地址左移一位后的地址,写也一样。 本人用STM32 3.5自带的I2C库调了两天没调出来,开始地址也没对,后把此库加入到3.5的库中,不到半天就调通了,兴奋呀。
资源推荐
资源详情
资源评论
收起资源包目录
STM32 I2C优化库【带例子】 (193个子文件)
cstart_thumb2.asm 4KB
cstart_thumb2.asm 4KB
cstart_thumb2.asm 4KB
cstart_thumb2.asm 4KB
cstart_thumb2.asm 4KB
logo.bmp 7KB
stm32f10x_tim.c 105KB
stm32f10x_flash.c 62KB
stm32f10x_rcc.c 50KB
stm32f10x_adc.c 46KB
stm32f10x_i2c.c 43KB
stm32f10x_usart.c 37KB
stm32f10x_fsmc.c 34KB
system_stm32f10x.c 31KB
stm32f10x_can.c 31KB
stm32f10x_spi.c 29KB
stm32f10x_sdio.c 28KB
stm32f10x_dma.c 27KB
I2CRoutines.c 26KB
stm32f10x_gpio.c 19KB
stm32f10x_it.c 19KB
stm32f10x_dac.c 19KB
core_cm3.c 17KB
stm32f10x_cec.c 11KB
stm32f10x_pwr.c 9KB
stm32f10x_rtc.c 8KB
stm32f10x_bkp.c 8KB
misc.c 7KB
stm32f10x_exti.c 7KB
stm32f10x_wwdg.c 6KB
stm32f10x_dbgmcu.c 5KB
stm32f10x_iwdg.c 5KB
main.c 4KB
stm32f10x_crc.c 3KB
stm32f10x_an2824_fw.chm 726KB
.cproject 22KB
.cproject 18KB
.cproject 18KB
.cproject 18KB
.cproject 18KB
Optimized I2C examples.ctx 1KB
Thumbs.db 8KB
Optimized I2C examples.dbi 418B
License.doc 39KB
Optimized I2C examples.ewd 102KB
Optimized I2C examples.ewp 114KB
Optimized I2C examples.eww 176B
stm32f10x.h 607KB
core_cm3.h 84KB
stm32f10x_tim.h 49KB
stm32f10x_rcc.h 30KB
stm32f10x_i2c.h 29KB
stm32f10x_fsmc.h 26KB
stm32f10x_flash.h 25KB
stm32f10x_sdio.h 21KB
stm32f10x_adc.h 21KB
stm32f10x_dma.h 20KB
stm32f10x_can.h 20KB
stm32f10x_gpio.h 19KB
stm32f10x_spi.h 18KB
stm32f10x_usart.h 16KB
stm32f10x_dac.h 15KB
misc.h 9KB
stm32f10x_bkp.h 7KB
stm32f10x_exti.h 7KB
stm32f10x_cec.h 6KB
I2CRoutines.h 5KB
stm32f10x_pwr.h 4KB
stm32f10x_rtc.h 4KB
stm32f10x_iwdg.h 4KB
stm32f10x_dbgmcu.h 4KB
stm32f10x_conf.h 3KB
stm32f10x_wwdg.h 3KB
stm32f10x_it.h 2KB
stm32f10x_crc.h 2KB
system_stm32f10x.h 2KB
CMSIS_Core.htm 56KB
CMSIS_changes.htm 12KB
CMSIS debug support.htm 9KB
Release_Notes.html 32KB
Release_Notes_for_STM32F10x_CMSIS.html 19KB
Release_Notes_for_STM32F10x_StdPeriph_Driver.html 17KB
Optimized I2C examples.htp 56KB
Optimized I2C examples.htp 54KB
Optimized I2C examples.htp 50KB
Optimized I2C examples.htp 50KB
Optimized I2C examples.htp 50KB
stm32f10x_flash.icf 1KB
CMSIS_Logo_Final.jpg 121KB
stm32_flash.ld 5KB
stm32_flash.ld 5KB
stm32_flash.ld 5KB
stm32_flash.ld 5KB
stm32_flash.ld 5KB
Optimized I2C examples.elf.ld 2KB
link.lnk 87B
link.lnk 84B
link.lnk 84B
link.lnk 84B
link.lnk 84B
共 193 条
- 1
- 2
onlineit
- 粉丝: 5
- 资源: 24
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
前往页