PART 1: DEMO9S12XDT512 Interrupt Questions

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

PART 1: DEMO9S12XDT512 Interrupt Questions

4,122 Views
RChapman
Contributor I
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
 
 
Posted: Sun Aug 21, 2005 5:21 pm    
 
 
I just bought the board ... and I am a newbie to Code Warrior and this MCU. I have used the old 68HC11 a lot in the past; however, as stated, I am new at this one.

I have some basic serial routines that I have been working on. I can transmit data via SCI0 to Hyperterminal etc.. but I haven't had much luck with it comes to using the SCI interrupts to trigger an ISR.

The MCU is an XGate model and I have a feeling that the XGATE is catching my ISRs vice the main core. Have any of you figured out on the proper way to setup your interrupt vectors for either the XGATE or to get the main core to respond vice XGATE?

Currently I am setting the address by hand ... by loading FFD6 with the address for my ISR, but nothing is being processed.

Help!
 
Posted: Mon Aug 22, 2005 1:23 pm    
 
Hi! I have the same board and the same problem.
I'm using the USB connector to debug with Code Warrior and P&E Debugger. I only found out that the instruction
"asm CLI" enables the XGate interrupts. I also don't know how to manage the interrupt service routines (Xgate or HCS12).
I'm waiting for more than 2 weeks for an answer to this question from the Metrowerks support. If they finally would help me, I'll answer you.
 
Posted: Mon Aug 22, 2005 1:51 pm    
 
Thanks for the reply ... I have found something I will try when I get home from work.

I downloaded AN2883SW.zip from Freescale. It is a simple SCI program that has an ISR in it. It has a file showing how they setup the vectors. The project is a Codewarrior project ... so I guess time will only tell.

So far I have been working with the DEMO LED program as a skeleton. I didn't have an empty project to work with, nor did I want to try and create everything that they have already done.

I tried something like the vector file that they have in there but the linker did not like it. I still think the XGate issue is screwing things up.

If you get something to work please post it and I shall do the same.
 
Posted: Mon Aug 22, 2005 3:19 pm    
 
Folks,
The XGATE and CPU have two independent vector tables and your interrupt will only go to one or the other. Out of reset everything is lined up to go to the CPU so unless you have changed something in the interrupt controller you won't be seeing interaction with XGATE. Also the XGATE works just like a peripheral so you have to enable it before it will do anything at all.
Just to be clear Alejandro the "asm CLI" enables all interrupts on the S12(X) and has no direct connection to XGATE.
hscadden the AN2883SW should resolve your problem since it includes a nice example of a vector table and ISR definition.

For a nice example of how to get XGATE going you should use the new project wizard to create a basic project with CPU and XGATE - select Multicore project with XGATE in RAM. This creates a simple project that sends a software interrupt to XGATE. Use this as a template for building other ISRs.
When XGATE is enabled the checklist for having it handle interrupts is:
1/ For the appropriate vector set the RQST bit in the channel of the interrupt controller - pgs 851-854 in the manual.
Use the CodeWarrior macro ROUTE_INTERRUPT (defined in the wizard example) to do this for the correct channel.
2/ Initialise the XGATE vector table for that channel.
Use the CodeWarrior table XGATE_VectorTable in the wizard project to do this. Note that the XGATE vector table has two entries for each vector, you can leave the second value set to the channel number until you have a use for it.
3/ Write the ISR.
You can use the SoftwareTrigger0_Handler ISR as a template and you can write freely in C


As far as the CPU is concerned interrupts work pretty much the same way on HC08/11/12 and S12X adds the extra priority capability. It can be a bit awkward to get a suitable template at first so starting from the wizard or app note examples is probably the right way to go.
Good luck!
 
Posted: Mon Aug 22, 2005 10:22 pm    
 
Ok! Finally got something to work. I think what was causing my problems with the Vector table was the P&E_ICD_Linker.prm files. It it almost at the very end was a line that was specifying VECTOR 0 _Startup.

Well the blasted linker kept on telling me that I was trying to overwrite a defined Vector etc.. I commented out that line and put the new Vector Table in my main code and everything worked like a champ ... of course with the modifications required to work for our board.

Thanks for the assist ... I shall E-Mail my Codewarrior file to the other gentleman, since we are using the same board, and he can go from there.
 
Posted: Tue Aug 23, 2005 7:44 am    
 
Good to see you got it going. The alternate ways of defining vectors are to use a table or put the vectors in the linker file. Sometimes one way is easier than the other.
 
Posted: Tue Aug 23, 2005 1:53 pm    
 
But where can I find the example with the ROUTE_INTERRUPT makro
I was searching all the installed Metrowerks files for this makro.
Wich manual do you mean. I have a lot of manuals and the RQST thing doesn't appear in the pages you mentioned...
Thank you for your help!
 
Posted: Tue Aug 23, 2005 3:42 pm    
 
The manual I was referring to is the S12XDP512 data sheet at http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S12XDP512_V2.pdf
The macro is provided when I create a new project using the new project wizard in CW 4.1. I don't know where CW keeps it in its files.
If you want a more general overview of the integration of the XGATE and the CPU you can have a look at the presentations at FTF where the S12X was covered in a couple of sessions. See here: http://www.freescale.com/ftf . Select the "Americas 2005 Breakout Sessions" link then select the "automotive" track and "all" sessions for the full list.
 
Posted: Wed Aug 24, 2005 1:55 pm    
 
Thank you very much!

The presentations seem to be very helpful!
I solved the problem by using the following instructions.
Code:
//INT_XGPRIO = 0x01;   //INT_CFADDR = Vportp & 0xF0; //Set PortP for XGate   //INT_CFDATA7 = 0x81;

 
But this is nearly the same as using the ROUTE_INTERRUPT macro. I found it finally!!
One last question: How can I delete an Interrupt Flag from the Xgate module:
Code:
interrupt void _testPortP(void) {   asm NOP;   //asm BRK;   PIFP_PIFP0 = 1;       //clear interrupt flag PortP 0 }

 
this example ISR deletes the interrupt flag (PortP0) if serviced by the HCS12 core.
But in the Xgate module the corresponding adress of the PIFP register (PortP interrupt flag) doesn't work Sad.
Is there a header file or documentation about how to delete interrupt flags serviced by the Xgate?
 
 

Message Edited by RChapman on 01-26-2006 04:20 PM

Labels (1)
0 Kudos
0 Replies