qc of boards with teensy bootloader - bring RTC clock to a digital output

Status
Not open for further replies.

biketart

New member
I have a client using your teensy bootloader ICs on their hardware.

Im writing QC procedures, and want their pcb stuffer to QC boards.
I need to verify the correct operation of the 16MHz and 32K RTC clock – the scopes that the suppliers will overload the Clks, so I wish to bring these clocks straight through onto a pair of spare pins and run a very basic QC sketch program for hardware verification.

I just used the PWM function(analog write) to confirm correct frequency of the 16Mhz, divided by 32k of course to 488.25hz.

Is there a convenient code example of how to bring the 32K RTC clock out, even if divide, preferably by an integer, so it can be probed?

It should be known im a hardware guy thru & thru, minimal SW/FW ability...

B.
 
I believe I sent you an email reply with:

Look at CLKOUTSEL in the SIM_SOPT2 register, and the ALT5 mux setting for PORTC_PCR3, pin PTC3 (or Arduino pin 9).

To expand on that just a bit more, if you write to SIM_SOPT2 to select the 32 kHz clock, and put PTC3's mux into ALT5 mode, you should get a 32 kHz square wave on pin 9 (PTC3) directly from the on-chip oscillator.
 
hi all,
this sounds like writing in assembly many years ago for pic's..

but how do i do this in the arduino enviroment? can anyone give me an example of code where control bits of configuration registers are setup?
i had a dig, but i couldn't find any examples in the arduino IDE..


B: confused:.
 
As you asked for special feature, you may have to write it yourself

I assume you wanted code for T3.x and not T4
So, I checked kinetis.h, the k66 manual and some other core samples and
Code:
 SIM_SOPT2 |=  SIM_SOPT2_CLKOUTSEL(5);
 CORE_PIN9_CONFIG  = PORT_PCR_MUX(5);
 
Yes, that's pretty much it. But that 3 bit field needs to be cleared to zeros before the logical or.

I ran this on a Teensy 3.5 and saw a 32.768 kHz square wave on pin 9.

Code:
void setup() {
  SIM_SOPT2 &= ~SIM_SOPT2_CLKOUTSEL(7);
  SIM_SOPT2 |=  SIM_SOPT2_CLKOUTSEL(5);
  CORE_PIN9_CONFIG  = PORT_PCR_MUX(5);
}

void loop() {
}

DSC_0640_web.jpg

file.png
 
from the K64 Sub-Family Reference Manual, Rev. 3, July 2017, and considering im using the 144 pin LQFP device, not the 144 pin BGA:
RTC_CLKOUT is available on PIN 1 (PTE0) in ALT 7 mode, and PIN 47 (PTE26) in ALT mode 6.

a bit of bodging, since ard' pins are defined for a 144pin BGA, this worked spitting out 32K to LQFP pin 47.... note my amazing C skills :) to set RTC clock to not 1hz, but the orignal 32k..

void setup() {
// put your setup code here, to run once:

// since a

//SIM_SOPT2 |= SIM_SOPT2_CLKOUTSEL(5);
SIM_SOPT2 = 0x00b0;

CORE_PIN24_CONFIG = PORT_PCR_MUX(6); // comes out on LQFP pin 47... see pinlist...

}

void loop() {
// put your main code here, to run repeatedly:


}

thanks all for your help!
 
Status
Not open for further replies.
Back
Top