Skip to main content
Sni.1
Associate
November 11, 2020
Question

SPI1_NSS conflicts with PA15 in STM32F103

  • November 11, 2020
  • 1 reply
  • 1408 views

Hi,

According to datasheet, The main function of PA15 is JTDI, so I disabled JTAG and config that pin in AF_PP mode.

Then if I don't initialize SPI1, I can control PA15 as GPIO. But if I initialize SPI1, this pin will hold high. Since SPI1 has occupied PA4 as its NSS, I guess there is a way to force that peripheral to release PA15, however I didn't find some description in datasheet.

If someone could help give some suggestions?

This topic has been closed for replies.

1 reply

ST Technical Moderator
November 11, 2020

Hello @Sni.1​ ,

Welcome to the STM32 Community :smiling_face_with_smiling_eyes:

SPI1_NSS remapeed on PA15 pin. Try to set AFIO_MAPR.SPI1_REMAP = 1, and enable SPI1 clock in RCC: pins PA15, PB3, PB4 and PB5 belong to SPI1 as mentionned in the following SPI1 remapping table:

0693W000005B26NQAS.jpgPlease refer to the STM32F103 reference manual for more details on SPI1 remapping.

Imen

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. Thanks
Sni.1
Sni.1Author
Associate
November 12, 2020

Hi, I want to use PA15 as GPIO, not the NSS wire of SPI1. Now the phenomenon is:

1. if I set SP1_REMAP=1, of course SPI1 use PA15 so I can't control it.

2. if I set SP1_REMAP=0, SPI1 use PA4 as its NSS. Then

2.1 Disable clock of SPI1, I can control PA15.

2.2 Enable clock of SPI1, I can't control PA15, it holds high.

So 2.2 means SPI1 always occupies PA15. Is there any solution?