cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F042 SPI DMA: Gaps between SPI Frames

marco.erni
Associate

Hello

Is there a possibility to reduce the time gap between two consecutive SPI Frames? Background: I would like to use only the MOSI signal without the clock to send information to some addressable LED (WS2812). They just measure the time between rising and falling edge of the signal to determine the data. With gaps between the frames, the timing of the MOSI signal is destroyed for a MOSI without Clock usage.

I have the following Setup:

  • Atollic TrueSTUDIO for STM32 9.0.1
  • STM32F042K6T Nucleo Board, with internal HSI48 Clock
  • CubeMx HAL (STM32Cube FW_F0 V1.9.0)
  • SPI Configured with baud rate 3MBit/s, 16bit data size, transmit only, SPI Tx DMA, highes priority

In the main programm I have a uint8_t array with values to send over SPI.

uint8_t DataToSend[]={0xBB,0xBB,0xBB,0xBB,0x88,0x88,0x88,0x88,0xBB,0x88,0x88,0x88,0x88,0,0,0,0,0,0};

In the main loop, I call the following functions:

	  HAL_SPI_Transmit_DMA(&hspi1,DataToSend,sizeof(DataToSend));
	  HAL_Delay(1000);

With an attached scope, I can measure that the data is transmitted.

0690X000006C72LQAS.bmp

But between two blocks of 16 bits, there is a time gap of about 660ns (about two bit times) is there a possibility to reduce that gap close to zero so that no time space between the frames can be seen?

Attached you can find my minimal project. In Atollic TrueSTUDIO use File-->Import-->Existing Projects into Workspace and select the attached zip file. In the zip file, you can find the oscilloscope screenshot as well.

Thank you for your help.

Marco

1 ACCEPTED SOLUTION

Accepted Solutions

> hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;

is what makes the spaces between frames.

JW

View solution in original post

3 REPLIES 3

> hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;

is what makes the spaces between frames.

JW

marco.erni
Associate

Thank you for your answer. This solved the issue.

Thanks a lot for your help.

Best, Marco

If resolved, please mark as so (Best). Thanks.

JW