Some summaries on the use of STM32 SPI3

Source: Internet
Author: User

Summarize the SPI3 problem, because the SPI3 NSS port has a common pin to the JTAG, so misconfiguration can cause SPI3 to be unusable. The following three points need to be noted:
1. Configure the PA15 as a normal IO port, gpio_mode_out_pp
2. Turn on the AFIO clock Rcc_apb2periphclockcmd (Rcc_apb2periph_afio, enable);
3. Turn off the JTAG function to enable SWD
Gpio_pinremapconfig (gpio_remap_swj_jtagdisable,enable);

Other SPI port normal configuration, because the default is JTAG mode after the board restart, although the use of SWD during debugging, but PA15 is still not a normal IO port, when it is reconfigured, be sure to turn on the Afio clock, if not open, only gpio_pinremapconfig () , will cause the program crashes, in the debugging time will jump, the specific reason I do not know.

The above configuration is after I debug, certainly no problem. Note Do not use gpio_remap_swj_disable, because this can not download the program, to unlock the very troublesome.


When using Stm32, SPI3 and JTAG ports are coincident, if you want to use SPI3 or to use the JTAG port as a normal IO port can refer to the following configuration:

1. Using the Spi3 interface, refer to the Lu Youliang Teacher's tutorial [bp19_ Network Ping Experiment], the set of code to achieve this function

2. Stm32 JTAG Port can be configured as SWD mode so that it can spare three interfaces, and does not affect the program download and debugging, about how to configure the SWD mode can refer to the previous blog.

      STM32 jtag Download pin: jtdo, JTDI, jtck configure normal IO port in fact and configuration for SPI3 is the same only SPI3 also open the SPI clock, here to open IO port clock, The most critical two instructions are:
      1, open multiplexed clock: rcc_apb2periphclockcmd (rcc_apb2periph_afio,eanble);
      2, call the Remap function: Gpio_pinremapconfig (gpio_remap_swj_jtagdisable, enable);//Turn off Jtag, turn on SWD

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.