cancel
Showing results for 
Search instead for 
Did you mean: 

SPI MX config buggy?

MM..1
Chief II

Hi, i try migrate some old stdlib app into HAL or LL over new project in MX. On old system we have SPI init part for TX only master

 /* SPI configuration -------------------------------------------------------*/
  SPI_I2S_DeInit(SPIx);
  SPI_InitStructure.SPI_Direction = SPI_Direction_1Line_Tx;

cleanly work and show only MOSI used. But same choiced in MX result into

MM1_0-1713285234593.png

  /* USER CODE END SPI1_Init 1 */
  /* SPI1 parameter configuration*/
  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_1EDGE;
  hspi1.Init.NSS = SPI_NSS_SOFT;
  hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
  hspi1.Init.FirstBit = SPI_FIRSTBIT_LSB;
  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)

 why here direction is SPI_DIRECTION_2LINES? With LL drivers same situation.

1 REPLY 1
AScha.3
Chief II

Hi, ok name is with _2Lines_ now, but does it work correct ?

(Maybe they just changed the name...)

I looked in my projects :

- master transmit    SPI_DIRECTION_2LINES_TXONLY;

- slave receive   SPI_DIRECTION_2LINES_RXONLY

- half duplex master    SPI_DIRECTION_1LINE;

+ all correct working.

If you feel a post has answered your question, please click "Accept as Solution".