2024-01-30 01:28 PM
2024-02-01 02:19 AM
Hello @PBobo.1
Thank you for your input,
In this case, configuring GPIOs (PA4, PC13) as alternate functions is the same as configuring GPIO in output mode, this note in the ref man (and the Cube examples) is there so users won't configure GPIO as input or analog...
>>The effect of RTC on PA4 operation stopped when I changed the contents of the RTC_CR_OSEL field to 00
Please correct me if I'm wrong, but you're talking about this case?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-02-03 09:24 AM
>>...this note in the ref man (and the Cube examples) is there...
Please point out where in the reference manual this is mentioned. Or provide a quote.
>>Please correct me if I'm wrong, but you're talking about this case?
For the case you indicated in yellow in the table, GPIO works correctly, PA4 is controlled by GPIOA->ODR.
Incorrect operation of GPIO PA4 is observed when the field RTC_CR_OSEL=11, RTC_CR_OUT2EN=0 and RTC_CR_COE=0.
In this case, PA4 should work as a GPIO, but in fact some signal from the RTC goes there.
At the same time, there is a strange voltage level of 1.9 volts at pin PA4. (Controller power supply is 3.3 volts.)
2024-02-08 06:06 AM
Hello @PBobo.1
I tried what you have suggested (RTC_CR_OSEL=11, RTC_CR_OUT2EN=0 and RTC_CR_COE=0)
I tried toggling PA4 when masking RTC_CR_OSEL to 11, the GPIO is toggling normally with 3v3 voltage level.
Could you please provide the FW to reproduce the issue, also "some signal from the RTC goes there", how did you visualize that, could you try and toggle the GPIO under those conditions (RTC_CR_OSEL=11, RTC_CR_OUT2EN=0 and RTC_CR_COE=0) and probe it with a LA and share the results!
I'm looking forward to your response
Thank you
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-03-30 02:27 AM
2024-07-10 05:17 AM - edited 2024-07-10 05:21 AM
@PBobo.1 wrote:But, as my experience has shown, RTC_OUT2 gets to PA4 even when PA4 is in mode GPIO OUTPUT.
This is because STM32CubeIDE/STM32CUBEMX generates code to enable RTC_OUTx if you want to enable it. But if you does not want it, the generated code does not contains code to disable RTC_OUTx. So RTC_OUTx is still enabled because they are VBAT domain.
What you have to do is:
1. User code to disable it, or
2. Power reset (no VBAT supply)
PS: ST RTC library is extremely buggy. For example, 1 second delay for each programming. Using LL libraries cannot enable RTC_OUTx because RTC write is disabled by the generated code. And they are many other bugs. So I use my own library.
2024-11-01 01:25 PM
You aren't right, I use own library and have the same issue.
Issue description:
I'm experiencing an unexpected behavior with PA4 pin on STM32G030F6P6. While PA4 is properly configured as output (in GPIO mode) and ODR register is set to 1, the pin doesn't function as expected when RTC peripheral is configured.
Configuration details:
- PA4 is configured as GPIO output
- ODR register has bit 4 set to 1
- RTC CR register settings:
* RTC_CR_OSEL = 00
* RTC_CR_OUT2EN = 0
* RTC_CR_COE = 0
Current behavior:
1. On power reset, PA4 works correctly as GPIO
2. After RTC peripheral configuration (RTC_OUT2EN disabled), PA4 stops working as output
3. Pin works fine when configured as input.
Issue like this must be in errata, for sure.
Are there any workarounds to maintain PA4 GPIO output functionality while RTC is enabled?
2024-11-01 01:45 PM - edited 2024-11-01 01:46 PM
Hi,
This is perfectly normal behavior. Since it is related to RTC domain, you have to explicitly disable it with your code if you enabled some settings of RTC before. The second method is to power off the MCU and start it again.
All settings for RTC domain behave like this. And this is not an errata.
2024-11-01 02:58 PM - edited 2024-11-01 02:58 PM
In RM0454 is said: In addition, it is possible to output RTC_OUT2 on PA4 pin thanks to OUT2EN bit. This output is not available in VBAT mode. The different functions are mapped on RTC_OUT1 or on RTC_OUT2 depending on OSEL, COE and OUT2EN configuration, as show in table Table 91.
So this is a feature that as stated further down requires configuring the pin as an alternative function: For PA4, the GPIO should be configured as an alternate function.
And there is no mention of a limitation on using PA4 as an output if the RTC domain is enabled, much less as an input it works correctly.
Why then is this behavior of PA4 in accordance with the documentation?
2024-11-01 03:28 PM
There is NO need to set alternative function for any of output. This works for me:
void setCalibrationOutput(int out) {
if (out == 1)
LL_RTC_DisableOutput2(RTC);
else
LL_RTC_EnableOutput2(RTC);
}