Skip to main content
JSILV.2
Associate III
October 30, 2022
Question

Is there a good example of how to configure SPI by LL(Low Layer) on F0?

I build one new project for F0 using the CubeIDE.

Library V1.11.3.

At first, it builds, but even after the 

MX_SPI2_Init();

command, we need to issue the command-> 

LL_SPI_Enable(SPI2);

in order to the SPI to start. But the SPI_CLK start to running just after the LL_SPI_Enable(SPI2);

even without the RECEIVE or TRANSMISSION command. In fact, I commented out my adc_raw8 = LL_SPI_ReceiveData8(SPI2);

and the SPI_CLK was still running like a Continous Wave. If I issue the Chip Select command before all, 

LL_SPI_EnableNSSPulseMgt(SPI2);

between the clock count the spi's machine insert a huge 100ms empty space.

Does someone have one Low Layer SPI that is working, better would be a "receive only" example. It could even be a "transmission only" ones.

On the same MCU/Board the HAL_Receive command works only at Receiving, if I define the SPI Machine as "full-duplex Master". Defining as "simplex receiving" the SPI_CLK does not occur...

Some hint?

Regards.

This topic has been closed for replies.

2 replies

ST Technical Moderator
October 31, 2022

Hello @JSILV.2​ ,

You may start from the LL template project in the STM32CubeF0 MCU package based on the SPI example: \STM32Cube_FW_F0_V1.11.0\Projects\STM32F0308-Discovery\Examples\SPI\

Then add your own modifications.

You can also use STM32CubeMX to generate the SPI code based on LL driver, you have just to select "LL" for the SPI configuration generated code (Project >> Settings >> Advanced Setting)

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
JSILV.2
JSILV.2Author
Associate III
October 31, 2022

Dear DAHMEN.

I will dig into the indicated Template as you pointed out.

All of my explanation was build using the CUBEIDE/MX exactly as you indicated.

Meanwhile, any simple example which works would be great to know.

SPI & I2S have the same behaviour: as soon it start, the Serial clock stat running but, in the case of I2S, does not run if the Receive command was not issued, contrary of SPI, which have the running serial clock even if the Receive command was not issued.

Thanks.