cancel
Showing results for 
Search instead for 
Did you mean: 

Undesired Square Wave on Pin configured as GPIO_Output used for SPI Slave Select

SMano.1
Associate II

I have a STM32G0B0KET6. I have configured Pin A4 as a GPIO Output. However, I see a 506.000 Hz Square Wave instead of it being high.

It sometimes works correctly as a slave select. At one point the line goes to 0V. If I reset the controller after this, I now see the Square Wave on the Pin. The rest of the controller functionality works fine.

6 REPLIES 6
SMano.1
Associate II

It sometimes works correctly as a slave select. However, at one point the line goes low. When it's low, if I reset the controller, I then see a Square Wave with a frequency of 506.000 Hz. I have no idea why this is happening. I have tried configuring the pin as an input and the same thing happens.

Is this on some board? What exactly are we dealing with here?

512 Hz might be an RTC test thing, but not something ringing any bells currently.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

PA4 is an RTC_OUT1 which allows output of a 512Hz signal. I believe this feature supersedes whatever you have set up in the GPIOx registers. Examine the relevant RTC registers.

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

I enabled RTC_OUT1, and saw the exact same 506.00 Hz Square Wave. Now I just need to figure out why the pin changes mode on reset.

Cube/HAL? Maybe uninitialized field in init-struct when initializing RTC.

JW

SMano.1
Associate II

I came up with a workaround for my application. I am not using the RTC, do I did a DeInit on it.

	if(hrtc.Instance->CR&(1<<23))
	{
		HAL_RTC_DeInit(&hrtc);
	}

I added this code in the loop that uses the pin.