HC908KX8 - Problem with running code in Target without the MON08 debugger connected

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HC908KX8 - Problem with running code in Target without the MON08 debugger connected

5,975 Views
bespenschied
Contributor III
I am using Codewarrior for the HC08. I have my code working for the MC68HC908KX8 part with the MON08 interface connected to the target and my PC running the True-Time Simulator in In-Circuit Debug/Programming mode. The code runs fine. When I remove the MON08 Interface and power up the Target board the program does not run.
 
I have used this same mon08 interface and Codewarrior to develop software for the GP32 chip and it works fine by itself or with the mon08 interface. Now that I changed to the KX8 my target will not run by itself. Is there something I am missing that needs to be done to get a target board to run by itself? Config registers? I am using a 9.8304MHz Oscillator as my clock source connected to pin 10. I have the CPU bean in CW set to use the external oscillator. The Oscillator is running. The CPU pins are not changing state. I even installed a reset button and still nothing seems to be working.
 
Any Ideas?
 
Thanks!
 
Labels (1)
Tags (1)
0 Kudos
10 Replies

631 Views
bespenschied
Contributor III

I figure it out finally. The Processor Expert code is bad. When you select the CPU bean for the 68HC908KX8 you have options to select which clock you are going to use. No matter which clock you choose the bean generates code that always selects the internal clock source. According to the documentation for the 908KX8 you can only write to the CONFIG registers once after reset. The code generated by the bean tries to write to the CONFIG2 register more than once.

Here is the code it generated:

 /* CONFIG1: COPRS=0,LVISTOP=0,LVIRSTD=0,LVIPWRD=1,LVI5OR3=0,SSREC=0,STOP=0,COPD=1 */
 CONFIG1 = 17;                        /* Set the CONFIG1 register */
 /* CONFIG2: Unused=0,Unused=0,EXTXTALEN=1,EXTSLOW=0,EXTCLKEN=0,Unused=0,OSCENINSTOP=0,SCIBDSRC=0 */
 CONFIG2 = 32;                        /* Set the CONFIG2 register */
 ICGCR = 31;                          /* Enable the external and internal oscillator */
 while(!ICGCR_ECGS);                  /* Wait for external oscillator stabilization */
 ICGCR_CS = 1;                        /* Select the external clock */

Notice when it writes to the config register --> CONFIG2 = 32;

It then attempts to select the external clock 3 lines down. When I disable the PE and change the CONFIG2=32 to CONFIG=8 my board works in the debugger and standalone.

Thanks for your help.

bcde

 

 

0 Kudos

631 Views
ProcessorExpert
Senior Contributor III
Dear Customer,
 
You probably use old and non-updated Processor Expert version 2.94 released two years ago. This version contains CONFIG2 initialization bug that was fixed by patch 01 for PE 2.94 in December 2004. The patch 01 is available to download from website www.processorexpert.com. Please install it and your problem will be fixed. To checking new patches on website it is possible to use menu command Processor Expert -> Updates - > Check Processor Expert Web for Updates. Your problem was also resolved in newer versions.
About writting to the CONFIG2 register, I found only one case (CONFIG2 = 32). Please describe shortly next cases of writting to CONFIG2 register.
Best Regards, Processor Expert Support
0 Kudos

631 Views
bespenschied
Contributor III
I purchased a full student license for the CWV2.1. It has Processor expert V2.87. I went to the website and downloaded the only update I found for the 2.87 version. pe28702_hc08patch.PEupd
 
Unless I can update the whole Processor Expert to a newer version?
 
I inquired about upgrading my Academic license to the newest Version but I have not gotten an answer yet.  I am afraid to use the new version to continue my work with in case I run into a problem with the limitations of the new version licensing and then I have to go back and convert all the code to the older version.
 
Does the V2.1 have a fix for this problem?
 
bcde
 
0 Kudos

631 Views
marc_paquette
Contributor V
How did you enquire about getting updates? Who did you contact? I'll see if I can get an answer for you.
 
Marc.
0 Kudos

631 Views
bespenschied
Contributor III

It has been a few weeks. If I remember the last response I got was to just download the new version and get a limited license. From past experience the limited licenses caused me problems. You can't use but 1 or 2 tools in the Simulator at a time, and I can't remember the other reasons  now because I have not had to deal with the limited license for a while now.

I never heard from anyone else since then. With all the time I have wasted on problems with the old version It will be worth it to upgrade if I can get the student price for the upgrade. Thanks for your help.

 

bcde

 

0 Kudos

631 Views
ProcessorExpert
Senior Contributor III
About upgrading and licencing it is necessary to contact Freescale. The Processor Expert(PE) is distributed as a plug-in with CodeWarrior(CW) together and therefore PE versions are bundled with CW and you need to upgrade CW too.
Patch fixed this problem doesn't exist for PE 2.87 and CW2.1, you have to upgrade to newer version CW and PE.
 
Best Regards,
Jan Pospisilik
Processor Expert Support
0 Kudos

631 Views
peg
Senior Contributor IV

Ahhh Processor Expert........ far easier to read the book and become a processor expert yourself IMHO.

It works well most of the time but the time spent working out what went wrong when it doesn't knocks all the previous savings on the head. And you haven't learnt anything.

Peg

 

0 Kudos

631 Views
peg
Senior Contributor IV

Hi,

If you can just run the simulator the press run and it works then it should power up on its own and run as well. You shouldn't have to do anything extra.

Its not going into monitor mode when you power it up on its own, is it?

BR Peg

 

0 Kudos

631 Views
bespenschied
Contributor III
I have always been able to just remove the MON08 interface and power up the target and it works. I can not get this one to do that.
 
I monitored the PTA0 pin and nothing is happening there so I am pretty sure it is not going into monitor mode. There is no Vtst voltage on the IRQ pin (4).
 
Interesting thing, I am using PTA4,PTA3 as switch inputs. They are set with pullups in the code. PTA2 is unused. I am getting a 1 on the PTA4 & PTA3 pins and 0 on the PTA2 pin which is how they should be if the program was running. But the PTB1,PTB2,PTB4,PTB5 pins are all outputs controlling LED's. None of them change state and PTB2 is supposed to be changing state about every 500ms.
 
brian
 
 
 
0 Kudos

631 Views
bespenschied
Contributor III
I noticed in the debugger command window the following:
 
Opening COM1 at 9600 baud ... Opened.
Trying Security $E562E13FE1B9E140 Success.
  (Successful Status: 0=Y,1=Y,2=Y,3=Y,4=Y,5=Y ($C2),6=Y)
Switching MCU to External Clock ... Successful.(CONFIG1=$48)
Enabling Break Mode ... Enabled.
Contact with HC08 Monitor established.
Monitor Code Version:17
Attempting soft reset of HC08 device ... Success.(RSR=$48)
Switching MCU to External Clock ... Successful.(CONFIG1=$48)
Enabling Break Mode ... Enabled.
CPU reset by debugger.
executing .\cmd\reset.cmd
!// After reset the commands written below will be executed
done .\cmd\reset.cmd
Reset command file correctly executed.
RESET
Waiting for keystroke or breakpoint ...
STARTED
RUNNING
in>
 
Why would the command to change the clock to external be needed by the debugger when it is set in the startup code? The startup code according to the CPU bean sets the external clock as the source and the internal clock is not used.
 
bcde
 
0 Kudos