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.

RTOS/MSP432E411Y: I2C driver blocks forever for some I2C errors

Part Number: MSP432E411Y

Tool/software: TI-RTOS

Dear TI-Experts,

I have some trouble with the TI-Driver for I2C, I2CMSP432E4.c.

When I send a software reset to a connected device, it not completes I2C communication in a regular way.

In I2CMSP432E4_hwiFxn this gets detected as errStatus == 0x8 (I2C_MASTER_ERR_DATA_ACK). Unfortunately this error does not unlock the semaphore the transfer function is pending on. Thus the whole application cannot work any longer. Could you solve this issue and send me a workaround?

I need a solution very soon, because it is blocking our software release!

  • Hello,

        Just to clarify, the issue is that the 'attempt' to send the STOP bit is unsuccessful.  Taken from I2CMSP432E4.c : 

        /* Check for I2C Errors */
        if ((errStatus == I2C_MASTER_ERR_NONE) ||
            (object->mode == I2CMSP432E4_ERROR)) {
            /* No errors, now check what we need to do next */
        }
        else {
            /* Some sort of error happened! */
            object->mode = I2CMSP432E4_ERROR;
    
            if (errStatus & (I2C_MASTER_ERR_ARB_LOST | I2C_MASTER_ERR_ADDR_ACK)) {
                completeTransfer((I2C_Handle) arg);
            }
            else {
                /* Try to send a STOP bit to end all I2C communications immediately */
                /*
                 * I2C_MASTER_CMD_BURST_SEND_ERROR_STOP -and-
                 * I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP
                 * have the same values
                 */
                I2CMasterControl(hwAttrs->baseAddr,
                    I2C_MASTER_CMD_BURST_SEND_ERROR_STOP);
            }
        }

    For the software reset, is the reset applied without any consideration of the system operation.

    Thanks,

    Chris

  • Hi Chris,

    the software reset to the device is sent during its initialization to get a defined state after a software restart (w/o power cycling, thus no hardware reset of the device).

    If "the 'attempt' to send the STOP bit is unsuccessful" I cannot say. At least the interrupt handler returns, such that the idle functions get called.

    The device does not acknowledge the last data byte, thus errStatus == 0x8 (I2C_MASTER_ERR_DATA_ACK) is reasonable.

    The issue is I.M.H.O., that the completeTransfer function gets NOT called, thus no transferCallbackFxn (blockingCallback) call and no posting of semaphore "transferComplete" in blocking mode.
  • Hello Chris,

    any news about the issue?
  • Sven. I have had a miss-step of sorts and regret that I am no further along. I believe that I have corrected the issue and have reached out to some colleagues for assistance.

    Chris
  • I2CMSP432E4.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    /*
    * Copyright (c) 2017-2018, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    #include <stdint.h>
    #include <stdbool.h>
    #include <stdlib.h>
    #include <ti/devices/msp432e4/inc/msp432.h>
    #include <ti/devices/msp432e4/driverlib/gpio.h>
    #include <ti/devices/msp432e4/driverlib/i2c.h>
    #include <ti/devices/msp432e4/driverlib/inc/hw_i2c.h>
    #include <ti/devices/msp432e4/driverlib/types.h>
    #include <ti/devices/msp432e4/driverlib/sysctl.h>
    #include <ti/drivers/dpl/ClockP.h>
    #include <ti/drivers/dpl/HwiP.h>
    #include <ti/drivers/dpl/SemaphoreP.h>
    #include <ti/drivers/gpio/GPIOMSP432E4.h>
    #include <ti/drivers/i2c/I2CMSP432E4.h>
    #include <ti/drivers/Power.h>
    #include <ti/drivers/power/PowerMSP432E4.h>
    /*
    * Specific I2C CMD MACROs that are not defined in driverlib/i2c.h are defined
    * here. Their equivalent values are taken from the existing MACROs in
    * driverlib/i2c.h
    */
    #ifndef I2C_MASTER_CMD_BURST_RECEIVE_START_NACK
    #define I2C_MASTER_CMD_BURST_RECEIVE_START_NACK I2C_MASTER_CMD_BURST_SEND_START
    #endif
    #ifndef I2C_MASTER_CMD_BURST_RECEIVE_STOP
    #define I2C_MASTER_CMD_BURST_RECEIVE_STOP I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP
    #endif
    #ifndef I2C_MASTER_CMD_BURST_RECEIVE_CONT_NACK
    #define I2C_MASTER_CMD_BURST_RECEIVE_CONT_NACK I2C_MASTER_CMD_BURST_SEND_CONT
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Please find the attached.  

        else {
            /* Error Handling */
            if ((errStatus & (I2C_MASTER_ERR_ARB_LOST | I2C_MASTER_ERR_ADDR_ACK)) ||
                (object->mode == I2CMSP432E4_IDLE_MODE))  {
                /* STOP condition already occurred, complete transfer */
                object->mode = I2CMSP432E4_ERROR;
                completeTransfer((I2C_Handle) arg);
            }
            else {
                /* Error occurred during a transfer, send a STOP condition */
                object->mode = I2CMSP432E4_ERROR;
                I2CMasterControl(hwAttrs->baseAddr,
                    I2C_MASTER_CMD_BURST_SEND_ERROR_STOP);
            }
        }

    Regards,

    Chris

  • Sven,
    Did this fix, address your specific issue? I would like to provide some feedback to the driver team if possible.

    Regards,
    Chris
  • Hello Chris,

    thank you for providing the fix. I put it already into the project, but I'm currently busy with some other issue. I expect to be able to test the fix in one or two days. I'll keep you informed about the result.

  • Hello Chris,

    the fix is working well.
    Thank you very much for the good support!

**Attention** This is a public forum