Re: Clock Control question
What do you mean when you say “the Clock”? clock control in case of Nordic is using single device and subsys argument determines the type of the clock (high frequency, low frequency, etc.). However, clock control API is assuming single user of the clock and in case of those clock types there are multiple users (e.g. Bluetooth or USB requests same HF clock subsys). Because of that, clock control API cannot be used directly but rather use onoff manager API which manages multiple requests.
Which clock you want to “extract”? Is it current system clock? For that check kernel API like “k_cycle_get_32” or “k_uptime_get”.
From: users@... <users@...> On Behalf Of Steven Ghekiere via lists.zephyrproject.org
Sent: Friday, January 1, 2021 4:54 PM
Subject: [Zephyr-users] Clock Control question
First off, best wishes for 2021! :)
I've been struggling with using a Clock control. My aim is to be able to calibrate two clocks using BLE and nordic nrf52840 chipsets.
I've looked through the Clock Control API and found the relevant device binding.
But now I'm supposed to use a "clock_control_subsys_t" struct which "is a type to identify a clock controller sub-system". A bit vague but I think I understand it.
However I'm not sure how I can initialize this variable? Using this without any initialization results in an error when calling "clock_control_on". Or maybe is my device binding "DT_LABEL(DT_INST(0, nordic_nrf_clock))" wrong? I found this in a couple related tests I think...
Also, since I'm using a Nordic device I assume I'm able to include the <include/drivers/clock_control/clock_control_nrf.h>.
Since there isn't an example for this (there is for litex, which I'm not familiar with), I'm not too sure how the original Clock Control and the Nordic Clock Control work with each other.
The litex example also use totally different structs which makes me believe this isn't worth looking into.
So to sum up,
1) How do I setup the Clock? Am I doing something wrong? I can send snippets if needed.
2) How should I use both nRF and normal Clock Control?
3) How can I 'extract' the clock value (to send it using Bluetooth) and set it on the receiving end.