This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Hello, we are interfacing the MSP430FR5969 with air quality sensors such as SGP30 and SEN55 via I2C Communication. Unfortunately, we have not been able to successfully read and write data to the registers of the microcontroller. We have been following the references in Code Composer Studio (CCS) but our code is still not working. We have double checked the sensors and other hardware peripherals, everything is working. Only the software side still needs adjusting. The code we are using and the output is shown below:
I am only using the MSP430 as the Master and SGP30 as the Slave in this code.
^ This the code that we are using for the MSP430-SGP30 connection.
^ This is the output.
Are you playing with a SGP30 EVM provided by TI? Can you check the datasheet of SGP30?
Hello, no we are not using the SGP30EVM by TI. We are using the M5Stack SGP30: https://shop.m5stack.com/products/tvoc-eco2-gas-unit-sgp30?srsltid=AfmBOorDw_PXT8iAoopx5bpm1J8sCkKxm5qf9idUKOx7tE-Pg3279z_E which also has a Sensirion Chip. The datasheet is attached here and we have verified the pins that we are using.
Sensirion_Gas_Sensors_Datasheet_SGP30.pdf
I don't have your equipment, but from reading the code:
---------------
> P1SEL0 |= BIT6 | BIT7; // Set P1.6 and P1.7 to I2C mode
> P1SEL1 &= ~(BIT6 | BIT7);
Looking at data sheet (SLAS704G) Table 6-51, you should be using PSEL1=1 and PSEL0=0. Try instead:
> P1SEL1 |= BIT6 | BIT7; // Set P1.6 and P1.7 to I2C mode
> P1SEL0 &= ~(BIT6 | BIT7);
---------------
> UCB0CTLW1 = UCASTP_2; // auto STOP mode
Using UCASTP=2 requires also setting UCB0TBCNT (under reset) which I don't see being done. Your ISR seems to issue a Stop at the right time, so I recommend you just remove this line.
---------------
I2C_Master_ReadReg and I2C_Master_WriteReg start the operation but don't wait for it to complete, so the next transaction will override the current one. Looking at the ISR, I suggest you insert the line "LPM0;" between issuing the Start and waiting for the Stop. This will put the CPU in Low Power Mode until the ISR wakes it up at the end of the transaction.
**Attention** This is a public forum