Home/Support/Support Forum/run an isr on the PWM in Rabbit Core 3000 (LP3500)
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

run an isr on the PWM in Rabbit Core 3000 (LP3500)

0 votes
I need to run an isr on the PWM output in an LP3500. I can't find any example code.
the "rntVal" is coming back as 0 (invalid vector?)
I am using the following lines to set up the isr:
void isr_PWM(); //ISR function for PWM void main () { brdInit(); rtnVal = SetVectIntern(0x170, isr_PWM); //assigning interrupt vector to ISR function . . . } nodebug root interrupt void isr_PWM() { //ISR function for PWM flagPWMrun = 1; //use to start an action related to the PWM running cntPWMcycles++; //increment the PWMcycle counter }
asked Mar 16, 2021 in Rabbit Software by raleighs New to the Community (2 points)

Please log in or register to answer this question.

1 Answer

0 votes
Per the documentation for SetVectIntern(), you should be using 0x17 as the first parameter. Give that a try and see if it starts working.

(If you place your edit cursor in or after the word "SetVectIntern" in your code and press CTRL-H, it will pull up function help.)
answered Mar 17, 2021 by TomCollins Veteran of the Digi Community (2,297 points)
Excellent. That did work to get the vector setup. It is confusing when the "offset" is also given and it is almost the same "0x0170". But the isr still doesn't trigger. I guess I need to set bits 1 and 2 of register PWL0R to some non-zero value to give the isr a priority (if those bits are 0 the isr is disabled). What is the best way to do that. It seems that the WrPortI(PWL0R, NULL, 0x02) command should work, but I can't read back that register and it seems like sometimes the code gets stuck on that command.
How to "activate" the isr for PWMs?
I am using separate instruction and code space.  The documentation says I need this command option:
    interrupt_vector pwm_intvec isr_PWM;
    SetVectIntern(0x17, isr_PWM); // set up ISR

Problem is I get the following error when I compile:
line  465 : ERROR ServoAxis-TampShuttle-1-2-test6.C   : Vector pwm_intvec undefined

Any idea what I can do about it?
Can I define it myself, or do I have to modify libraries?
When ever I set bit 1 in PWL0R to "1" the code will stop working.  Is it a problem to set the isr priority to 1?
So `pwm_intvec` should never get used.  The Rabbit 3000 rev 0 doesn't support a PWM interrupt, and the Rabbit 3000 rev 1 doesn't use fixed interrupt vectors.  Are you compiling your program for the proper target of an LP3500, and verified that your LP3500 has a Rabbit 3000 rev 1 chip and therefore supports interrupt vectors?

If you add this line to your program, what does it output?
printf("_CPU_ID_=0x%x\n", _CPU_ID_);

It should print 0x101 for a Rabbit 3000 rev 1.  If it prints 0x100 you have a Rabbit 3000 rev 0 and that doesn't support PWM interrupts.

Also, please confirm that you're using Dynamic C 9.62 or 9.62A.