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: Code Composer Studio
Hello TI team,
I'm using MSP430F5529LP to communicate with BOOSTXL‑BATPAKMKII via I2C.
This is a code source of a function USCI_B_I2C_masterSendSingleByteWithTimeout from usci_b_i2c.c (msp430 driverlib)
bool USCI_B_I2C_masterSendSingleByteWithTimeout(uint16_t baseAddress, uint8_t txData, uint32_t timeout) { // Creating variable for second timeout scenario uint32_t timeout2 = timeout; //Store current TXIE status uint8_t txieStatus = HWREG8(baseAddress + OFS_UCBxIE) & UCTXIE; //Disable transmit interrupt enable HWREG8(baseAddress + OFS_UCBxIE) &= ~(UCTXIE); //Send start condition. HWREG8(baseAddress + OFS_UCBxCTL1) |= UCTR + UCTXSTT; //Poll for transmit interrupt flag. while((!(HWREG8(baseAddress + OFS_UCBxIFG) & UCTXIFG)) && --timeout) { ; } //Check if transfer timed out if(timeout == 0) { return (STATUS_FAIL); } //Send single byte data. HWREG8(baseAddress + OFS_UCBxTXBUF) = txData; //Poll for transmit interrupt flag. while((!(HWREG8(baseAddress + OFS_UCBxIFG) & UCTXIFG)) && --timeout2) // ======> code block here { ; } //Check if transfer timed out if(timeout2 == 0) { return (STATUS_FAIL); } //Send stop condition. HWREG8(baseAddress + OFS_UCBxCTL1) |= UCTXSTP; //Clear transmit interrupt flag before enabling interrupt again HWREG8(baseAddress + OFS_UCBxIFG) &= ~(UCTXIFG); //Reinstate transmit interrupt enable HWREG8(baseAddress + OFS_UCBxIE) |= txieStatus; return (STATUS_SUCCESS); } void USCI_B_I2C_masterSendMultiByteStart(uint16_t baseAddress, uint8_t txData) { //Store current transmit interrupt enable uint8_t txieStatus = HWREG8(baseAddress + OFS_UCBxIE) & UCTXIE; //Disable transmit interrupt enable HWREG8(baseAddress + OFS_UCBxIE) &= ~(UCTXIE); //Send start condition. HWREG8(baseAddress + OFS_UCBxCTL1) |= UCTR + UCTXSTT; //Poll for transmit interrupt flag. while(!(HWREG8(baseAddress + OFS_UCBxIFG) & UCTXIFG)) { ; } //Send single byte data. HWREG8(baseAddress + OFS_UCBxTXBUF) = txData; //Reinstate transmit interrupt enable HWREG8(baseAddress + OFS_UCBxIE) |= txieStatus; }
After some research on E2E forum I understand that it might be the pull-up resistors on the SDA and SCL issues. Is this the right problem ??
if Yes, How can I set the the pullup resistors in the SDA and SCL pin enabled ??
By the way I put this line into my code but it didn't resolve my problem.
P4REN |= 0x06;
Thank you.
Hello Amine,
Yes, the internal pull-up resistors may be too weak to effectively drive the SDA and SCL lines. Typically, these are external resistors (typically 4.7kOhm) pulled up to VCC (e.g. 1.8V, 3.3V, etc.). Please read through the I2C section in our helpful Solutions to Common eUSCI and USCI Serial Communication Issues on MSP430™ MCUs app note.
Regards,
James
Hello James,
Thank you for your response.
As you can see the BQ27441 schematic on BOOSTXL‑BATPAKMKII , you can see the internal pull-up resistors drive the SDA and SCL lines with values 5.1kOhm. I think it's enough
Also the the BQ27441 on BOOSTXL‑BATPAKMKII work fine with the MSP432P401R without any external pull-up resistors.
I think the problem is with MSP430F5529 configuration and how to set the pullup resistors in the SDA and SCL pin enabled .
If you can help me I will be very thankful.
With the external 5.1kOhm pull-up resistors populated on the BOOSTXL-BATPAKMKII, configuring the internal pull-up resistors in the MSP430F5529 won't really change anything since they'll just be in parallel because the lines are already pulled-up. Thus, I doubt the issue is hardware but software. I noticed in the Fuel Tank MKII Battery BoosterPack™ Plug-in Module (BOOSTXL-BATPAKMKII) User's Guide that the example code was written for MSP432. Please keep in mind that the MSP432 is an ARM-based device while the MSP430F5529 is not. Thus, I would recommend reading through the Migrating to the SimpleLink™ MSP432™ Family app note to figure out what to change for the MSP430F5529 to work.
Regards,
James
**Attention** This is a public forum