Hallo Leute,
ich arbeite zur Zeit mit dem I²C-Modul vom TMS320C6713. Ich möchte zum
einen ein Eeprom und einen I²C-Lichtsensor an den Bus hängen. Schließe
ich ein Device alleine an funktioniert alles. Sobald aber beide am Bus
hängen funktioniert nur das mit der Device-Nummer 0, welches als erstes
initialisiert wurde. Will ich vom zweiten etwas lesen, ist der Bus im
Ruhezustand und es wird nicht einmal eine Startbedingung oder eine
Adresse gesendet. Wo könnte hier das Problem liegen?
Das ist meine Initialisierungs-Funktion:
1 | /* ucI2CDevice -> 0 for Sensor
|
2 | 1 for Eeprom
|
3 | */
|
4 | void Hardware_InitI2CModule(unsigned char ucI2CDevice)
|
5 | {
|
6 | // initialize error flag
|
7 | g_efHardware_ErrorFlags.boI2CTimoutOccured = FALSE;
|
8 | // Configurate the bus
|
9 | I2C_Config myI2CConfig =
|
10 | {
|
11 | I2C_OWN_ADDRESS, // Own Adress register (0x00)
|
12 | 0x00000000, // Interrupt mask register
|
13 | I2C_CLOCK_DIVIDERS, // Clock control low register // 0x2c = 44d
|
14 | I2C_CLOCK_DIVIDERS, // Clock control high register // 0x2c = 44d
|
15 | 0x00000000, // Data count register
|
16 | g_arriiHardware_I2CInfo[ucI2CDevice].ucDeviceAddress, // Slave address register which is saved in an array accordingly to the device number
|
17 | 0x00000000, // Mode register
|
18 | I2C_PRESCALER // Prescaler register
|
19 | };
|
20 |
|
21 | g_arriiHardware_I2CInfo[ucI2CDevice].ihDeviceHandle = I2C_open(ucI2CDevice, I2C_OPEN_RESET);
|
22 |
|
23 | if (g_arriiHardware_I2CInfo[ucI2CDevice].ihDeviceHandle == INV) // is handle valid ??
|
24 | {
|
25 | // not valid
|
26 | ErrorHdl_ThrowExcptn(EN_EXCEPTION_I2C_COMMUNICATION_TIMEOUT, "No valid I2C Handle", EL_EXCEPTION_HIGHEST_PRIO);
|
27 | return;
|
28 | };
|
29 |
|
30 | I2C_reset(g_arriiHardware_I2CInfo[ucI2CDevice].ihDeviceHandle); // Reset the modul
|
31 |
|
32 | I2C_config(g_arriiHardware_I2CInfo[ucI2CDevice].ihDeviceHandle, &myI2CConfig); // Configure the I2C module
|
33 | // only set the clock timing
|
34 | // other configurations later
|
35 | }
|