2021-12-10 08:47 AM
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.
2021-12-10 09:10 AM
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.
2021-12-10 10:03 AM
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.
2021-12-10 01:08 PM
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.
2021-12-20 02:29 AM
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.
2021-12-20 02:55 AM
Cube/HAL? Maybe uninitialized field in init-struct when initializing RTC.
JW
2021-12-20 03:35 AM
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.