0

I'm using STM32F103C8T6 with SPI1 remapped and in half-duplex mode (MISO pin unused by SPI). I'd like to use MISO pin (PB4) for PWM generation by TIM3 remapped but I can not get it working while SPI1 is clocked. So is there a way to use MISO pin of SPI in half-duplex mode for other AF function while SPI remains clocked?

UPD. I found out that MISO pin can be used as GPIO when SPI in half-duplex master mode

  • 1
    "I can not get it working". Can you detail what is not working ? For example, does your PWN generation work only when SPI1 is not clocked ? What is the SPI configuration : master or slave ? Are you using your own code or HAL ? Also, add the GPIO setup in your anwer – Guillaume Petitjean Aug 25 '20 at 06:42
  • PWM output is ok all the time when I keep SPI clocking off. If i enable SPI clocking [PWM pin goes low](https://b.radikal.ru/b07/2008/e9/1f99ad50d9d9.png) (quite slow, just like discharging capacity) until I disable SPI clocking again. SPI is configured as master, BIDIMODE=0 (and works correctly in half-duplex mode). MISO pin is configured as AF push-pull as PWM is an alternative function. – Yuri Vostrenkov Aug 25 '20 at 17:12
  • Are you working on an application board like Nucleo or similar ? if you are using external wires, there might be some electrical perturbation from one wire on another. it is worth to try the following: twist every wire with another wire connected to the ground. – Guillaume Petitjean Aug 26 '20 at 09:03
  • I assume your STM32 is the SPI Master ? BIDIMODE =0 means what ? (I don't know this particular STM32 and on STM32H7 the SPI communication mode bits mean Full Duplex when 00) – Guillaume Petitjean Aug 26 '20 at 09:05
  • I use bluepill stm32 board so there are direct connections with no cross-influence. SPI works in master mode, BIDIMODE=1 for half duplex (sorry, i have mistaken last msg). I also found out that SPI NSS pin also blocked by SPI even if not used. But both MISO and NSS pins can be used as regular GPIO (not AF) while SPI clocked. So as a workaround for the issue these pins can be driven manually in timer's interrupt. – Yuri Vostrenkov Aug 27 '20 at 11:18

0 Answers0