AnsweredAssumed Answered

MXCube Generate STM32F031 SPI Slave miss BaudRate Field

Question asked by Wang Jun on Mar 2, 2018

I used MXcube to generate initiaation code as SPI Slave, CHPA is hope to be Low.

But it will be set when the LL_SPI_Init(SPI1, &SPI_InitStruct) function is running.

I found that Miss BaudRate Field.  It can probably induce ClockPhase wrong configuration.

After Added Baudrate field, the issue is fixed.

 

 

  NVIC_SetPriority(SPI1_IRQn, 0);
  NVIC_EnableIRQ(SPI1_IRQn);
  SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
  SPI_InitStruct.Mode = LL_SPI_MODE_SLAVE;
  SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_16BIT;
  SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW;
  SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE;
  SPI_InitStruct.NSS = LL_SPI_NSS_HARD_INPUT;
  SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST;
  SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_ENABLE;
  SPI_InitStruct.CRCPoly = 4129;
  LL_SPI_Init(SPI1, &SPI_InitStruct);
  LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA);
  LL_SPI_SetCRCWidth(SPI1, LL_SPI_CRC_16BIT);
  LL_SPI_DisableNSSPulseMgt(SPI1);

Outcomes