cancel
Showing results for 
Search instead for 
Did you mean: 

STM32_CubeIDE crashes when initializing SP1

MFend
Associate III

The same code run in IAR and in Atollic, starts up and from the beginning Run works fine and the device starts up without problem.

Using STM32CubeIDE, I'm having trouble with MX_SP1_Init(). If I don't step through it, it crashes and I can't proceed to debug the rest of the program.

The original /4040D_STM32Cube/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c file is used for the initialization.

/* SPI1 init function */
void MX_SPI1_Init(void)
{
 
  hspi1.Instance = SPI1;
  hspi1.Init.Mode = SPI_MODE_MASTER;
  hspi1.Init.Direction = SPI_DIRECTION_2LINES;
  hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
  hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
  hspi1.Init.CLKPhase = SPI_PHASE_2EDGE;
  hspi1.Init.NSS = SPI_NSS_SOFT;
  hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_256;
  hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
  hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
  hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
  hspi1.Init.CRCPolynomial = 7;
  hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
  hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
  if (HAL_SPI_Init(&hspi1) != HAL_OK)
  {
    _Error_Handler(__FILE__, __LINE__);
  }
 
}

2 REPLIES 2
MFend
Associate III

Some queer happenings...

Console is coming out with Chinese letters.

The program crashes even when I step through the SPI Init.

I really need this problem to be fixed because at the moment, the STM32CubeIDE is not at all usable as a debugger and I cannot recommend its use to the other members of my FW team.

MFend
Associate III

Another error that i received - why does the IDE allow 2 breakpoints at the same place? And if they exist, why not continue without a crash?