2022-03-10 01:59 AM
Hi , iam using STM32mp157C micro processor ,On the cortexM4 i have configured SPI 1
but iam unable to transmit using HAL_SPI_Transmit(),
i have done some debugging in the spi driver , i found it is always returnning the HAL_TIMEOUT from SPI_WaitOnFlagUntilTimeout();
spi 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_2EDGE;
hspi1.Init.NSS = SPI_NSS_HARD_OUTPUT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi1.Init.CRCPolynomial = 0x0;
hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
hspi1.Init.NSSPolarity = SPI_NSS_POLARITY_LOW;
hspi1.Init.FifoThreshold = SPI_FIFO_THRESHOLD_01DATA;
hspi1.Init.TxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
hspi1.Init.RxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
hspi1.Init.MasterSSIdleness = SPI_MASTER_SS_IDLENESS_00CYCLE;
hspi1.Init.MasterInterDataIdleness = SPI_MASTER_INTERDATA_IDLENESS_00CYCLE;
hspi1.Init.MasterReceiverAutoSusp = SPI_MASTER_RX_AUTOSUSP_DISABLE;
hspi1.Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_ENABLE;
hspi1.Init.IOSwap = SPI_IO_SWAP_DISABLE;
Any help is appreciated
2022-03-10 02:17 AM
Hi @Maksh.1 ,
there is two posts which might help you:
https://community.st.com/s/question/0D53W00001EG6BbSAL/stm32mp157c-spi-dma-transfer-stuck-problem
https://community.st.com/s/question/0D53W00000qvWwoSAE/stm32mp157ca-spi1-clock-does-not-work
Did you generates init code from CubeMx?
Are you doing you tests in 'engineering mode' (i.e. No Linux running, so Cortex-M4 has some more init to do wrt clocks) or 'production mode' (Linux is managing root clocks, and deserve custom DT to enable SPI on M4) ?
Regards.
2022-04-12 02:04 AM
Hi @Maksh.1 ,
Do you progress on this subject ?
Regards.
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'