Part Number: MSP430FR2475
Hi, Busy bit in UCBxSTATW is always set after I enable I2c with "EUSCI_B_I2C_enable(EUSCI_B1_BASE);" Am i doing something wrong?
I have 10k pull up resitor on SDA and SCL , I measured them and both are high.
Also tried to send a STOP by "HWREG16(EUSCI_B1_BASE + OFS_UCBxCTLW0) |= UCTXSTP;"
void Inicializacion(void)
{
WDT_A_hold(WDT_A_BASE);
//Configuracion DCO con FLL, 12MHz /////////////////////////////
//Variable to store current Clock values
uint32_t clockValue = 0;
// Set DCO FLL reference = REFO
CS_initClockSignal(CS_FLLREF,CS_REFOCLK_SELECT,CS_CLOCK_DIVIDER_1);
// Set ACLK = REFO
CS_initClockSignal(CS_ACLK,CS_REFOCLK_SELECT,CS_CLOCK_DIVIDER_1);
// Set Ratio and Desired MCLK Frequency and initialize DCO
CS_initFLLSettle(CS_MCLK_DESIRED_FREQUENCY_IN_KHZ,CS_MCLK_FLLREF_RATIO);//12mhz
do {
// If it still can't clear the oscillator fault flags after the timeout,
// trap and wait here.
clockValue = CS_clearAllOscFlagsWithTimeout(1000);
} while(clockValue != 0);
//clockValue = CS_getSMCLK ();//debug
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4, I2CSCL, GPIO_PRIMARY_MODULE_FUNCTION);
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4, I2CSDA, GPIO_PRIMARY_MODULE_FUNCTION);
PMM_unlockLPM5();
//I2C 400kbps///////////////////////////////////////////////////////////////
EUSCI_B_I2C_initMasterParam param = {0};
param.selectClockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK;
param.i2cClk = CS_getSMCLK();
param.dataRate = EUSCI_B_I2C_SET_DATA_RATE_400KBPS;
param.byteCounterThreshold = 0;
param.autoSTOPGeneration = EUSCI_B_I2C_NO_AUTO_STOP;
//__delay_cycles(500);
EUSCI_B_I2C_initMaster(EUSCI_B1_BASE, ¶m);
//Specify slave address
EUSCI_B_I2C_setSlaveAddress(EUSCI_B1_BASE, SLAVE_ADDRESS);
//Set Master in receive mode
EUSCI_B_I2C_setMode(EUSCI_B1_BASE,EUSCI_B_I2C_TRANSMIT_MODE);
//Enable I2C Module to start operations
EUSCI_B_I2C_enable(EUSCI_B1_BASE);
__bis_SR_register(GIE); // Enable interrupts
//init TLC
while(EUSCI_B_I2C_isBusBusy (EUSCI_B1_BASE));//debug
}