Open lyellread opened 4 years ago
By default the board is running from an on-board oscillator, not the on-chip PLL, Which is at 16MHz. You need to run startup code to enable the PLL and switch over to that frequency.
That makes alot of sense! Thank you!
I have read this manual about how the hifive1 revb uses the 16MHz Crystal, and how to switch to the PLL, and I wrote up the following code (adding it to the portable_init function in core_portme.c), based on the opposite of what happens in this guide.
//defines for the clock-change process, part of portable_init
#define PRCI_CTRL_ADDR 0x10008000UL
#define PRCI_PLLCFG (0x0008)
#define PLL_BYPASS(x) (((x) & 0x1) << 18)
mmio_write_u32(PRCI_CTRL_ADDR, PRCI_PLLCFG, mmio_read_u32(PRCI_CTRL_ADDR, PRCI_PLLCFG) ^ PLL_BYPASS(1));
Now when the benchmark runs, the output to the console is garbled (I suspect as a result of having successfully changed the core frequency and the UART driver being designed for 16MHZ). The drivers provided in the freedom-e-sdk
are only provided (as far as I can tell) are only provided as .o
files, thus if my assumption about their hardcoded nature is correct, I cannot change them easily.
Do you happen to know where some of this "startup code" is located that sets the clock source to PLL, and maybe UART source files as well?
Thank you! ~Lyell
You can use the cpu and uart functions of this repo: https://github.com/kjarvel/hifive1revb_wifi
I have read this manual about how the hifive1 revb uses the 16MHz Crystal, and how to switch to the PLL, and I wrote up the following code (adding it to the portable_init function in core_portme.c), based on the opposite of what happens in this guide.
//defines for the clock-change process, part of portable_init #define PRCI_CTRL_ADDR 0x10008000UL #define PRCI_PLLCFG (0x0008) #define PLL_BYPASS(x) (((x) & 0x1) << 18) mmio_write_u32(PRCI_CTRL_ADDR, PRCI_PLLCFG, mmio_read_u32(PRCI_CTRL_ADDR, PRCI_PLLCFG) ^ PLL_BYPASS(1));
Now when the benchmark runs, the output to the console is garbled (I suspect as a result of having successfully changed the core frequency and the UART driver being designed for 16MHZ). The drivers provided in the
freedom-e-sdk
are only provided (as far as I can tell) are only provided as.o
files, thus if my assumption about their hardcoded nature is correct, I cannot change them easily.Do you happen to know where some of this "startup code" is located that sets the clock source to PLL, and maybe UART source files as well?
Thank you! ~Lyell
After compiling and running coremark for the HiFive1 RevB, I get unexpected results as far as the clock speed as calculated from the provided data. Results:
Based on those results, I would calculate the CPU Frequency to be
1720290432/107 = 16077480 = 16MHz
. This processor frequency is low of what I would expect out of this board (advertised to run up to 320MHz) - is the number of ticks scaled to optimize register/storage use somehow?