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.

Problem with polling eSPI(eUSCI_B0) busy

Hi! I have wrong result when try to poll eSPI busy status

while(eSPI_BUSY == eSPI_isBusy(__MSP430_BASEADDRESS_EUSCI_B0__)

Using latest CCS5.5 with Grace 2.2

function implementation:

unsigned char eSPI_isBusy (unsigned int baseAddress)
{
    //Return the bus busy status.
    return (HWREG(baseAddress + OFS_UCAxSTATW) & UCBBUSY);
}

But UCBBUSY bit adress is not equal to UCBUSY bit adress according to slau272b.pdf

Is that a bug or a feature?)

  • Indeed, UCBBUSY checks whether the BUS is busy in I2C mode (conforming with the comment, which also makes no sense for SPI), while UCBUSY checks whether the USCI itself is busy.

    Since the function is called eSPI_isBusy, this is obviously a bug.

    And it's not the only one: According to slau272a, UCAxSTATW is offset 0x0a while UCBxSTATW is offset 0x08 to the module base. So the function will only read the correct status register for USCIAx, and then check the wrong bit.

    I wonder whether it has been ever tested. Apparently, it was carelessly copied from eI2C_isBusBusy (or so) and the only adjustment to UCAxSTATW was wrong too.

    Of course it is also possible that the users guide is wrong about the offsets.

**Attention** This is a public forum