Part Number: LAUNCHXL-F2800157
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE
To preface, I'm extremely new to the C2000 and FreeRTOS, and somewhat new to MCU's in general. I've been trying to set up the following interrupts on the C2000 using the sysConfig editor:
1. The RTOS tick at 1 kHZ, using CPUTIMER2
2. An interrupt at 10 kHz, using CPUTIMER1
3. An interrupt at 1 kHz, using CPUTIMER0
I'm using the examples from here (https://github.com/TexasInstruments/c2000ware-FreeRTOS) and the SDK from https://github.com/TexasInstruments/c2000ware-core-sdk/. The RTOS tick required minimal effort because there are examples that I just copied to get that working. I got the 10 kHz interrupt working, using more or less the following code:
// syscfg fileconst cputimer = scripting.addModule("/driverlib/cputimer.js", {}, false);const cputimer1 = cputimer.addInstance();cputimer1.$name = "timer1";cputimer1.cputimerBase = "CPUTIMER1_BASE";cputimer1.enableInterrupt = true;cputimer1.registerInterrupts = true;cputimer1.startTimer = true;cputimer1.timerPeriod = 12000;cputimer1.timerInt.interruptHandler = "timer1_ISR";cputimer1.timerInt.enableInterrupt = true;
// main .c file__interrupt void timer1_ISR( void ){
// do stuff
}
However, I have not been able to set up any interrupt to trigger off of CPUTIMER0, even though I'm using the working 10 kHz loop as an example, and just modifying the relevant fields. In fact, I found that if I change the cputimerBase for the 10 kHz loop to CPUTIMER0_BASE, the 10 kHz loop stops working (!). I thought perhaps I could use CPUTIMER1_BASE for both the 1 kHz and 10 kHz loops, but the sysconfig editor gave a warning "The CPUTIMER Instance used. Duplicates: CPUTIMER1_BASE". In the end I found a way to set up both of my loop using the ePWM instead, but I feel I don't really understand why my other approaches didn't work.
Any clarifying explanations would be appreciated, but here are some specific questions:
1. Why couldn't I set up interrupts using CPUTIMER0? Is this expected?
2. Why can't I use CPUTIMER1_BASE for multiple interrupts?
3. Was it the wrong approach to use the CPUTIMERs for these loops to begin with? If CPUTIMERs are not meant for this, then what are they meant for?

