Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help: simulating Cygnal F120 in Keil

Status
Not open for further replies.

sawaak

Full Member level 2
Joined
May 20, 2003
Messages
146
Helped
4
Reputation
8
Reaction score
2
Trophy points
1,298
Activity points
1,069
cygnal f120

Hi,
i am having trouble simulating cygnal F120 controller in keil, it stucks in the Init_Device function in the configuration file. i am attaching my configuration file, plz reply ASAP.

my program stuck in Oscillator_Init function within Init_Device at this line.

while ((PLL0CN & 0x10) == 0);

thanks
sawaak
 

access violation 0x7588

It seems to be an another bug of Keil's Simulation.
Keil used the SYSCLK to determine the PLLLCK (PLL0CN.4) bit. (should use PLL Output Clock)
So you have to switch System Clock Source to PLL before checking the PLLLCK.
Code:
#ifndef __SIMULATION__
#define __SIMULATION__ 0 // 1:simulation, 0:normal
#endif // __SIMULATION__ 
...........
    PLL0CN    |= 0x02;
#if __SIMULATION__
    CLKSEL    = 0x02;
#endif // __SIMULATION__
    while ((PLL0CN & 0x10) == 0);
    CLKSEL    = 0x02;
BTW, a bit of trick for more efficient development:
To add another Project Target (ex: Simulation) in your Project Workspace with same settings as the normal Project Target.
And add '__SIMULATION__=1' at C51 -> Preprocessor Symbols -> Define for simulation Project Target.
 

c51 preprocessor symbols define

yager said:
It seems to be an another bug of Keil's Simulation.
Keil used the SYSCLK to determine the PLLLCK (PLL0CN.4) bit. (should use PLL Output Clock)
So you have to switch System Clock Source to PLL before checking the PLLLCK.
Code:
#ifndef __SIMULATION__
#define __SIMULATION__ 0 // 1:simulation, 0:normal
#endif // __SIMULATION__ 
...........
    PLL0CN    |= 0x02;
#if __SIMULATION__
    CLKSEL    = 0x02;
#endif // __SIMULATION__
    while ((PLL0CN & 0x10) == 0);
    CLKSEL    = 0x02;
BTW, a bit of trick for more efficient development:
To add another Project Target (ex: Simulation) in your Project Workspace with same settings as the normal Project Target.
And add '__SIMULATION__=1' at C51 -> Preprocessor Symbols -> Define for simulation Project Target.

Hi,
thanks for the reply, i have tried the above mentioned tricks, but it still stucks at the same line :cry:, wht to do ??


thanks
sawaak
 

That means the PLL is not locked.
By your code, you'd like to use:
external OSC as PLL clock source, 10MHz < f <= 30MHz, PLLICO for 65~100MHz
i.e. the PLLLCK will be set if PLL Clock is over 65MHz.
So, I set X'tal = 20MHz in Keil C51 v8.05. It is working well as the above (PLL Clock will be 90MHz).
BTW, you can fire up the OSC Control dialog box to check the PLLLCK.

EDIT:
Well, I made a project as the above mentions. The break point has been set after the stuck line.
Just open and simulate it.
 

Hi,
thanks 4 the reply, i simulated your project, it correctly passed the stuck line, but it can not go to the while loop after the Init_Device() function, i made a breakpoint at the while loop and simulate beyond your breakpoint, it gives the following error
"access violation at C:0x7588 : no execute/read permission"
how to remove this error.


thanks
sawaak
 

sawaak said:
i simulated your project, it correctly passed the stuck line, but it can not go to the while loop after the Init_Device() function, i made a breakpoint at the while loop and simulate beyond your breakpoint, it gives the following error
"access violation at C:0x7588 : no execute/read permission"
how to remove this error.
I think this is an another Keil's bug. (SPIF cannot be clear by code)
Since you do not offer the SPI ISR, so the code will be out of control after you enable SPI interrupt (EIE1.0=1).
Well, try this. It will pass up to the point which you'd like.
 

    sawaak

    Points: 2
    Helpful Answer Positive Rating
Hi,
many many thanks, its working fine now.



thanks
sawaak
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top