Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


How to implement a proprietary SPI protocol on STM32F767ZI

Normally it is not a great deal to implement a SPI interface with Nucleon STM32F767ZI. SPI functions are pre-implemented.

But in my case the slave doesn’t give the expected response as long the SPI frames have not special delimiters between some frames. See the picture in the attachment. The red encirceled MOSI pulses without SLK (clock) signals are need.

I used the code example from the CUBE “STM32Cube_FW_F7_V1.11.0” called “SPI_FullDuplex_ComIT”

I configured the SPI Handler as follows.

/*##-1- Configure the SPI peripheral #######################################*/
/* Set the SPI parameters */
SpiHandle.Instance = SPIx;
SpiHandle.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
SpiHandle.Init.Direction = SPI_DIRECTION_2LINES;
SpiHandle.Init.CLKPhase = SPI_PHASE_2EDGE;
SpiHandle.Init.CLKPolarity = SPI_POLARITY_HIGH;
SpiHandle.Init.DataSize = SPI_DATASIZE_8BIT;
SpiHandle.Init.FirstBit = SPI_FIRSTBIT_MSB;
SpiHandle.Init.TIMode = SPI_TIMODE_DISABLE;
SpiHandle.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
SpiHandle.Init.CRCPolynomial = 7;
SpiHandle.Init.NSS = SPI_NSS_SOFT;

CPOL=1 and CPHA=1

But I have no idea how to realize the MOSI HIGH pulses between the SPI frames without a CLK signal. As long SPI is enabled I have no direct access to the MOSI Pin. So tried to disable SPI by means of HAL_SPI_DeInit( ...) in order to toggle the MOSI output pin from LOW to HIGH and back to LOW. Then I re-enabled the SPI function. But this method has the effect that the CLK signal which should remain on HIGH drops to LOW. The SPI re-initialisation causes then a rising CLK edge which is then interpreted as an extra bit at the receiver side.

What can I do to add a MOSI pulse between two frames without underlaying clock signal?

I already tried to implement a totally own SPI driver by toggeling the CLK signal with set and reset commands. But this is to slow for my application which requires a datarate of 6 Mbit/s.

SPI With Delimiters SPI signal with delimetersQuestion

 

Newest Forum Posts

  1. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  2. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  3. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  4. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  5. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  6. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  8. Build a project in "release" mode by tang, 2025-02-20 10:36
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35
  10. Fail to debug in Win 11 C/C++ by mortenlund, 2024-12-26 20:27

Last-Modified Blogs