Skip to main content
EvgenS Po
Associate III
August 20, 2017
Question

stm32f042f6 spi doesn't work with HSI as PLL source

  • August 20, 2017
  • 4 replies
  • 902 views
Posted on August 20, 2017 at 21:37

Hello! I'm using spi peripheral on STM32f042f6p6 and faced with strange situation: spi works only if system clock is PLL and HSE is PLL source. I have tried HSI, HSI48, with them spi does not work at all: neither transmission, nor reception. In all PLL source cases HSE, HSI, HSI48, the application code is the same and modified only to change system clock. I have found nothing about that issue in documentation.

So, is it normal for stm32f042f6? If it is, please give me some references for documentation.

If it is not, please help me find out what I'm missing.

Thanks in advance.

    This topic has been closed for replies.

    4 replies

    Tesla DeLorean
    Guru
    August 21, 2017
    Posted on August 21, 2017 at 15:15

    Can't say I've heard of such an issue, the SPI should derive it's clock from the APB which divides down from the AHB and CPU clock. Check there aren't other clock source options.

    Show the system clock initialization, and peripheral initialization, ideally as a stand-alone demo.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    waclawek.jan
    Super User
    August 21, 2017
    Posted on August 21, 2017 at 15:36

    A blinking LED works with the other clock settings?

    JW

    EvgenS Po
    EvgenS PoAuthor
    Associate III
    August 21, 2017
    Posted on August 21, 2017 at 16:10

    Thanks for replies. The rest part of code works as it should, that is, everything except for spi functions properly with different clock settings. spi transfer hangs on Rxne flag checking. I'll provide demo project as Clive One suggested.

    EvgenS Po
    EvgenS PoAuthor
    Associate III
    August 22, 2017
    Posted on August 22, 2017 at 11:58

    Solved. Thanks a lot for parttaking! There was a PCB mounting error.