Part Number: MSP430FR5969
Hello,
Same issue here on FR5969 without solution transmitting the correct slave address.
I am trying to send data to an OLED display 126x64 0.96" but I can't get a reply from it.
I am wondering if this can be an issue with address sending from MCU since the display works on another MCU.
However, on the oscilloscope I can see that address is sent, but 8 bit data won't follow.
I get stuck in the same loop: while (!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) ;
Is there anything I can do to bypass the acknowledgement bit from the slave?
Here is my complete code:
#include "driverlib.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#define Slave_Address 0x78
void main (void)
{
WDT_A_hold(WDT_A_BASE);
PM5CTL0 &= ~LOCKLPM5;
CS_setDCOFreq(CS_DCORSEL_0,CS_DCOFSEL_3);
CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);
CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_2);
GPIO_setAsPeripheralModuleFunctionInputPin(
GPIO_PORT_P1,
GPIO_PIN6 + GPIO_PIN7,
GPIO_SECONDARY_MODULE_FUNCTION );
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 = 1;
param.autoSTOPGeneration = EUSCI_B_I2C_NO_AUTO_STOP;
EUSCI_B_I2C_initMaster(EUSCI_B0_BASE, ¶m);
EUSCI_B_I2C_setSlaveAddress(EUSCI_B0_BASE, Slave_Address); // INDIRIZZO DELLO SLAVE
EUSCI_B_I2C_setMode(EUSCI_B0_BASE, EUSCI_B_I2C_TRANSMIT_MODE); // DEFINISCO uC COME MASTER IN TRASMISSIONE
EUSCI_B_I2C_enable(EUSCI_B0_BASE); // ABILITO LA I2C
GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0); //LED2
uint8_t I2C_msg = 0xAA;
GPIO_setOutputHighOnPin (GPIO_PORT_P1, GPIO_PIN0); // ALZO IL PIN SUL LED
while (1)
{
EUSCI_B_I2C_masterSendSingleByte(EUSCI_B0_BASE, I2C_msg);
}
}