KBI cant bring JL3 out of stop mode.

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

KBI cant bring JL3 out of stop mode.

3,110 Views
killabyte
Contributor I
Hi, im working on a project, and i make use of KBI, and stop instruction. KBI should take MCU out of stop mode, but it does not. Im using pemicro simulator ics08jl ver 1.57.
 
I´ve checked all but it seems like after the stop inst, the KBI interrupt remains masked, when i use the IRQ int, the MCU gets out of stop.
 
Any suggestion any forgotten bit somewhere, is it a program bug or in the MCU, ive checked errata set in freescale´s homepage but no info found.
 
Please any suggestion, attached code.
 
Regards
 
Rodrigo F
Labels (1)
0 Kudos
Reply
7 Replies

882 Views
Ake
Contributor II
Hi,
I looked thru your code, and saw the following:
 
kb_out
     clr        ptd                 ;cuando recibe luego el eom del isd, pone el micro en stop
     pulh
     bset       ackk,kbier          ;y el isd tambien
     bclr       imaskk,kbscr
     rti
but there is no ackk bit in the kbier register. There are only kbie6 - kbie0 bits.
it should have been ¨
     bset       ackk,kbscr          ;y el isd tambien
 
Does it help?
 
Regards,
Ake
 
0 Kudos
Reply

882 Views
killabyte
Contributor I
nop dude, the interrupt module is working anyway if i dont use the stop instruction, it works. regards rodrigo
0 Kudos
Reply

882 Views
Ake
Contributor II
Hi,
I looked thru the code and there is more to correct.
At the end of the interrupt, you write:
 
     bset       ackk,kbier          ;y el isd tambien
 
There is no ackk bit in the kbier register. It should have been
     bset       KBSCR_ACKK,KBSCR          ; y el isd tambien
 
A bit higher up in the code, you use the
     sei
to enable the interrupts. This is very dangerous to enable interrupts within interrupts, and I would not recommend it.
 
Regards,
Ake
0 Kudos
Reply

882 Views
bigmac
Specialist III
Hello,
 
Ake's mention of the sei instruction is incorrect, as this instruction disables interrupts.  The instruction is quite unnecessary within the ISR, since further interrupts are automatically disabled, but it will do no harm.
 
I have difficulty in understanding the intent of your code, partly because I do not speak Spanish.  However, it does seem that there may be some unorthodox features, concerning program flow.
 
The kbdetect ISR does appear rather complex, and includes a delay loop.  Where possible, ISR code should be simple so that it may exit quickly.
 
The int_irq ISR contains a STOP instruction.  Interrupts are normally globally disabled within the ISR, however, the STOP instruction will automatically re-enable interrupts, which more than likely will be problematic after wake-up occurs.
 
I would usually expect main to be a loop in itself, so that its functions continually repeat.  However, with the following code present -
     stop
     bra        *
this would mean that the stop instruction could only execute once, before entering an infinite loop.  If COP timeout is not disabled, eventually a COP reset would occur.
 
My expectation might have been that the STOP instruction would be executed once during each cycle of the main loop, and that STOP should not occur within any ISR.
 
Regards,
Mac
 
0 Kudos
Reply

882 Views
JimDon
Senior Contributor III
For what it's worth KBI will only wake the processor from stop 3 mode.
You will have to read the docs for your part to make sure you are setting up for stop 3.

0 Kudos
Reply

882 Views
killabyte
Contributor I
As seen in documents, JL3 does not have different stop modes, there is just one stop mode. 68HC908JL3. What you say about loops:i im debouncing the keyboard, but this is secondary. This is a test sofwtare in order to get rid of some bugs i had. The software is not finished. The main issue is that anyway i cant bring it out of STOP, datasheet says that KBI should bring out of stop mode. the one and only one stop mode. is there any forgotten bit? does anyone have done this before? regards Rodrigo
0 Kudos
Reply

882 Views
JimDon
Senior Contributor III
Opps sorry that was indeed from the HCS  manual.
I guess thats why they what the part number in the post.
What ever happend to the post police :smileyhappy: ???
0 Kudos
Reply