2018-10-23 05:46 PM
I'm finding the documentation to be lacking.
How does PA0 interact with CK_IN? Am I supposed to set PA0 as an Analogue Input?
How is CK_IN connected to OSC_IN?
How am I supposed to use this? HSE_BYPASS ?
The "clock detector" in the Clock tree of the data sheet is not further explained, presumably it flags HSERDY, but it lacks clarity.
I will note my first try with HSE_BYPASS resulted in my board not starting, perhaps dying silently in Error_Handler(), Debugger connectivity not an option right now.
2018-10-24 12:27 AM
I would be very surprised if this wouldn't be simply the OSC_IN i.e. PH0 pad bonded together with PA0 to the same physical pin.
Just for the laugh, while running from the default internal clock (MSI) could you please try to configure PH0 to output, wiggle it and look at the PA0 pin?
JW
2018-10-24 05:46 AM
I kind of expect it is two pins bonded together, but the lack of explicit and complete description of what's going on, compounded by the lack of examples, is somewhat frustrating. Large opportunity for #FAIL
Will try the thought experiment when I get to the office.
2018-10-24 06:19 AM
did you check the cube ?
checking now, set PA0 to Analog..
ooops there is no AD0 on this processor, according to the cube...
2018-10-24 09:47 AM
On the drive in I remembered the boards either have 10 or 20 MHz signals on.
I read bits off PA0 and PH0 in different passes, was able to see transitions on PA0, not on PH0 (assuming bank is available on this die).
Going to see if I can enable HSE and time it internally
RM0394 Rev 4
"Using the HSE or LSE oscillator pins as GPIOs" section talks about OSC_OUT OSC32_OUT, no discussion of CK_IN case. Going to my original complaint, coverage is cursory, and not sufficiently thorough or carried through the document adequately.
"10.3.5 From HSE, LSE, LSI, MSI, MCO, RTC to timer (TIM2/TIM15/TIM16)
Purpose
External clocks (HSE, LSE), internal clocks (LSI, MSI), microcontroller output clock (MCO),
GPIO and RTC wakeup interrupt can be used as input to general-purpose timer (TIM15/16)
channel 1.
This allows to calibrate the HSI16/MSI system clocks (with TIM15/TIM16 and LSE) or LSI
(with TIM16 and HSE). This is also used to precisely measure LSI (with TIM16 and HSI16)
or MSI (with and HSI16) oscillator frequency.
When Low Speed External (LSE) oscillator is used, no additional hardware connections are
required.
This feature is described in Section 6.2.17: Internal/external clock measurement with
TIM15/TIM16.
External clock LSE can be used as input to general-purpose timers (TIM2) on TIM2_ETR pin, see Section 27.4.19: TIM2 option register 1 (TIM2_OR1).
Active power mode
Run, Sleep, Low-power run, Low-power sleep."
I find this paragraph not to be helpful, I don't see how HSE can clock any of these TIM directly, it is not a routable peripheral clock, and can only act as a source in the sense that I have to use HSE as SYSCLK.
I can measure PA0 (CK_IN) frequency via TIM2_CH1 in External Clock mode, I coded this myself, as NO examples of this TIM mode in the Cube/HAL trees. The casual STM32 user might not even identify this as a possibility, and the section here wouldn't alert the user to such an opportunity.
2018-10-24 11:49 AM
> I read bits off PA0 and PH0 in different passes, was able to see transitions on PA0, not on PH0 (assuming bank is available on this die).
Then my guess was wrong.
It sill can internally connect to the same node as the output from the "real" HSE; and may have the same treatment as far as GPIO goes, i.e. switching HSE on (RCC_CR.HSE_ON=1) may disable GPIO's PA0.
> I don't see how HSE can clock any of these TIM directly,
The idea presumably is, that you clock TIM from a different clock, and use capture to determine their mutual relationship. HSE/32 can be mapped to TIM16 input capture, see TIM16_OR1.TI1_RMP
An interesting remark in chapter 28.4 Implementation of RM0394, which says that "The extended remap [...] is not available on STM32L471xx devices.", while RM0394 is not pertinent to the 'L47xx...
The "Interconnection" chapter can be significantly improved, I agree.
JW
2018-10-24 03:54 PM
2018-10-24 04:23 PM
I have a pair of clocks, the primary source goes to PA0/CK_IN with routes to TIM2_CH1 via the AF matrix. I have a secondary clock on PA5 which routes to TIM2_CH1 or TIM2_ETR depending on the AF matrix.
I can measure both (one at a time) of these on a 1 Hz interval by using TIM2_CH1 as an External Clock for TIM2, so nominally observe the TIM2->CNT advance 10 or 20 millions ticks.
I didn't see the HSE/32 option for TIM16, I'll look at it again. Perhaps via RTC clocking from HSE divided down. I'm using an L432KC (32-pin QFP) in the context.
I, like Jan, assumed some simple bonding, but not convinced that's what's happening.
I did get HSE to come up in BYPASS and flag as READY.
2018-10-24 04:33 PM
I don't see how HSE can clock any of these TIM directly, it is not a routable peripheral clock, and can only act as a source in the sense that I have to use HSE as SYSCLK.
Yes the cube shows, HSE can be routed to the timers by
PLL source HSE -> PLLM to system clock source -> sysclk to APB1 Timer clocks
however,
LPTim1/2 can only be clocked by PCLK1, LSI, HSI, LSE not HSE
2018-10-24 07:06 PM