cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103ZFH6 SPI3_SCK (PB3) Not working.

Maigonis
Associate

Hello!

 

I am trying to enable SPI communication through the SPI3 interface on an STM32F103ZFH6. I am aware that pins PA15 and PB3 are used for JTAG and SWJ, but I have disabled both using:


GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);

 

There is no clock signal on SPI3_SCK (PB3) and the pin is always low, as confirmed by using a logic analyzer. The SPI3_NSS pins work, after disabling JTAG though.

I am certain that the SPI settings, clock, and initialization are correct because data is being sent on the MOSI line, and the NSS pin is manually pulled down correctly during communication, just the clock signal is missing. GPIO settings are also correct as the SCK pin is set to GPIO_Mode_AF_PP.

 

I have also probed for continuity on the PCB and everything is correct. There is a series resistor on the MOSI, MISO, and SCK lines.

 

I have added a screenshot of the logic analyzer output I get. Currently, I think the issue may be a hardware issue in the microcontroller itself, but I am not sure how likely that is.

 

Any help or recommendations are appreciated!

14 REPLIES 14

Ok, tried this and I attached the output from my logic analyzer. As you can see the data 0xAA is sent over the MOSI line, but the clock pin is low always.

I have checked my board, the pin is not shorted to ground.

	while(1) {
		GPIO_WriteBit(SC16_CS_PORT, SC16_SPI_CS_PIN, Bit_RESET);

 		SPI_I2S_SendData(SPI3, 0xAA); 
  		while (SPI_I2S_GetFlagStatus(SPI3, SPI_I2S_FLAG_BSY)); 

		GPIO_WriteBit(SC16_CS_PORT, SC16_SPI_CS_PIN, Bit_SET);
	}

 

Hmmm...and without spi , pin pb3 just as io out, writing some 

HAL_GPIO_TogglePin(..) 

in a loop - signal on pin ?

If you feel a post has answered your question, please click "Accept as Solution".

This means the pin state at the microcontroller is working correctly. If your logic analyzer isn't registering the high/low states, it's not connected to the pin. Check your wiring between the two. Perhaps a bad soldering job somewhere, or a mismatched cable.

It's a hardware or test setup problem, not a software one.

If you feel a post has answered your question, please click "Accept as Solution".

Thank you for clearing things up!. At least now I can be sure to look at the hardware more carefully. It is probably a bad soldering job, since its a ballgrid package.

The problem was that the series resistor on the clock line was faulty/not soldered properly.