Hello,
我对DA14585上的多个I2C总线有所了解。我正在使用MCP9600热电偶放大器,每个放大器每个都有8个可能的地址。我需要将这些传感器中的64个连接到DA14585,并在〜1Hz读取它们。
我的计划是设置8个单独的总线,每个总线都有自己的数据线和一个共享时钟(在DA14585上使用总共9个引脚)。DA14585将基于它想要与该总线完成的哪些总线进行配置的I2C控制器,让数据线保持高。从I2C的角度来看,非活动总线上的芯片会看到常量1的总线时,当它们的总线未激活时,这对于其他配置是优选的,其中每个配置都有其自己的时钟,并且芯片看到恒定的停止/启动命令。
The only thing I am not sure of is how to accomplish this in the code. I would like to set it up like this so that way I can switch through the busses. Is the RESERVE_GPIO() command necessary, or would that confuse things? Otherwise I assume this would work
void init_mcp(void){letail_gpio(,all_scl_port,all_scl_pin,pid_i2c_scl);保留_gpio(,bus1_sda_port,bus1_sda_pin,pid_i2c_sda); // ????保留_gpio(,bus2_sda_port,bus2_sda_pin,pid_i2c_sda); // ????剩余的引脚... gpio_configurepin(all_scl_port,all_scl_pin,输入,pid_i2c_scl,false);void select_mcp_bus(uint8_t bus_number){switch bus_number:case 1:gpio_configurepin(bus1_sda_port,bus1_sda_pin,输入,pid_i2c_sda,false);for(所有其他总护)GPIO_CONFIGUREPIN(BUS1_SDA_PORT,BUS1_SDA_PIN,INPUT,PID_GPIO,FALSE);休息;案例2:gpio_configurepin(bus2_sda_port,bus2_sda_pin,输入,pid_i2c_sda,false);for(所有其他总护)GPIO_CONFIGUREPIN(BUS1_SDA_PORT,BUS1_SDA_PIN,INPUT,PID_GPIO,FALSE);休息; case 3: remaining busses... } void send_temperature(){ for(all 8 busses){ select_MCP_BUS(bus#) for(all 8 MCPs){ sample_send_temp(MCP#) } } }
我知道我可以使用一个i2c mux来完成这一点,但我们的空间有限,它只是一个可能失败的额外组件
设备:
Hi ahiggs,
谢谢你的问题在线和德泰led description. We haven’t such an example demonstrating the described functionality, but this might be a possible approach. Every time that you would like to change the “BUS_NUMBER”, you should re-configure the appropriate GPIO as I2C pin. Did you test this on your HW setup?
谢谢,PM_DIALOG.
Hello,
Thanks for your prompt reply. I have only tested the hardware setup with MCP9600s on one of the buses but it worked. I have not yet designed the boards to test the full system. If anyone is interested, here's a snippet of code for this setup
Hi ahiggs,
Thanks for your inputs. If you have any other question, please raise a new forum thread.
谢谢,PM_DIALOG.