How to change clock frequency?

Discussions relating to the XK-EVK-XU316
andy-aic
Member++
Posts: 26
Joined: Thu Jun 27, 2024 3:38 pm

How to change clock frequency?

Post by andy-aic »

Hi,

I see in the XU316-1024-FB265 datasheet that the clock frequency can be set up to 800 MHz:

Speed Grade
• 24: 600 MHz; up to 2400 MIPS, 1200 MFLOP/s, 38.4 GMACC/s
• 32: 800 MHz; up to 3200 MIPS, 1600 MFLOP/s, 51.2 GMACC/s

(side note: what does the 24/32 mean?)

How can I change it to 800 MHz? I found that there is a SystemFrequency field in the XK-EVK-XU316.xn file under /path/to/xtc-tools/targets/XK-EVK-XU316/

Code: Select all

<Node Id="0" InPackageId="0" Type="XS3-L16A-1024" Oscillator="24MHz" SystemFrequency="600MHz" ReferenceFrequency="100MHz">
Is changing this value the way to do it?

Should I copy this file into my own project and used the modified xn file instead in order not to mess with the original config? How do I do that?
maxter
Member
Posts: 14
Joined: Fri Jun 14, 2024 9:55 am

Post by maxter »

Hi Andy,

I don't know about how to set/change clock frequency on the system, but I can explain what the speed grade is...

The speed grade in chips is a "physical property" of the die, that tells whether a chip is capable (or not) to sustain certain frequencies; this means that to be able change the clock frequency you need to have a die of the correct speed grade, i.e. if you have the explorer board, you are fine, since according to the schematics it has a C32 die, if you have the multi channel audio board, you'd need to replace the XU316, because (again according to the schematics) it uses a C24 chip.
danielp
Member
Posts: 8
Joined: Tue Jul 16, 2024 9:52 am
Location: Bristol, UK

Post by danielp »

The SystemFrequency value in the XN file is the place to change the core clock frequency.

It's best practice not to edit the files inside your installation of XTC Tools, so you should copy XK-EVK-XU316.xn into your project. You should place it anywhere inside the src directory in your application, and it would be a good idea to rename it, eg. XK-EVK-XU316-800.xn to reflect the change you make.

Then in your application's Makefile, you should set the variable with the filename of this application-local XN file:

Code: Select all

TARGET = XK-EVK-XU316-800.xn
The build system will search for this file within your application directory.

And regarding your side-note question: the 24/32 refer to the 2400/3200 MIPS available at the different speed grades. For a 600MHz part, you have 600 MIPS available on each of the two tiles, giving 1200 MIPS, which can then double up to 2400 MIPS when running in dual-issue mode.
andy-aic
Member++
Posts: 26
Joined: Thu Jun 27, 2024 3:38 pm

Post by andy-aic »

Hi,

Thanks for your answers, they do help :)

Unfortunately after increasing the clock frequency the program seems to get stuck somewhere when ran.

I basically just changed the 600 to 800 here:

Code: Select all

<Node Id="0" InPackageId="0" Type="XS3-L16A-1024" Oscillator="24MHz" SystemFrequency="800MHz" ReferenceFrequency="100MHz">
Is there anything else I need to change?
danielp
Member
Posts: 8
Joined: Tue Jul 16, 2024 9:52 am
Location: Bristol, UK

Post by danielp »

You don't need to change anything else. In general, it is possible to choose a system frequency that is not valid, but in that case warnings or errors will be displayed when compiling and linking the application. Your choice of 800MHz is fine, so that isn't the problem here.

If you don't already know where your application is getting stuck, you could try running with xgdb or using the --dump-state option with xrun.
andy-aic
Member++
Posts: 26
Joined: Thu Jun 27, 2024 3:38 pm

Post by andy-aic »

I wasn't able to debug with xgdb, but I was able to reproduce the issue (or similar) with this example: https://github.com/xmos/ai_tools/tree/d ... ngle_model

When I change the target to a custom xn file that has the SystemFrequency set to 800 MHz, the program outputs this when ran with xrun --xscope bin/app_flash_single_model.xe:

Code: Select all

fast flash init err -1
I then noticed that the xflash command also takes in a --target option which I had been using as xflash --target XCORE-AI-EXPLORER --data xcore_flash_binary.out, so I thought maybe if I changed the target to my custom xn file it would work, but I get the following error:

Code: Select all

Error: F03089 When multiple upgrade images and no global factory image is specified a target must be specified with --target.
I tried the following commands:

Code: Select all

xflash --target XK-EVK-XU316-custom.xn --data xcore_flash_binary.out
xflash --target src/XK-EVK-XU316-custom.xn --data xcore_flash_binary.out
Both give me the above error. Any clues?
maxter
Member
Posts: 14
Joined: Fri Jun 14, 2024 9:55 am

Post by maxter »

andy-aic wrote: Tue Jul 16, 2024 4:40 pm I wasn't able to debug with xgdb, but I was able to reproduce the issue (or similar) with this example: https://github.com/xmos/ai_tools/tree/d ... ngle_model

When I change the target to a custom xn file that has the SystemFrequency set to 800 MHz, the program outputs this when ran with xrun --xscope bin/app_flash_single_model.xe:

Code: Select all

fast flash init err -1
I then noticed that the xflash command also takes in a --target option which I had been using as xflash --target XCORE-AI-EXPLORER --data xcore_flash_binary.out, so I thought maybe if I changed the target to my custom xn file it would work, but I get the following error:

Code: Select all

Error: F03089 When multiple upgrade images and no global factory image is specified a target must be specified with --target.
I tried the following commands:

Code: Select all

xflash --target XK-EVK-XU316-custom.xn --data xcore_flash_binary.out
xflash --target src/XK-EVK-XU316-custom.xn --data xcore_flash_binary.out
Both give me the above error. Any clues?
I think that error message is misleading, but what I can see from the commands you posted, they are missing the .xe file to load:

Code: Select all

xflash --target <your xn file with path relative to "here"> --data xcore_flash_binary.out <your xe file>
andy-aic
Member++
Posts: 26
Joined: Thu Jun 27, 2024 3:38 pm

Post by andy-aic »

That doesn't seem to be necessary when using the xn file with 600 MHz and it works fine. In fact it is documented in the example that the command doesn't need the xe file to load:

https://github.com/xmos/ai_tools/blob/d ... README.rst
mmar
XCore Addict
Posts: 131
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

Primary you mix --target and --target-file read https://www.xmos.com/documentation/XM-0 ... anual.html
User avatar
Ross
Verified
XCore Legend
Posts: 1070
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

maxter wrote: Wed Jul 17, 2024 8:07 am I think that error message is misleading, but what I can see from the commands you posted, they are missing the .xe file to load:
He's just programming data, by the looks of it, so doesn't need an .xe.
andy-aic wrote: Tue Jul 16, 2024 4:40 pm
I tried the following commands:

Code: Select all

xflash --target XK-EVK-XU316-custom.xn --data xcore_flash_binary.out
xflash --target src/XK-EVK-XU316-custom.xn --data xcore_flash_binary.out
Both give me the above error. Any clues?
this should be --target-file rather than --target

use --target for targets included with the XTC tools, use --target-file for your custom, local, xn files.

note, if you're trying to run a 24 speed grade part at 800MHz, expect it to fail in random ways.
Technical Director @ XMOS. Opinions expressed are my own