Skip to main content
bully
Senior
May 16, 2024
Solved

Change SPI speed (clock prescaler) and resume operation on H7

Hello,

 

I'd like to change speed (clock prescaler setting in CFG1) and then resume sending bytes on SPI.

Right now, I do :

retval = HAL_SPI_Abort(&hspi2);

My_SPI2_Init(SPI_EyeGenPrescaler);

where My_SPI2_Init is just slightly customized version of Mx_SPI2_Init with new Prescaler value as input argument.

 

After this, I don't see anything on SPI MOSI output.

 

What am I doing wrong? Is something else needed to shutdown SPI and initialize it at new prescaler value ?

 

Can I somehow change speed more fine-grained than just changing prescaler to values like powers of 2 ?

 

Thanks,

regards.

 

 

 

 

This topic has been closed for replies.
bully
bullyBest answer
Senior
May 16, 2024

Hello,

 

thanks for response... It seems that I've forgot to start new send after reinitialization. Now it works...

Regards.

 

2 replies

ST Technical Moderator
May 16, 2024

Hello @bully 

 

Could you please deinitialize the SPI before reinitializing it and check the result?

 

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. Saket_Om
bully
bullyAuthorBest answer
Senior
May 16, 2024

Hello,

 

thanks for response... It seems that I've forgot to start new send after reinitialization. Now it works...

Regards.