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.

BOOSTXL-DRV8323RS: Fault after READ via SPI

Part Number: BOOSTXL-DRV8323RS
Other Parts Discussed in Thread: DRV8323, , LAUNCHXL-F280025C

Tool/software:

Hi,

My custom board use DRV8323RS, use GPIO11 as CS pin, download the universal_motorcontrol_lab, debug run to see if it can communicate with DRV chip, what I did : 

1. setup GPIO, it's my custom board, I use GPIO11 as CS pin

    GPIO_setPinConfig(GPIO_11_SPIA_STE);
    GPIO_setDirectionMode(11, GPIO_DIR_MODE_OUT);
    GPIO_setPadConfig(11, GPIO_PIN_TYPE_STD);

2. inside DRV8323_setupSPI function, I insert my code to make sure the default values can be loaded (sorry I don't have logic analyzer)

    drvDataNew0 to drvDataNew6 are for statReg00 to statReg06 

    after DRV8323_setupSPI is called, its default values was READ without issues (which is according to DRV's manual)

    drvDataNew0    = 0
    drvDataNew1    = 0
    drvDataNew2    = 0
    drvDataNew3    = 1023
    drvDataNew4    = 2047
    drvDataNew5    = 345
    drvDataNew6    = 643

void DRV8323_setupSPI(DRV8323_Handle handle, DRV8323_VARS_t *drv8323Vars)
{
    DRV8323_Address_e drvRegAddr;
    uint16_t drvDataNew;

    // Set Default Values
    // Manual Read/Write
    drv8323Vars->manReadAddr  = 0;
    drv8323Vars->manReadData  = 0;
    drv8323Vars->manReadCmd = false;
    drv8323Vars->manWriteAddr = 0;
    drv8323Vars->manWriteData = 0;
    drv8323Vars->manWriteCmd = false;

    // Read/Write
    drv8323Vars->readCmd  = false;
    drv8323Vars->writeCmd = false;

    // Read registers for default values
    // Read Status Register 0
    drvRegAddr = DRV8323_ADDRESS_STATUS_0;
    drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
    drv8323Vars->statReg00.all = drvDataNew;

    drvDataNew0 = drvDataNew;

    // Read Status Register 1
    drvRegAddr = DRV8323_ADDRESS_STATUS_1;
    drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
    drv8323Vars->statReg01.all = drvDataNew;

    drvDataNew1 = drvDataNew;

      // Read Control Register 2
    // all bit default value are 0, 6*PWM Mode
    drvRegAddr = DRV8323_ADDRESS_CONTROL_2;
    drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
    drv8323Vars->ctrlReg02.all = drvDataNew;

    drvDataNew2 = drvDataNew;

    // Read Control Register 3
    // all bit default value are 1, IDRIVEP_HS=1000mA, IDRIVEN_HS = 2000mA
    drvRegAddr = DRV8323_ADDRESS_CONTROL_3;
    drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
    drv8323Vars->ctrlReg03.all = drvDataNew;

    drvDataNew3 = drvDataNew;

    // Read Control Register 4
    // all bit default value are 1, TDRIVE=400ns, IDRIVEP_LS=1000mA, IDRIVEN_LS = 2000mA
    drvRegAddr = DRV8323_ADDRESS_CONTROL_4;
    drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
    drv8323Vars->ctrlReg04.all = drvDataNew;

    drvDataNew4 = drvDataNew;

    // Read Control Register 5
    // DEAD_TIME=100ns, OCP_DEG=4us, VDS_LVL=0.75V
    drvRegAddr = DRV8323_ADDRESS_CONTROL_5;
    drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
    drv8323Vars->ctrlReg05.all = drvDataNew;

    drvDataNew5 = drvDataNew;

    // Read Control Register 6
    // DEAD_TIME=100ns, OCP_DEG=4us, VDS_LVL=0.75V
    drvRegAddr = DRV8323_ADDRESS_CONTROL_6;
    drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
    drv8323Vars->ctrlReg06.all = drvDataNew;

    drvDataNew6 = drvDataNew;

    return;
} // end of DRV8323_setupSPI() function

until now I am sure the communication with DRV is OK especially GPIO CS pin working !!!

=============================================

===== the weird thing happened when READ again =====

=============================================

when I try to READ the latest update value via HAL_readDRVData(motorHandle_M1->halMtrHandle, &drvicVars_M1) inside main.c loop

and force the READ action by set drv8323Vars->readCmd = true;

void DRV8323_readData(DRV8323_Handle handle, DRV8323_VARS_t *drv8323Vars)
{
    DRV8323_Address_e drvRegAddr;
    uint16_t drvDataNew;

    drv8323Vars->readCmd = true;

    if(drv8323Vars->readCmd)
    {
        // Read registers for default values
        // Read Status Register 0
        drvRegAddr = DRV8323_ADDRESS_STATUS_0;
        drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
        drv8323Vars->statReg00.all  = drvDataNew;

        // Read Status Register 1
        drvRegAddr = DRV8323_ADDRESS_STATUS_1;
        drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
        drv8323Vars->statReg01.all  = drvDataNew;

        // Read Control Register 2
        drvRegAddr = DRV8323_ADDRESS_CONTROL_2;
        drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
        drv8323Vars->ctrlReg02.all  = drvDataNew;

        // Read Control Register 3
        drvRegAddr = DRV8323_ADDRESS_CONTROL_3;
        drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
        drv8323Vars->ctrlReg03.all  = drvDataNew;

        // Read Control Register 4
        drvRegAddr = DRV8323_ADDRESS_CONTROL_4;
        drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
        drv8323Vars->ctrlReg04.all  = drvDataNew;

        // Read Control Register 5
        drvRegAddr = DRV8323_ADDRESS_CONTROL_5;
        drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
        drv8323Vars->ctrlReg05.all  = drvDataNew;

        // Read Control Register 6
        drvRegAddr = DRV8323_ADDRESS_CONTROL_6;
        drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
        drv8323Vars->ctrlReg06.all  = drvDataNew;


        drv8323Vars->readCmd = false;
    }

    // Manual read from the DRV8323
    if(drv8323Vars->manReadCmd)
    {
        // Custom Read
        drvRegAddr = (DRV8323_Address_e)(drv8323Vars->manReadAddr << 11);
        drvDataNew = DRV8323_readSPI(handle, drvRegAddr);
        drv8323Vars->manReadData = drvDataNew;

        drv8323Vars->manReadCmd = false;
    }

  
    return;
}  // end of DRV8323_readData() function

it's return drvicVars_M1 values :

statReg00 = 0   
statReg01 = 0
statReg02 = 0
statReg03 = 769
statReg04 = 1
statReg05 = 1
statReg00 = 1 

my conclusion is when READ value again, it's cause setting corrupt ... 

please help if anything wrong of the READ procedure ? 

Danny

  • >> I finally managed to READ registers by just call ONCE, so remove it from while loop at the end of Main.c 

            .
            .
            .
            HAL_writeDRVData(motorHandle_M1->halMtrHandle, &drvicVars_M1);
            HAL_readDRVData(motorHandle_M1->halMtrHandle, &drvicVars_M1);

        } // end of while() loop

        // disable the PWM
        HAL_disablePWM(motorHandle_M1->halMtrHandle);

    } // end of main() function

    >> and move it here, READ only ONCE ! 

        // enable global interrupts
        HAL_enableGlobalInts(halHandle);

        // enable debug interrupts
        HAL_enableDebugInt(halHandle);

        systemVars.powerRelayWaitTime_ms = POWER_RELAY_WAIT_TIME_ms;

        HAL_readDRVData(motorHandle_M1->halMtrHandle, &drvicVars_M1);

    >> changed registers can WRITE and READ 

        drvicVars_M1.ctrlReg02.bit.OTW_REP = true;
        drvicVars_M1.ctrlReg02.bit.PWM_MODE = DRV8323_PWMMODE_6;

        drvicVars_M1.ctrlReg03.bit.IDRIVEN_HS = DRV8323_ISINK_HS_0P880_A;
        drvicVars_M1.ctrlReg03.bit.IDRIVEP_HS = DRV8323_ISOUR_HS_0P820_A;

        drvicVars_M1.ctrlReg04.bit.IDRIVEN_LS = DRV8323_ISINK_LS_0P880_A;
        drvicVars_M1.ctrlReg04.bit.IDRIVEP_LS = DRV8323_ISOUR_LS_0P820_A;

        drvicVars_M1.ctrlReg05.bit.VDS_LVL = DRV8323_VDS_LEVEL_1P880_V;
        drvicVars_M1.ctrlReg05.bit.OCP_MODE = DRV8323_AUTOMATIC_RETRY;
        drvicVars_M1.ctrlReg05.bit.DEAD_TIME = DRV8323_DEADTIME_100_NS;

        drvicVars_M1.ctrlReg06.bit.CSA_GAIN = DRV8323_Gain_20VpV;
        drvicVars_M1.ctrlReg06.bit.LS_REF = false;
        drvicVars_M1.ctrlReg06.bit.VREF_DIV = true;
        drvicVars_M1.ctrlReg06.bit.CSA_FET = false;

        drvicVars_M1.writeCmd = 1;
        HAL_writeDRVData(handle, &drvicVars_M1);
        SysCtl_delay(1000U);

        drvicVars_M1.writeCmd = 1;
        HAL_writeDRVData(handle, &drvicVars_M1);
        SysCtl_delay(1000U);

    >> now when I set 1 to motorVars_M1.flagEnableRunAndIdentify, immediately moduleOverCurrent fault occurred

    motorVars_M1.speedRef_Hz          = 60.0
    motorVars_M1.maxCurrent_A         = 30.0
    motorSetVars_M1.overCurrent_A     = 30.0

    >> if disable SPI to DRV by disable CS pin, I can run motor without moduleOverCurrent fault

        /*  GPIO_setPinConfig(GPIO_11_SPIA_STE);
            GPIO_setDirectionMode(11, GPIO_DIR_MODE_OUT);
            GPIO_setPadConfig(11, GPIO_PIN_TYPE_PULLUP);
        */

    My first question is, how can I keep READING registers ? calling HAL_readDRVData(motorHandle_M1->halMtrHandle, &drvicVars_M1) more than once will corrupt data ? 

    My second question is what's caused moduleOverCurrent ?????? 

    Danny

  • Danny,

    Apologies for the delay in response, I was out sick.

    1. The moduleOverCurrent fault being triggered only when the STE pin is enabled is likely related to the pinout. Double-check where GPIO11 is connected on your board.
    2. I notice that in the code you state does not work, there is no delay between the write and read commands. If you add a delay, does it change anything about the behavior?

    Regards,
    Jason Osborn

  • Hi Jason,

    The moduleOverCurrent fault being triggered only when the STE pin is enabled is likely related to the pinout. Double-check where GPIO11 is connected on your board.

    this is my custom board which is hard wire GPIO11 to DRV CS pin, as I mentioned it can READ the default value and even update registers, now my board is damaged, I need to prepare new one and continue my test to confirm the OVER CURRENT fault is caused by MOSFETs or not.

    I notice that in the code you state does not work, there is no delay between the write and read commands. If you add a delay, does it change anything about the behavior?

    I did even add 3ms delay between each READ or WRITE, it is based on TI examples universal_motorcontrol_lab DMC_LEVEL_4, can you help to test it from your side by using BoostXL-DRV8323RS + LaunchXL-F280025C

    Take care Jason,

    Danny

  • Danny,

    My concern regarding GPIO11 was that it may be unexpectedly connected/shorted to another signal, causing issues.

    • This is unlikely to be the problem, but just to be certain, is the predefined symbol DRV_CS_GPIO active?
    • If you can run the motor without the STE/PTE pin, how are you communicating with the DRV?
    • What is the state of the rxTimeOut bit of the DRV8323RS object?

    Regards,
    Jason Osborn

  • Hi Jason,

    This is unlikely to be the problem, but just to be certain, is the predefined symbol DRV_CS_GPIO active?

    it's no DRV_CS_GPIO predefined, therefore it's disabled, below is my HAL_setupGPIOs function : 

    since it's not TI board, so that I don't need wire connect, my board is hard wire direct connect GPIO 11 to DRV CS pin

    If you can run the motor without the STE/PTE pin, how are you communicating with the DRV?

    if I disable STE pin, the DRV run with default value, of course the GAIN may not be corrected but at least can RUN ...

    as I said I can READ the default value, and write ONCE, and then READ ONCE again to confirm the last WRITE value, but if I READ again the return value is corrupted. 

    What is the state of the rxTimeOut bit of the DRV8323RS object?

    Thanks,

    Danny

  • Danny,

    I understand the issue. My questions so far have been directed at what I've seen as common causes for similar problems in the past. Thank you for the rxTimeOut image.

    • If rxTimeOut is false/0, that indicates that messages are actually being received on the SPI lines, but it is the data itself that is incorrect.
      • Is your power supply stable? If you monitor the DC bus voltage, are there any major fluctuations?

    • In the hal.c file function HAL_MTR_setGateDriver, the FW performs the DRV configuration. Do the settings there match your custom HW?

    • Please go through your GPIO configurations- is there anything that's still set to use SPIA that is no longer relevant? For example, the DRV8323RS code sets GPIO5 to be SPIA_STE.

    If at all possible, I would recommend you use an oscilloscope, signal analyzer, or similar to monitor the following signals and check against what you would expect to see.

    • SPIA_STE, _SIMO, _MISO (0-3.3V)
    • MCU adc pin for VDC Bus (0-3.3V)

    Regards,
    Jason Osborn

  • Hi Jason,

    sorry about that, as I said I can READ the default values, and then WRITE / UPDATE register such as GAIN 

    therefore I am sure my board settings are correct without any wrong settings ! 

    however based on the TI examples universal_motorcontrol_lab

    on the MAIN.C inside its while loop it keep calling 

    #elif defined(_F28002x) || defined(_F28003x)

       HAL_writeDRVData(motorHandle_M1->halMtrHandle, &drvicVars_M1);
       HAL_readDRVData(motorHandle_M1->halMtrHandle, &drvicVars_M1);

    #else

    if I call HAL_readDRVData again, the return data was corrupted .... 

    PLEASE, do you have both BoostXL-DRV8323RS + LaunchXL-F280025C ? can you test with universal_motorcontrol_lab can keep READING registers such as STATUS_0 ?

    Danny

  • Danny, apologies for the delay in response.

    In the {project}/src_board/drvic/drv8323s.c file, can you change line 381 "SPI_readDataNonBlocking(" to "SPI_readDataBlockingFIFO("

    Let me know if this fixes it on your end.

    Regards,
    Jason Osborn