2558 views|2 replies

466

Posts

0

Resources
The OP
 

stm32 i2c slave mode help [Copy link]

This post was last edited by weizhongc on 2017-11-17 09:40 (The development platform hardware uses a 16M external crystal, the cpu clock is set to 48M, mcu stm32f103cbt6) In the i2c slave mode, it is found that only read operations can be performed, and it can be read all the time. If it is changed to a write operation at this time, problems will occur, and the i2c cannot be restored from the new configuration afterwards. (Host i2c read operation W_addr Reg R_addr R_data R_data) (Host i2c write operation W_addr Reg R_data R_data R_data) We thought it was a problem with the clock bus. Later we searched the clock bus and found that SYSCLK PCLK1 and the i2c clock configuration were correct. The following are the values printed out by the corresponding registers during the i2c configuration process DBG >> RCC->CFGR 53040A DBG >> I2C1->CR2 0x18 DBG >> I2C1->CR1 0x0 DBG >> I2C1->TRISE 0x8 DBG >> I2C1->CCR 0xc004 DBG >> I2C1->CR1 0x1 DBG >> I2C1->CR1 0x401 DBG >> I2C1->OAR1 0x4030 Has anyone encountered a similar problem? Please give me some advice. Thank you. I asked st's fae, and then I followed his advice and solved the problem. I just used the st cpal i2c library, and I just moved it over, and I don't need to set it up. https://my.s t.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-library- expansion/stsw-stm32127.license%3d1510813611433.product%3dSTSW-STM32127.html


This post is from stm32/stm8

Latest reply

It is recommended to use io simulation to implement i2c master/slave mode  Details Published on 2017-11-16 15:29
 

750

Posts

3

Resources
2
 
It is recommended to use io simulation to implement i2c master/slave mode
This post is from stm32/stm8
 
 

466

Posts

0

Resources
3
 
It's done. I studied it for several days but there were always bugs. Later I asked the fae of st. They suggested using cpal library, so I used cpal library and it was done.
This post is from stm32/stm8
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list