Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 23 Mar 2004 09:48 AM by  picman@uk2.net
Clock Speed Issue?
 5 Replies
Sort:
You are not authorized to post a reply.
Author Messages
picman@uk2.net
New Member
New Member
Posts:


--
17 Mar 2004 07:15 PM
    Hi,

    I am writing some code for a software spi interface (its funny spi 15 1/2 bits)..

    I am having some problems with a timing issue..

    In GHS muti 2000 if i write a small piece of code eg
    time=0
    set_rtc(time); // set rtc to zero
    print(time); // dump rtc value on lcd
    i=1000000;
    while(i--); // wait 20,000,000 cycles
    time=get_rtc(); // shoud be 1 second or less... getting 5 seconds at 200mhz
    print(time); // dump rtc value on lcd

    and the clocks are setup for max speed set_clock_speed(C200_100_50)
    the compiler generates 20 line of asm for the loop.

    So if 1 instruction per cycle it should complete the loop in 20000000 cycles, 20ms...

    Even if some of the instructions are 2 cycles its still not correct...


    it takes 5 seconds to complete the loop!

    Setting the clock to the slowest setting CPU=33 etc it take 13 seconds


    I have read the CPUCLK reg back and it does say its set to 199987200 which is corected, or 33mhz for min clock speed.


    It seem like the cpu is running at 4MHZ ish..

    I do have a jtag debugger atatched but i understand this has no effect on the cpu speed, or does it?
    Can anyone explain whats going on?
    I have a PIC that can do this loop faster!!


    Please understand i am not a asembly lang programmer, and also i do not want to use this code as a delay loop, its only an example to get the cpu to do something for a set time with the least number of cycles, i also understand that the rtc is prob not acurate, but i do get the same time value every time i run the code.


    Help!
    elf-coastal@buici.com
    New Member
    New Member
    Posts:


    --
    22 Mar 2004 11:03 AM
    one can only guess.

    Is the cache enabled?
    elf-coastal@buici.com
    New Member
    New Member
    Posts:


    --
    22 Mar 2004 11:08 AM
    What is the value at 0x80000e20? 0x4ee39 will give you a 200MHz CPU clock with a 100MHz HCLK.

    And which JTAG emulator are you using?
    picman@uk2.net
    New Member
    New Member
    Posts:


    --
    22 Mar 2004 01:24 PM
    Thanks for the reply,

    Yes if i read the csc clock values they are indeed correct,

    Since the post i have done a lot of investgating into this problem, and found if i upload the elf file using lolo then it does indeed work correctly...
    So i think this means that the jtag or GHS Multi 2000 debugger does slow down the target, by lots.

    If the debugger is getting info from the target every instruction this would explain it.. its running about 50 times too slow..

    But shouldn't the debugger just tell the target to run, and when stoped get the info it wants then??? dunno...


    I am using the ashling opella JTAG, but have just bought a raven..

    The raven, i just found out is not supported by GHS Multi 2000 v3.6.1 for the arm9.. could it get any better?

    I wished the companies would get their acts together and work together to produce a low cost compiler and debugger that supports lowcost jtag emulators... there really is no need for all this lot to cost so much..
    I will be looking into building a JTAG that is low cost and works with lots of cpus.. After all there are JTAG chips for sale so its just implementing the chain constructors in a small fast mpu...

    Now we are looking at GNU and GDB for a working solution...

    Any ideas to get a good C compiler - debugger - and JTAG without spending a load of wedge???
    elf-coastal@buici.com
    New Member
    New Member
    Posts:


    --
    22 Mar 2004 01:38 PM
    I'm using the BDI2000 from Abatron. Not one problem so far. Their support for GDB is excellent. It's fast and it's retargetable. I wouldn't say it is cheap, but the time I've saved with this device has made it all worthwhile.

    Cheers.
    picman@uk2.net
    New Member
    New Member
    Posts:


    --
    23 Mar 2004 09:48 AM
    Thanks Marc, Yes i have looked at the BDI2000, I don't think looking now, that its a specific jatag problem... maybe down to the debugger...
    You are not authorized to post a reply.