Now that all the capture ISRs are going, I need to make them all read the same thing.
The first thing that I will do is try to only use cap3 isr to see if it has anything to do with them interfering.
// 3 enabled, rising and falling, all on timer 1: 0001 0110 1111 1100 = 0x16FC
EvaRegs.CAPCONA.all = 0x16FC;CAP3 works now, so there is something happening to do with interference.
I will try just CAP2 by setting CAP1EDGE to "no detection" (0).
// 1,2,3 enabled, 2 - rising and falling, 1 and 3 - no detection, all on timer 1: 0011 0110 0011 0000 = 0x3630
EvaRegs.CAPCONA.all = 0x3630;CAP2 works!
Now try just CAP1 and CAP2:
// 1,2,3 enabled, 1,2 - rising and falling, 3 - no detection, all on timer 1: 0011 0110 1111 0000 = 0x36F0
EvaRegs.CAPCONA.all = 0x36F0;Both work!
Try CAP1 and CAP2 on timer1 and CAP3 on timer2
// 1,2,3 enabled, 1,2, 3 - rising and falling, 1,2 timer1, 3 - timer2: 0011 0010 1111 1100 = 0x32FC
EvaRegs.CAPCONA.all = 0x32FC;
CAP1 and CAP2 work but CAP3 does not
Try just CAP3 with timer2 by itself
// EVG 5-19
// 3 enabled, 1,2, 3 - rising and falling, 1,2 timer1, 3 - timer2: 0001 0010 1111 1100 = 0x12FC
EvaRegs.CAPCONA.all = 0x12FC;
does not work but that is probably because I have not set up timer2
guess:
// EVG 5-5
EvaRegs.GPTCONA.all|= 0x0049; // GP Timer 1/2 Counting upward
EvaRegs.T1CON.all = 53312 + (1-1)*256; // Set up capture timer - Continuous-Up Count Mode
EvaRegs.T1PR = 0xFFFF; // Set up timer period
EvaRegs.T2CON.all = 53312 + (1-1)*256; // Set up capture timer - Continuous-Up Count Mode
EvaRegs.T2PR = 0xFFFF; // Set up timer period excellent CAP3 works now - try to enable 1 and 2 again on timer1.
// 1,2,3 enabled, 1,2, 3 - rising and falling, 1,2 timer1, 3 - timer2: 0011 0010 1111 1100 = 0x32FC
EvaRegs.CAPCONA.all = 0x32FC;does not work - everything goes crap again.
Maybe everything is not running fast enough - try checking the PLL setup
the InitPll function that inititalised the PLL is in DSP281x_SysCtrl.c
at the moment it is being sent 1010 as DIV which muliplies the clock time by 5.
InitPll is called in InitSysCtrl(void) which is also in DSP281x_SysCtrl.c
InitSysCtrl is called in initBoard which is called the main program before the main inititalise funtion. That means that I may be able to overwrite that value for VAL in my system initialise function.
I managed to do the overwrite, however now isrXint2 does not work.
// re Initialize the PLLCR to 0x0 from 0xA
InitPll(0x0);Upon consideration, that is because the clock was previously running at its maximum speed.
The other thing that I can do is to get rid of the divides in the isr to speed them up.
I have got rid of the divides but for some reason, now IPWM3 is not working
IPWM3 was still on timer2
ALL IS WORKING NOW!