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.
Part Number: MSP432P401R
Tool/software: Code Composer Studio
Hi all:
I ran into problems when I ran the I2C demo program on my MSP432 red development board.
The demo program is:i2c_master_rw_repeated_start-master_code
When my program executes the following sentence, it falls into the limitless wait。
/* Send start and the first byte of the transmit buffer. */ MAP_I2C_masterSendMultiByteStart(EUSCI_B0_BASE, TXData[0]);
I found through single step debugging that I fell into a dead cycle when the following statement was executed
//Poll for transmit interrupt flag and start condition flag. while (BITBAND_PERI(EUSCI_B_CMSIS(moduleInstance)->CTLW0, EUSCI_B_CTLW0_TXSTT_OFS) || !BITBAND_PERI(EUSCI_B_CMSIS(moduleInstance)->IFG, EUSCI_B_IFG_TXIFG0_OFS));
I looked at the description of the demo program
/****************************************************************************** * MSP432 I2C - EUSCI_B0 I2C Master TX bytes to MSP432 Slave - Repeated Start * * Description: This demo connects two MSP432 's via the I2C bus. The master * transmits to the slave. This is the MASTER CODE. It continuously * transmits an array of data and demonstrates how to implement an I2C * master transmitter sending multiple bytes followed by a repeated start, * followed by a read of multiple bytes. This is a common operation for * reading register values from I2C slave devices such as sensors. The * transaction for the I2C that is written looks as follows: * * _________________________________________________________ * | Start | | Start | | | * | 0x48Addr | 0x04 | 0x48Addr | <10 Byte Read> | Stop | * | W | | R | | | * |__________|______|__________|___________________|_______| * * ACLK = n/a, MCLK = HSMCLK = SMCLK = BRCLK = default DCO = ~3.0MHz * * /|\ /|\ * MSP432P401 10k 10k MSP432P401 * slave | | master * ----------------- | | ----------------- * | P1.6/UCB0SDA|<-|----+->|P1.6/UCB0SDA | * | | | | | * | | | | | * | P1.7/UCB0SCL|<-+------>|P1.7/UCB0SCL | * | | | | * *****************************************************************************/
The description indicates that this is the need for two MSP432 development boards to complete the DEMO, and the SCL SDA needs the pull resistance of the 10K.
And I just used a development board, and SCL SDA is in a state of suspension to run the demo program. Whether this can cause a problem with the program?
If this is not the reason, what is the other reason? Because I used this reference to communicate with the power chip I produced on the chip, but it was not successful. I can not use an oscilloscope to capture any
SCLK SDA waveform.
thanks a lot!
Alex,
When you say
Alex824 said:And I just used a development board, and SCL SDA is in a state of suspension to run the demo program. Whether this can cause a problem with the program?
Do you mean you are using only one dev board?
This example is built on the premises that their are two boards, a master and a slave. If you don't have a second board running the slave portion of the example code then you will always get stuck at the place where it's polling for the transmit interrupt/start condition flag inside of the masterSendMultiByteStart function. Especially because you don't have any device to receive an ack from or any data from or transmit to, the code will just hang.
Also please make sure you use the correct resistors.
Please read section 24 to learn more about the I2C. www.ti.com/.../slau356g.pdf
**Attention** This is a public forum