Hello, I'm Hachi.
Last time, I studied Power On Reset (POR).
How is the initialization time determined?
When I searched for Initialize in the handbook, the following page was hit.
Configuration -> Configuration Process -> Initialization
(From "Configuration and Remote System Upgrades in Cyclone IV Devices")
After the configuration data is accepted and CONF_DONE goes high, Cyclone IV devices require 3,192 clock cycles to initialize properly and enter user mode.
As written in the handbook, the time required for initialization is 3192 clock cycles.
So, it seems that the initialization time can be calculated if the clock frequency is known.
Therefore, I made the following hypothesis.
"Since the clock (DCLK) is supplied from the FPGA in the AS mode configuration,
Isn't the clock at initialization also supplied from the FPGA side? "
It looks like my hypothesis was half correct.
Two types of initialization clock can be selected: internal clock (DCLK) and external clock.
Let's look at each case.
* In AS mode, CLKUSR is only supported by the Cyclone® IV GX series.
In Cyclone IV devices, the initialization clock source is either the internal oscillator or the optional CLKUSR pin.
Internal clock (using DCLK)
When using the internal clock, the frequency depends on whether the MSEL pin is configured in Fast or Standard mode.
Also, the following DCLK was described on the Altera website.
・ Fast Mode・・・ Max 40MHz, Min 30MHz
・ Standard Mode・・・Max 20MHz, Min 10MHz
Since my board is designed in Standard Mode, the initialization time can be calculated as follows.
Initialization time = number of rises of clock * frequency
・ Worst case: 3192 cycles * 100ns (10MHz) = 319.2us
・ Best Case: 3192 cycles * 50ns (20MHz) = 159.6us
Now, we know how long it takes for the initialization to finish.
Let's review again and see the time (Worst Case) from turning on the fire to entering user mode.
Time to user mode = POR time + configuration time + initialization time
= 200ms + 147.2ms + 319.2us
= 347.5ms
external clock
The initialization time cannot be determined unless the external clock frequency is determined.
Then, is it possible to freely choose the clock frequency?
Extreme story, is it okay to put 1GHz? That's not true.
It is properly specified in the handbook, and the external clock is also Max 40MHz.
Below is the article.
Configuration -> AS Configuration -> Single Device AS Configuration
(From "Configuration and Remote System Upgrades in Cyclone IV Devices")
So how do you connect when using an external clock?
I checked the handbook and the Pin Connection Guideline!
This is basically the same connection as when using the internal clock.
According to the Pin Connection Guideline, if you use this pin, you should connect it to an oscillator.
Must be connected to GND if unused.
It also seems that Quartus II needs to be set as well. I actually set it in Quartus II.
The following two steps can be used to set the CLKUSR pin to be used or not used.
・ Check CLKUSR in Assignment -> Device -> Device & Pin Options -> General
・ Clock selection at Assignment -> Device -> Device & Pin Options -> Configuration -> Active serial clock source
(* This option is only supported by Cyclone IV GX)
When I made the above settings and ran the compilation, the information was indeed spit out in the report.
Here's how to check:
Compilation -> Fitter -> I/O Rules Section -> Device Option
When should the external clock be turned on and when should it be turned off?
Looking at the PS and FPP mode configuration timing diagrams, CLKUSR is enabled after 4 DCLK cycles.
Furthermore, if you want to stop the external clock after the initialization is finished, it looks good to look at the INIT_DONE pin and stop it!
The figure below shows the behavior of the configuration signals.
Now you know how long it takes from turning on the fire to entering user mode!
But here I have a new question.
POR is the time to reset the FPGA.
Initialize is the time to assign 0 (initial value) to the register of FPGA.
I don't understand the difference between the two...
It seems that reset and initialization are the same.
Next time, we will study the difference between initialization and POR.