Skip to main content
Explorer
May 27, 2024
Solved

STM32F407ZGT7 reset when write to SPI1 DR

  • May 27, 2024
  • 1 reply
  • 719 views

When i debug SPI1 on STM32F407, program will jump to 0x00 when write DR register, MCU reset and loop continuely. when i measure the SCLK signal using oscillator, SCLK is always high after SPI1 is enabled  

  1. When i write to DR of SPI1, the code jump to main
  2. I check the SCLK keep high after SPI1 enabled

I searched on the net, and this is suggest that SPI1 SCLK shared same pin with JTAG-TDO, Jtag should be disabled, but for 407, there is no the JTAG disable instruction in HAL. 

Is there anyone can help me on this or give me some hints? Thanks 

    This topic has been closed for replies.
    Best answer by AScha.3

    Why dont you use PA5 for SPI1 sck ? Then no conflict with JTAG/debug .

    +

    You have to set debug/trace in Cube, then the associated pins are used for this; 

    and you cannot use them at same time for debug...logically.

    +

    There is only a clk on SPI , when transmitting data. (So 16 clks , when sending 16 bits, otherwise line is "quiet".)

    1 reply

    AScha.3Answer
    Super User
    May 27, 2024

    Why dont you use PA5 for SPI1 sck ? Then no conflict with JTAG/debug .

    +

    You have to set debug/trace in Cube, then the associated pins are used for this; 

    and you cannot use them at same time for debug...logically.

    +

    There is only a clk on SPI , when transmitting data. (So 16 clks , when sending 16 bits, otherwise line is "quiet".)