I try to find a reliable and reproducable method to measure the MOCO and SOSC for S3A1 and S3A6. Sadly I can't use the CLKOUT feature or a PWM out via GTIOCA or GTIOCB.
Is there a realiable way over GPIO toggling?
Here is an example project that shows the concept.
It is written for the TB_S3A6.
The GPT interrupt will generate an interrupt that will trigger the DMAC and toggle the Port pin.
Measuring the GPT output…
Which I/O do you have available? Do you have any pins on PORT1, 2, 3, or 4? If so you can use the GPT to toggle an I/O pin via an ELC event. This will provide a hardware deterministic transition. Set the ELC control register of IO Port to set on an ELC event. In the GPT ISR, you will have to reconfigure the IO Port to clear on the ELC event - etc...
I have used this approach before when I have run out of GPT pins
Hello Richard,thanks for your answer. I sadly have only the following Ports available:
So I assume you wish to output a signal and verify the accuracy of the MOCO and SubOsc by measuring on an oscilloscope?
If so, you could potentially use the DMAC to write to the Port Control Register 3, set and clear bits. The DMAC can be triggered by a GPT. Again, as this is all being performed in hardware the output of the waveform will be consistent and representative of the MOCO and Sub-Osc.
Yes, exactly. I wish to verify the MOCO and SOSC in terms of accuracy and jitter. I would have never thought about using DMA for this, but you would recommend it? Did you have good experience with this approach?
Measuring the GPT output and DMAC pin toggle, you can see that the pin pin toggle lags the GPT, as expected. This is consistent at 12 clock cycles. You can therefore use the pin toggle as a reliable measure of the system clock frequency.
For example, running the system on the MOCO, I with a GPT period of 12, I would expect waveform with a high time / low time = 1.5us. I measure 1.462us, on both the GPT output and the pin toggle output.
Hope this is of interest
Yellow = GPT output
Green = Pin toggle via DMAC
thanks Richard for your detailed answer and example. I will also try a comparison between the CLKOUT, the GPT and DMARC toggel version with an evalboard to see how precise and reliable all options are.