cancel
Showing results for 
Search instead for 
Did you mean: 

SPI1_NSS conflicts with PA15 in STM32F103

Sni.1
Associate

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?

2 REPLIES 2
Imen.D
ST Employee

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

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

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?