7747 views|0 replies

22

Posts

0

Resources
The OP

stm32 i2c control io expansion chip tca6416a verification [Copy link]

CPU: stm32f103cbt6 IO expansion chip: tca6416a Interface: i2c There are many discussions about stm32 hardware i2c on the forum. The reason is that the stm32 hardware i2c design is relatively complex and program debugging is prone to errors. Reading the state of the tca6416a input port is similar to reading EEPROM, so at the beginning, I referred to the code for reading EEPROM, and the debugging always died at the following place:
  1. /* Send TCA6416A address for write */ I2C_Send7bitAddress(I2C1, TCA6416A_ADDR, I2C_Direction_Transmitter); /* Test on EV6 and clear it */ while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));
复制代码
Like many people on the forum, I gave up hardware i2c after a long time and turned to simulated i2c. It is easier to simulate i2c code, just look at the timing diagram and write it, but the debugging can never get the result. After the master sends data, it can't get the slave's response. I am depressed and suspect that there is a problem with the hardware. Check whether the chip pins are poorly soldered, everything is OK; SCL and SDA need to add pull-up resistors, and I added 10K pull-up resistors; The problem found at the end is: the pull-up resistor of SDA is measured as 2M, it is obviously a 103 resistor, why is it measured as 2M? I don’t know if it is not soldered well or the soldering is broken. I changed a 10K resistor and soldered it, and the simulated i2c test was OK. I was unwilling to use simulated i2c, so I had to try hardware i2c, which took another half a day, adjusting the clock frequency and i2c rate, and finally debugged it through. Leftover question: There is a serial port sending part in the code. When running the program in stm32, the next time you debug, after clicking the debug button, but before clicking the run button, the serial port will automatically send 0x00. The serial port will automatically send 0x00 only after clicking the debug button or when downloading the code. This situation does not occur at other times. Why? [ This post was last edited by gaofeisz_sibet on 2013-3-14 16:21 ]
This post is from stm32/stm8

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

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