Hello,
I've been trying unsuccessfully to get the 1Hz RTC clock to appear on PTB13, the RTC_CLKOUT pin.
Here is what I am doing to set-up the RTC and clocks to enable this to happen:
// (01)Set the clock ERCLK32K output on pin13, (00) clock not output
SIM_BWR_SOPT1_OSC32KOUT(SIM_BASE_PTR,0b00);
// Enable access and interrupts for RTC
SIM_BWR_SCGC6_RTC(SIM_BASE_PTR, 1);
// Enable a clock for the RTC so it can output the 1Hz clock, OSC32KCLK (00), LPO(11), RTC_CLKIN (10)
SIM_BWR_SOPT1_OSC32KSEL(SIM_BASE_PTR, 0b11);
//Selects the RTC 1Hz (0) or OSCERCLK (1) Clock for output on RTC_CLKOUT pin
SIM_BWR_SOPT2_RTCCLKOUTSEL(SIM_BASE_PTR, 0);
//Enable the time counter
RTC_SR=0b00000000000000000000000000010001;
//Enable the port
PORT_BWR_PCR_MUX(PORTB, 13, 0b011); //Set the Alt3 muxing on PortB, pin 13 for RTC_CLKOUT
GPIO_SET_PDDR(GPIOB, 1U<<13); //Set PORTB pin 13 to output
This does not work, I get a flat line on PTB13. I have played with the sequence of some of these commands, like enabling the time counter RTC_SR after the port definition, but no change. If I change the RTCCLKOUTSEL to 1, I do see the correct signal on PTB13. I am puzzled! Is there something I'm missing?
Also, what is the meaning of "Pad Interface" in Figure 5-4 from the user's manual?

Thanks,
Sara