FLEXCOMM_GetInstance crashing (HS SPI)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FLEXCOMM_GetInstance crashing (HS SPI)

1,978 Views
christianlees
Contributor III

I have a board using a LPC55S06 and a Winbond W25Q32 connected to the HS SPI interface.

	CLOCK_SetClkDiv(kCLOCK_DivFrohfClk, 0U, true);  /*!< Reset FROHFDIV divider counter and halt it */
	CLOCK_SetClkDiv(kCLOCK_DivFrohfClk, 2U, false); /*!< Set FROHFDIV divider to value 2 */
	CLOCK_AttachClk(kFRO_HF_DIV_to_HSLSPI); /*!< Switch HSLSPI to FRO_HF_DIV */
	//CLOCK_AttachClk(kMAIN_CLK_to_HSLSPI);
	RESET_PeripheralReset(kHSLSPI_RST_SHIFT_RSTn);

	spi_master_config_t master_config = {0};
	SPI_MasterGetDefaultConfig(&master_config);
	master_config.sselNum = (spi_ssel_t)0;
	master_config.sselPol = (spi_spol_t)kSPI_SpolActiveAllLow;
	master_config.baudRate_Bps = 12000000U;
	uint32_t clk = CLOCK_GetHsLspiClkFreq();
	SPI_MasterInit(SPI8, &master_config, CLOCK_GetHsLspiClkFreq());

 

Stepping through the code the MCU crashes when it returns from FLEXCOMM_GetInstance.  I have tried a few difference baud rates.

uint32_t FLEXCOMM_GetInstance(void *base)
{
    uint32_t i;
    pvoid_to_u32_t BaseAddr;
    BaseAddr.pvoid = base;

    for (i = 0U; i < (uint32_t)FSL_FEATURE_SOC_FLEXCOMM_COUNT; i++)
    {
        if (BaseAddr.u32 == s_flexcommBaseAddrs[i])
        {
            break;
        }
    }

    assert(i < (uint32_t)FSL_FEATURE_SOC_FLEXCOMM_COUNT);
    return i;
}

 

When this routine runs i is 8 as is FSL_FEATURE_SOC_FLEXCOMM_COUNT when it gets to the assert line.  If i step into this line I get the following line in the debugger console

[Inferior 1 (Remote target) exited normally]

Any idea what causes this?

0 Kudos
Reply
4 Replies

1,955 Views
christianlees
Contributor III

According to the user manual (UM11424) the HS_SPI is on Flexcomm 8 (SPI8), page 622.  Is this different between the two packages?

Christian

0 Kudos
Reply

1,946 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suggest you refer to data sheet rather than user manual, the user manual only gives function description for all the family, the data sheet gives how many modules the processor has exactly for each derivative.

Sorry for the discrepancy between user manual and data sheet.

BR

XiangJun Rong

0 Kudos
Reply

1,940 Views
christianlees
Contributor III

The pin tool in the development environment lists  flexcomm 0 - 6 and 8.  Inside Flexcomm 8 the options are all for HS SPI and the pin numbers look correct.

0 Kudos
Reply

1,967 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Pls refer to the data sheet of LPC550x.

For HTQFP64 pins of LPC550x, there are only 6 spi plus 1 hs spi, total is 7

For HTQFP48 pins of LPC550x, there are only 3 spi plus 1 hs spi, total is 4

Hope it can help you

BR

XiangJun Rong

xiangjun_rong_0-1637131180985.png

 

0 Kudos
Reply