Undesired Square Wave on Pin configured as GPIO_Output used for SPI Slave Select
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-10 8: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.
- Labels:
-
SPI
-
STM32G0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-10 9: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-10 1: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-20 2: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-20 2:55 AM
Cube/HAL? Maybe uninitialized field in init-struct when initializing RTC.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-20 3: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.
