EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Failure of 68HC908KX8 Monitor Mode

Started by Jack October 7, 2004
Question: Is it possible to somehow disable the KX8's monitor mode by
means of an application loaded into its flash memory?

My setup as follows: I built a MON08 circuit as per circuit on page
193 of 68HC908KX8.pdf. I used a 74HC04 inverter with 9.8304MHz
crystal, and constructed the circuit on Veroboard.  All voltage levels
on the device measures OK, as well as the clock signal.  I proceeded
to upload the bootloader as contained in AN2295 using prog08sz, but
never managed to get it working in conjunction with hc08sprg.exe (HC08
never ACK'ed on power reset).  I then erased the device and compiled a
small test program derived from AN2616 page 26, using Metrowerks
CodeWarrior.

I then uploaded the file named P&E_FCS.abs.s19, and straight after
that I lost all control with the device from within prog08sz.  I could
not establish a connection with the device again through the MON08
interface. Even in Hyperterminal I do not see double echo characters
coming back from the micro, only 1 byte is echoed back.  I checked my
voltage levels on IRQ1, etc, but to no avail.  I inserted another
virgin device into my MON08 circuit, and it functions without
problems.  But the original device seems to be unable to enter into
monitor mode.

Surely uploaded firmware should not preclude the use of the monitor
mode, especially if one presets IRQ1, PTA0, PTA1, PTB0 and PTB1
externally, and use an external oscillator?  Why would this upload
cause one to lose control of the device in monitor mode?  What did I
do wrong?  Please advise.

Thank you.
Jack wrote:

> Question: Is it possible to somehow disable the KX8's monitor mode by > means of an application loaded into its flash memory?
Does your application alter the vectors from 0xf6 to 0xfd? These are also used as security bytes that have to be sent to enable the user flash memory. I am not familiar with the development software you're using: I wrote my own monitor mode programming software that runs on gnu/linux and FreeBSD. My software has a command line switch to load an eight byte security file. How does the software you're using handle the security bytes? Ian -- Ian Stirling, G4ICV, AB2GR
Donna and Ian wrote:

> Does your application alter the vectors from 0xf6 to 0xfd?
oops .. I meant 0xfff6 to 0xfffd Ian -- Ian Stirling, G4ICV, AB2GR
Donna and Ian <ian@opus131NOZPAM.com> wrote in message news:<h-edneS-3a7wl_rcRVn-tA@comcast.com>...
> Donna and Ian wrote: > > > Does your application alter the vectors from 0xf6 to 0xfd? > > oops .. I meant 0xfff6 to 0xfffd > > Ian
Hi Ian Thank you for the post. The problem I am experiencing occurs before one sends the security bytes to the KX8. When using the MON08 interface in conjunction with P&E software prog08sz, the software executes a series of steps to ascertain whether the KX8 can be accessed. Step 1 is to check for hardware loopback on the serial channel. Step 2 is to check whether the KX8 echo's all bytes sent to it - in this case it would be the 8 security bytes. When one uses e.g. Windows Hyperterminal connected to the KX8 via MON08 circuit, one would normally see double characters echoed for each character sent to the MON08. The first echo will be hardware loopback, and the second will be the KX8 echoing (the KX8 being in monitor mode). In my case the second step fails, i.e. I see only 1 character being echoed due to hardware loopback. Seems like the KX8 has turned deaf - something aint right... Regards Jack
Jack wrote:

> In my case the second step fails, i.e. I see only 1 character being > echoed due to hardware loopback. Seems like the KX8 has turned deaf - > something aint right...
Hi Jack, I read your original post again and in it you said that you erased the KX8 after putting the AN2295 software in it. Erasing is a monitor function and is possible without the correct security code being sent. When the security block is written, reset isn't sufficient to recognise the new security data sent by the host - the hc908 has to be power cycled. Ian -- Ian Stirling, G4ICV, AB2GR
Thanks for your last response Ian.

Your first statement is correct.  However, I suspect that I will not
be able to communicate with the KX8 since I do not see any bytes
echoed by the KX8 itself when in monitor mode.  In other words, it
does not seem as if the monitor mode code (which is in ROM) is able to
echo characters, let alone accept a Flash erase command.

As far as your second statement is concerned, I have tried
communicating with the KX8 multiple times, after having power cycled
it several times.  The SAME circuit operates flawlessly with another
virgin KX8 device.

After I programmed the KX8, the controlling/programming software
IMMEDIATELY lost control of the device.  It seemed as if the flash
program started running right after programming it and took control
from the monitor mode even though the monitor mode setup pins were
still set up to force the device into monitor mode.

I had the following code in main():

void main(void) {

   EnableInterrupts;
   DDRA_DDRA = 0x1f;   // configure as output
   DDRB_DDRB = 0x00;   // configure as input

   for(;;) {

    __RESET_WATCHDOG();
    PTA_PTA0 = PTB_PTB0;    // light LED on PTA0 when button on PTB0
is pressed

   } 
}

Now keep in mind that, after having been programmed, the KX8 would
still be installed in the MON08 circuit wherein the serial line from
the MAX232 would be connected to PTA0.  I have configured PTA as an
output in my code.  Does a program start to run as soon as one has
programmed it, even though control pins is supposed to force it into
monitor mode?  If yes, could it be that the PTA0 line was destroyed
because, configured as an output by the flash code, the PTA0 line
would have driven into the output from the MAX232 line?

Apologies for these communications, but this is my first attempt at
68HC908 programming, and I am very hesitant to program another device,
fearing that I might again destroy it.

Regards
Jack
Jack wrote:

> Does a program start to run as soon as one has > programmed it, even though control pins is supposed to force it into > monitor mode? If yes, could it be that the PTA0 line was destroyed > because, configured as an output by the flash code, the PTA0 line > would have driven into the output from the MAX232 line?
Hi Jack, It is unlikely that PTA0 is destroyed - it is never connected to the MAX232 RS232 lines. On page 258 of the KX8 manual, there is a diagram of a monitor mode circuit. PTB0 should be tied high, PTA1 low, PTB1 low and IRQ1 at the Vtst voltage. These are all necessary conditions with Motorola's KX8 example circuits to enter monitor mode when the reset vector is not 0xffff. When the reset vector is 0xffff, the conditions of PTB0 and PTB1 do not matter (page 257), and you appear to have no problem programming a blank KX8. Having your test application use the monitor mode configuration pins might be a problem - e.g., is PTB0 high on attempting to go into monitor mode with a non blank reset vector? With monitor mode conditions applied, user code will not run. I find it easier to use my board as a monitor mode programming board and move the device to another circuit to test application code. Ian -- Ian Stirling, G4ICV, AB2GR
"Jack" <jchirac33@hotmail.com> wrote in message
news:22848a91.0410070607.58b7ef0a@posting.google.com...
> Question: Is it possible to somehow disable the KX8's monitor mode by > means of an application loaded into its flash memory? > > My setup as follows: I built a MON08 circuit as per circuit on page > 193 of 68HC908KX8.pdf. I used a 74HC04 inverter with 9.8304MHz > crystal, and constructed the circuit on Veroboard. All voltage levels > on the device measures OK, as well as the clock signal. I proceeded > to upload the bootloader as contained in AN2295 using prog08sz, but > never managed to get it working in conjunction with hc08sprg.exe (HC08 > never ACK'ed on power reset). I then erased the device and compiled a > small test program derived from AN2616 page 26, using Metrowerks > CodeWarrior.
Be advised that there are some more-specific Freescale HC08 NGs: http://groups.yahoo.com/group/68HC05_08/ http://groups.yahoo.com/group/hc08/ codewarrior.embedded also Metrowerks.com >> support >> community >> forums will lead you to a number of CodeWarrior forums There's also a brand-new NG that leans a bit toward Freescale: http://groups.yahoo.com/group/MicrocontrollerWorld/ They should be able to help you too. Gary
"Gary Schnabl" <gschnabl@LivernoisYards.com> wrote in message news:<Ls6dnUbNeMZ9FvHcRVn-rw@comcast.com>...
> "Jack" <jchirac33@hotmail.com> wrote in message > news:22848a91.0410070607.58b7ef0a@posting.google.com... > > Question: Is it possible to somehow disable the KX8's monitor mode by > > means of an application loaded into its flash memory? > > > > My setup as follows: I built a MON08 circuit as per circuit on page > > 193 of 68HC908KX8.pdf. I used a 74HC04 inverter with 9.8304MHz > > crystal, and constructed the circuit on Veroboard. All voltage levels > > on the device measures OK, as well as the clock signal. I proceeded > > to upload the bootloader as contained in AN2295 using prog08sz, but > > never managed to get it working in conjunction with hc08sprg.exe (HC08 > > never ACK'ed on power reset). I then erased the device and compiled a > > small test program derived from AN2616 page 26, using Metrowerks > > CodeWarrior. > > > Be advised that there are some more-specific Freescale HC08 NGs: > http://groups.yahoo.com/group/68HC05_08/ > http://groups.yahoo.com/group/hc08/ > codewarrior.embedded > also Metrowerks.com >> support >> community >> forums will lead you to a > number of CodeWarrior forums > > There's also a brand-new NG that leans a bit toward Freescale: > http://groups.yahoo.com/group/MicrocontrollerWorld/ > > > They should be able to help you too. > > Gary
Thank you Gary - I will follow up. Ian, I have triple-checked my MON08 circuit to see if the pins are set up correctly for normal monitor mode entry, and all seem fine. I will now test my IC in a target test circuit to see if it actually runs off the flash code. Also, I am in constant communication with a support guy at Freescale who is also in the process of helping me sort out this issue. I will advise as soon as I am able to resolve this. Regards Jack
"Jack" <jchirac33@hotmail.com> wrote in message
news:22848a91.0410130210.74b9ee4@posting.google.com...
> > Be advised that there are some more-specific Freescale HC08 NGs: > > http://groups.yahoo.com/group/68HC05_08/ > > http://groups.yahoo.com/group/hc08/ > > codewarrior.embedded > > also Metrowerks.com >> support >> community >> forums will lead you to a > > number of CodeWarrior forums > > > > There's also a brand-new NG that leans a bit toward Freescale: > > http://groups.yahoo.com/group/MicrocontrollerWorld/ > > > > > > They should be able to help you too. > > > > Gary > > Thank you Gary - I will follow up. > Ian, I have triple-checked my MON08 circuit to see if the pins are set > up correctly for normal monitor mode entry, and all seem fine. > I will now test my IC in a target test circuit to see if it actually > runs off the flash code. > Also, I am in constant communication with a support guy at Freescale > who is also in the process of helping me sort out this issue. > I will advise as soon as I am able to resolve this. > Regards > Jack
I cannot offer any direct advice on your problem. My involvement with the HC08/HC12 is redoing Valvano's HC11/HC12 Using C with Hiware, etc. tutorial by adding some CodeWarrior documentation to it plus some of my own rewriting. It's about 1/2 redone at this point. Gary

Memfault Beyond the Launch