Based on DE1-SoC kit, I am programming a bare-metal code for dual-core Cortex-A9 ARM hard processor, Cyclone V-SoC.
The configurations of hps output clocks in qsys are:
MPU clock=800 Mhz, L3 MP clk = 200Mhz, L3 SP = 100Mhz, L4 (MP and SP) = 100Mhz.
I am trying only to toggle hps pin, then a code to toggle fpga pin through h2f bridge as follow
Code C++ - [expand] |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| // my code to toggle hps hps_GPIO1[23] pin
int main() {
setup_peripherals();
while (true) {
alt_xorbits_word(hps_addr, 0x800000 );
}
}
// my code to toggle fpga AJ22 pin
int main() {
setup_peripherals();
uint32_t *PIO_addr = 0xC0000000 + PIO_0_BASE;
while (true) {
alt_xorbits_word(PIO_addr, 1 );
}
} |
The code worked but its toggling speed around 500 Khz, as you see it's very slow compared to ARM capabilities
Then I turned on MMU unit and enabled cache system as follow
mmu_init();
alt_cache_system_enable();
here the frequency of toggling increased to 1.3 Mhz.
My Questions are,
How could I increase the toggling speed?
Is this the maximum frequency I can get?
Is there a problem in hps init or configuration?
I tested ARM clocks using alt_clk_freq_get( any_clk, &clk_freq)), I got frequencies as expected, but I am still not sure about this function.