Hello,
I have a question regarding using multiple I2C busses on the DA14585. I am working with MCP9600 thermocouple amplifiers which have 8 possible addresses each. I need to connect 64 of these sensors to a DA14585 and read them at ~1Hz.
我计划设置8个独立的公交车,每个与their own data line and one shared clock (using a total of 9 pins on the DA14585). The DA14585 will setup the I2C controller based on which bus it wants to talk to and when it's done with this bus, to let the data line stay high. From an I2C perspective, the chips on the inactive bus would be seeing constant 1's when their bus is not active, this is preferable to the other configuration where each has its own clock and the chip sees constant stop/start commands.
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){ RESERVE_GPIO(,ALL_SCL_PORT, ALL_SCL_PIN, PID_I2C_SCL); RESERVE_GPIO(,BUS1_SDA_PORT, BUS1_SDA_PIN, PID_I2C_SDA);//???? RESERVE_GPIO(,BUS2_SDA_PORT, BUS2_SDA_PIN, PID_I2C_SDA);//???? remaining pins... GPIO_ConfigurePin(ALL_SCL_PORT, ALL_SCL_PIN, INPUT, 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, INPUT, PID_I2C_SDA, false); for(all other busses) GPIO_ConfigurePin(BUS1_SDA_PORT, BUS1_SDA_PIN, INPUT, PID_GPIO, false); break; case 2: GPIO_ConfigurePin(BUS2_SDA_PORT, BUS2_SDA_PIN, INPUT, PID_I2C_SDA, false); for(all other busses) GPIO_ConfigurePin(BUS1_SDA_PORT, BUS1_SDA_PIN, INPUT, PID_GPIO, false); break; case 3: remaining busses... } void send_temperature(){ for(all 8 busses){ select_MCP_BUS(bus#) for(all 8 MCPs){ sample_send_temp(MCP#) } } }
I know I could use an I2C mux to accomplish this, but we are limited in space and it is just an extra component that could fail


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?
Thanks, 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.
Thanks, PM_Dialog