Tool/software: Code Composer Studio
Hello,
i try to connect the Tof Sensor VL53L0X with MSP432 Launchpad via I2C.
The sensor is connected as follows:
VCC => 3.3V
GND => GND
SCL => P6.5
SDA => P6.4
GPIO1 => not connected
XSHUT => P6.0
I want to read register 0xC0 from the sensor after the sensor has started, but unfortunately I can't get it to work. My code looks like this so far:
#include "driverlib.h"
#define SLAVE_ADDRESS_1 0x29
eUSCI_I2C_MasterConfig i2cConfig =
{
        EUSCI_B_I2C_CLOCKSOURCE_SMCLK,          // SMCLK Clock Source
        3000000,                               // 3Mhz
        EUSCI_B_I2C_SET_DATA_RATE_400KBPS,      // Desired I2C Clock of 400khz
        0,                                      // No byte counter threshold
        EUSCI_B_I2C_NO_AUTO_STOP
};
void TofSensor_Init(void)
{
        
    // Configure P6.4 for EUSCI_B1_SPI_I2C EUSCI_B1_SPI_I2C.SCL P6.5 for EUSCI_B1_SPI_I2C EUSCI_B1_SPI_I2C.SDA
         MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6, GPIO_PIN4 + GPIO_PIN5, GPIO_PRIMARY_MODULE_FUNCTION);
         
        MAP_GPIO_setAsOutputPin(GPIO_PORT_P6, GPIO_PIN0);
        /* Initializing I2C Master to SMCLK at 400khz with no autostop */
        MAP_I2C_initMaster(EUSCI_B1_BASE, &i2cConfig);
        /* Specify slave address */
        MAP_I2C_setSlaveAddress(EUSCI_B1_BASE, SLAVE_ADDRESS_1);
        /* Enable I2C Module to start operations */
        MAP_I2C_enableModule(EUSCI_B1_BASE);
        //Boot sensor
        MAP_GPIO_setOutputHighOnPin(GPIO_PORT_P6,GPIO_PIN0);
        __delay_cycles(1000);// Delay for sensor to be ready
        MAP_I2C_setMode(EUSCI_B1_BASE, EUSCI_B_I2C_TRANSMIT_MODE);
        MAP_I2C_masterReceiveStart(EUSCI_B1_BASE);
        uint8_t address=0xC0;
        MAP_I2C_masterSendSingleByte(EUSCI_B1_BASE,address);
        MAP_I2C_setMode(EUSCI_B1_BASE, EUSCI_B_I2C_RECEIVE_MODE);
        MAP_I2C_masterReceiveMultiByteStop(EUSCI_B1_BASE);
}
Can anyone explain to me how I can read the register? Can someone explain to me how to write data into the register?
I have already tried some entries from the community, but without success.
 
				 
		 
					 
                           
				