PDA

View Full Version : SWI not working --- please help


Ganjoo
07-22-02, 08:44 AM
I am using NMIN-0912 (68HC912b32) board and having problems with SWI instruction (software interrupt). I have mapped all of the interrupts to RAM addresses so that I do not have to erase FLASH every time. I have kept 3 bytes for each of the vector addresses and intent to write a JMP instruction there.

Now on address $F7F6 (SWI Secondary Vector) I have written $0BFA and on address $0BFA I have written a simple RTI.

Now when I call SWI in the software the system kind of freezes and it does not come back from the SWI call.

Today it is not even allowing me to download the code to the board :(( it keeps on saying Not Programmed.

Can any one please help me out here. Is there any restriction on SWI Interrupt Routine being kept in RAM area? Can any one please point out what I am doing wrong here?

I have placed the code on http://www.appsys.com.pk/nmin/swi.htm

Regards

Fahad Zubair

nmitech
07-22-02, 10:23 AM
Your SWI interrupt is now no longer find the RTI in the ram after the system was powered down so you must reload the FORTH.

Below are the instructions how to reload FORTH,

If you do not have a copy of a terminal program called MAXTERM, you can download it here,
http://www.newmicros.com/download/maxterm.zip

Invoke Maxterm

Press ALT+P to set the pacing character to decimal zero (0) and hit enter to save.

Connect PDLC0 to ground
Press restet button to get the Bootloader prompt,

enter E to erase

enter P and Press ALT+D and enter the complete path where your FORTH.S19 file is stored

remove the Jumper connect from PDLC0 to ground

Press reset and the FORTH prompt will take over.

Now you must press ALT+P to change the pacing character back to decimal 10. Because FORTH looks for a LF/CR to recognise as a new line.

Rob will give you some advises on your program later.

Ganjoo
07-22-02, 12:26 PM
Sorry, I forgot to mention in my earlier post that I am not using FORTH on the controller.

PLus any ideas why it keeps on saying 'Not Programmed' when I try to download swi.s19 to the board?

swi.asm (http://www.appsys.com.pk/nmin/swi.asm)
swi.lst (http://www.appsys.com.pk/nmin/swi.lst)
swi.s19 (http://www.appsys.com.pk/nmin/swi.s19)
912b32.inc(http://www.appsys.com.pk/nmin/912b32.inc)

Thanks in advance

Fahad

daniel
07-22-02, 02:28 PM
I think your problem is still in the way you setup your vectors, try reading through this webpage and let us know.

http://www.seattlerobotics.org/encoder/jun99/68hc912b32.html

Ganjoo
07-23-02, 02:13 AM
Yes, I just found my mistake after going through the serial boot loader program description given in motorola document

http://e-www.motorola.com/brdata/PDFDB/docs/AN1718.pdf

It places its stack at the end of RAM and I have placed my interrupt routines there :o)

So while downloading the bootloader must be using stack locations for its own code and my code that has been downloaded on that location must be overwritting the stack locations.

I will now change my vector addresses to those followed by D-bug12.

thanks for all the help, will post to inform whether it is working now or not.

Fahad