Hi, Art has suggested that he has "tried (and given up) using "#pragma interrupt" ISRs directly". If you would like to take a look at a very simple project which shows how set-up interrupts directly without the use of SDK, please go to http://e-www.motorola.com/cgi-bin/faq.cgi and search for magic keyword "timer_flash_led". Daniel |
|
simple project demonstrating how to set-up interrupts without the use of SDK
Started by ●October 9, 2002
Reply by ●October 9, 20022002-10-09
I agree, this SHOULD work OK, and I tried exactly this method. The problem
is that CodeWarrior generated code that did not correctly save and restore the context, hence the program crashes. It was NOT because I couldn't figure out what you are supposed to do. Regards, Art Johnson Senior Systems Analyst PMC Prime Mover Controls Inc. 3600 Gilmore Way Burnaby, B.C., Canada V5G 4R8 Phone: 604 433-4644 FAX: 604 433-5570 Email: http://www.pmc-controls.com -----Original Message----- From: Daniel Malik [mailto:] Sent: Wednesday, October 09, 2002 5:58 AM To: Subject: [motoroladsp] simple project demonstrating how to set-up interrupts without the use of SDK Hi, Art has suggested that he has "tried (and given up) using "#pragma interrupt" ISRs directly". If you would like to take a look at a very simple project which shows how set-up interrupts directly without the use of SDK, please go to http://e-www.motorola.com/cgi-bin/faq.cgi and search for magic keyword "timer_flash_led". Daniel _____________________________________ Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer. You need to do a "reply all" if you want your answer to be distributed to the entire group. _____________________________________ About this discussion group: To Join: To Post: To Leave: Archives: http://www.yahoogroups.com/group/motoroladsp More Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/ |
Reply by ●October 9, 20022002-10-09
My opinion is, that the best and safest thing to do regarding the MSCAN interrupts is to use the SDK Interrupt Dispatcher and "Normal" interrupts. We do that here and it works flawlessly. The Interrupt Dispatcher does use a bit of extra time to do the full context save and restore, but you are then freed from having to use "#pragma interrupt" in all the functions called from your ISR. As Bill Hutchings pointed out this morning, this may actually save time (and code space) overall, because your functions are not all having to do partial context saves/restores. We are using the CAN bus at the 250 kbps rate, and have no problems regarding the amount of CPU time used by the MSCAN interrupts. So, to summarize my recommendations: 1) use the SDK Interrupt Dispatcher and "Normal" interrupts 2) remove the "#pragma interrupt" from all MSCAN functions, INCLUDING the ISRs The attached file "J1939_task.c" has the ISRs and the one function that is called from the Rx ISR. You can see that we don't use "#pragma interrupt" in any of them. The Error ISR also contains the work around for the Rx Warning/Error and Tx Warning/Error interrupt problems that I mentioned in earlier messages. The function "Activate_Sstask()" is a DSPOS RTOS function call; what we have is a "J1939 task" that the interrupts send signals to, and which performs the actions determined by which signal(s) it sees. I hope this helps. Regards, Art Johnson Senior Systems Analyst PMC Prime Mover Controls Inc. 3600 Gilmore Way Burnaby, B.C., Canada V5G 4R8 Phone: 604 433-4644 FAX: 604 433-5570 Email: http://www.pmc-controls.com -----Original Message----- From: Jarrid Gross [mailto:] Sent: Wednesday, October 09, 2002 10:09 AM To: Subject: RE: [motoroladsp] simple project demonstrating how to set-up interrupts without the use of SDK I agree with Art here. Daniel sent me (last year) a proto-type project using the simple intrinsic methods for dealing with an interrupt. This is what I used for some time, without any significant problem. I had setup direct (NON SDK) vectors and handlers for 4 timers, async TX and RX and ERROR, all worked flawlessly for some time. When I added in an interrupt for MSCAN, and a few more timers, all hell broke loose. Code that was working fine for months, suddenly broke, with nearly impossible to trace problems. The light got shed on my problems, when a particular variable, which was set only at startup sudenly "changed" its value, and caused all forms of grief. Setting a watchpoint to a write on this variable (should never be written to after startup) proved that a particular section of code would somehow get its local variables (a pointer) trashed, and then write to memory that was not originally passed to the routine. Here is what I did last night to "fix" this situation. I added in #pragma interrupt saveall warn to the top of my can RX ISR (this was verified to the be the corruptor in this case). I then compiled the code, and found that there were 2 unresolved externals. These turned out to be 2 asm files in the MSL source directory, which I added into my project. I recompiled, and it linked succefully. Ran the code and flooded the CPU with can frames. The code seems to be correct, over 10 million frames and no corruption of that type. I wouldnt say I am out of the woods, but the _saveall_ modifier seems to have done what it was supposed to even if the documentation doesnt describe its behavior. Now I need to know if I should "strip" the #pragma interrupt used code from all the routines called from the CAN interrupts. It would seem to me that a full context save at the beginning of the ISR, then a full restore at the end of the same ISR, the code called between, neednt even know that it is a part of an interrupt handler should it? I am a low-level kind of guy. I _always_ write my own drivers, I can read a datasheet and write my code accordingly. I dont need a do all for everybody API that hides the details and "bugs" of the lower level peripheral code. What I do need is a compiler that gives me the control to write my code, and the documentation that supports it. Metrowerks, We need to upgrade your documentation relating to the #pragma interrupt feature. The examples are not really clear, and the explanation is definately incomplete, as can be detected by the level of postings on this thread and similar topics. A blurb on adding in the library or the asm source files if you use the saveall would also save people a lot of time. Thanks to all that responded to this thread, especially Art for his excellent and prompt advice. Also thanks to Daniel Malik, who was quite helpfull in getting me started, and kept me blissfully removed from the SDK api. Sorry for standing of the soapbox too long. Rootesracer >I agree, this SHOULD work OK, and I tried exactly this method. The problem is >that CodeWarrior generated code that did not correctly save and restore the >context, hence the program crashes. >It was NOT because I couldn't figure out what you are supposed to do. >Regards, >Art Johnson >Senior Systems Analyst >PMC Prime Mover Controls Inc. >3600 Gilmore Way >Burnaby, B.C., Canada >V5G 4R8 >Phone: 604 433-4644 >FAX: 604 433-5570 >Email: art@p... >http://www.pmc-controls.com -----Original Message----- From: Daniel Malik [mailto:daniel.malik@m...] Sent: Wednesday, October 09, 2002 5:58 AM To: Subject: [motoroladsp] simple project demonstrating how to set-up interrupts without the use of SDK Hi, Art has suggested that he has "tried (and given up) using "#pragma interrupt" ISRs directly". If you would like to take a look at a very simple project which shows how set-up interrupts directly without the use of SDK, please go to http://e-www.motorola.com/cgi-bin/faq.cgi and search for magic keyword "timer_flash_led". Daniel _____________________________________ Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer. You need to do a "reply all" if you want your answer to be distributed to the entire group. _____________________________________ About this discussion group: To Join: To Post: To Leave: Archives: http://www.yahoogroups.com/group/motoroladsp More Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/ | |||
|