cancel
Showing results for 
Search instead for 
Did you mean: 

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

JSILV.2
Senior

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.

2 REPLIES 2
Imen.D
ST Employee

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

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

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.