cancel
Showing results for 
Search instead for 
Did you mean: 

Enabeling the RTC calibration output PC13 makes PA4 input invalid

peter7
Associate II

We are using an STM32G070 with 64 Pins.

The clock comes from an external 32,...kHz crystal. For clock calibration, we enable the RTC calibration output PC13.

Whenever this is active, reading the state of the input PA4 always returns false, although we activated the pullup. Measuring the pin gives us the expected 3.3V

Disabeling the calib output makes PA4 readable again. We compared the PA4 port setting with/without calib-output, they are always the same.

 

Do you know about this issue? I found an errate entry concering PC13, but not our situation.

 

Best regards,

Peter

10 REPLIES 10
TDK
Super User

PA4 also has an RTC_OUT_CALIB functionality. Probably there is some issue that RTC takes over the pin when calibration is enabled.

Is this from CubeMX-generated code? Can you share your IOC file?

TDK_0-1770306010982.png

 

Edit:

Ensure OUT2EN=0.

TDK_0-1770306162991.png

 

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

Hello TDK,

 

thanks for the reply. Unfortunately, we are not using the Cube-Code, so there is no valid IOC to share. For testing, I set OUT2EN=1. This makes PA4 the calibration pin, with 512Hz output. I measured it, this works fine.

 

With OUT2EN=0, I have the described problem.

Read out and check/post RTC and GPIO registers content.

JW

 

[EDIT] maybe similar issue here? no conclusion in that thread, though

peter7
Associate II

Hello waclawek.jan,

I did the following steps, each time reading out the settings:

Read - Activate RTC out - Read - Deactivate RTC out - Read

 

You can see that the IDR reads '1' directly after activation rtc and then at the following reading, it reads '0'. 

Measuring directly at the pin shows a stable 3.3V.

 

Content of PA4-Setting an RTC_CR. Leading number is timestamp in ms:

(205413): ----------------------------
(205413): Read calibration output: 0
(205413): MODE(2Bit) = 0x0
(205414): OTYP(1Bit) = 0x0
(205414): OSPEEDR(2Bit) = 0x0
(205414): PUPDR(2Bit) = 0x1
(205416): IDR(1Bit) = 0x1
(205416): ODR(1Bit) = 0x0
(205416): AFR0(4Bit) = 0x0

(205417): RTC_CR(32Bit) = 0x00001120

(210981): ----------------------------
(210981): Set calibration output to 1
(210981): MODE(2Bit) = 0x0
(210981): OTYP(1Bit) = 0x0
(210981): OSPEEDR(2Bit) = 0x0
(210982): PUPDR(2Bit) = 0x1
(210983): IDR(1Bit) = 0x1
(210983): ODR(1Bit) = 0x0
(210984): AFR0(4Bit) = 0x0

(210984): RTC_CR(32Bit) = 0x00801120

(213033): ----------------------------
(213033): Read calibration output: 1
(213034): MODE(2Bit) = 0x0
(213034): OTYP(1Bit) = 0x0
(213034): OSPEEDR(2Bit) = 0x0
(213034): PUPDR(2Bit) = 0x1
(213036): IDR(1Bit) = 0x0
(213036): ODR(1Bit) = 0x0
(213037): AFR0(4Bit) = 0x0

(213037): RTC_CR(32Bit) = 0x00801120

(226267): ----------------------------
(226267): Set calibration output to 0
(226268): MODE(2Bit) = 0x0
(226268): OTYP(1Bit) = 0x0
(226268): OSPEEDR(2Bit) = 0x0
(226268): PUPDR(2Bit) = 0x1
(226270): IDR(1Bit) = 0x1
(226270): ODR(1Bit) = 0x0
(226270): AFR0(4Bit) = 0x0

(226271): RTC_CR(32Bit) = 0x00001120

(228363): ----------------------------
(228364): Read calibration output: 0
(228364): MODE(2Bit) = 0x0
(228364): OTYP(1Bit) = 0x0
(228364): OSPEEDR(2Bit) = 0x0
(228364): PUPDR(2Bit) = 0x1
(228365): IDR(1Bit) = 0x1
(228366): ODR(1Bit) = 0x0
(228375): AFR0(4Bit) = 0x0

(228375): RTC_CR(32Bit) = 0x00001120

waclawek.jan
Super User

Can you please try to switch off BYPSHAD?

JW

I switched it off, but except the one cleared bit, the behaviour is the same. Sometimes after activation of rtc, the internal reading of PA4 is '1' and sometimes '0'. Since the debug output takes some time before reading, this is not surprising.

Thanks for the detailed presentation. I asked that this be looked at. You should get a response here within a few days.

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

Thanks.

This was just a blind shot:

I noticed BYPSHAD = 1  (which is IMO a relatively unusual setting generally) in both your RTC_CR readout, and also in both @PBobo.1  and @KhPaul setup in the mentioned similar thread. So I thought it may be worth a try.

JW

Gyessine
ST Employee

Hello @peter7 
I tried replicating your issue and I can confirm the reported behavior when I enable RTC calibration output and configure PA4 pin as input
An internal ticket was submitted for further investigation. Internal ticket number: 226995(This is an internal tracking number and is not accessible or usable by customers).
BR
Gyessine

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.