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.

TUSB422: TUSB422 EVM with MSP432P401R

Part Number: TUSB422
Other Parts Discussed in Thread: MSP432WARE

Hi,

I have TUSB422EVM and MSP432P401R launcpad, and I want to launch sample code for this EVM on launcPad.

First i try to import sample code to CCS and launch, but with no luck. There is problem with tcpm_hal.c in function SystemInit which is called after Reset interrupt. CPU goes to Hardfault irq when trying to initialize Port J pins, which is needed for crystal.

Else i open project with IAR. And get the same result. 

Function where i get HARDFAULT:

void GPIO_setAsPeripheralModuleFunctionInputPin(uint_fast8_t selectedPort,
        uint_fast16_t selectedPins, uint_fast8_t mode)
{
    uint32_t baseAddress = GPIO_PORT_TO_BASE[selectedPort];

    HWREG16(baseAddress + OFS_LIB_PADIR) &= ~selectedPins; //    There cpu crashes.
    switch (mode)
    {
    case GPIO_PRIMARY_MODULE_FUNCTION:
        HWREG16(baseAddress + OFS_LIB_PASEL0) |= selectedPins;
        HWREG16(baseAddress + OFS_LIB_PASEL1) &= ~selectedPins;
        break;
    case GPIO_SECONDARY_MODULE_FUNCTION:
        HWREG16(baseAddress + OFS_LIB_PASEL0) &= ~selectedPins;
        HWREG16(baseAddress + OFS_LIB_PASEL1) |= selectedPins;
        break;
    case GPIO_TERTIARY_MODULE_FUNCTION:
        HWREG16(baseAddress + OFS_LIB_PASEL0) |= selectedPins;
        HWREG16(baseAddress + OFS_LIB_PASEL1) |= selectedPins;
        break;
    }
}

What am I doing wrong? please help.