Hello,
Thanks for the reply! I believe I'm already doing that. This is my full hardware_init.c:
/* Enable clock for PORTs */
CLOCK_SYS_EnablePortClock(PORTA_IDX);
CLOCK_SYS_EnablePortClock(PORTB_IDX);
CLOCK_SYS_EnablePortClock(PORTE_IDX);
/* Enable I2C pins */
configure_i2c_pins(0);
/* Init board clock */
BOARD_ClockInit();
dbg_uart_init();
Where the configure_i2c_pins(0) is:
void configure_i2c_pins(uint32_t instance)
{
switch(instance) {
case I2C0_IDX: /* I2C0 */
/* Affects PORTE_PCR24 register */
PORT_HAL_SetMuxMode(PORTE,24u,kPortMuxAlt5);
PORT_HAL_SetOpenDrainCmd(PORTE,24u,true);
/* Affects PORTE_PCR25 register */
PORT_HAL_SetMuxMode(PORTE,25u,kPortMuxAlt5);
PORT_HAL_SetOpenDrainCmd(PORTE,25u,true);
break;
case I2C1_IDX: /* I2C1 */
/* Affects PORTC_PCR10 register */
PORT_HAL_SetMuxMode(PORTC,10u,kPortMuxAlt2);
PORT_HAL_SetOpenDrainCmd(PORTC,10u,true);
/* Affects PORTC_PCR11 register */
PORT_HAL_SetMuxMode(PORTC,11u,kPortMuxAlt2);
PORT_HAL_SetOpenDrainCmd(PORTC,11u,true);
break;
default:
break;
}
}
I've tested both the dac/adc operation and i2c operation separately and they seem to work. When I try to integrate both something seems to be wrong with the i2c line. The i2c line is connected to a bluetooth module and the bluetooth module stops working when I try setting up both i2c and adc at the same time. The mcu is acting a slave for i2c. Could it be something with how I initialize the i2c slave and intialize the adc hardware?
I tried calling 'I2C_DRV_SlaveInit(BOARD_I2C_INSTANCE, &userConfig, &slave);' before and after I configure the adc/dac channel