Skip to main content
Graduate
May 16, 2024
Solved

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

  • May 16, 2024
  • 1 reply
  • 1668 views

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.
    Best answer by bully

    Hello,

     

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

    Regards.

     

    1 reply

    Technical Moderator
    May 16, 2024

    Hello @bully 

     

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

     

    bullyAuthorAnswer
    Graduate
    May 16, 2024

    Hello,

     

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

    Regards.