MOD5213 DMA timer problem
Posted: Tue Jul 12, 2011 7:24 pm
I am having problems with my DMA timer on my Netburner Mod5213. The timer glitches once a while when I used it to output PWM signal.
The DMA3 is set to generate a 50Hz PWM signal. However, I got servo glitches after about 5 min after bootup. I used Larry's StopWatch (DMA0) to measure the time between interrupts (Thanks Larry). I found out that the DMA timer is somehow messed up. For example, it goes to 1.2ms although it should be a solid 1.1 ms pulse width. The strange thing is that it comes back to solid 1.1 ms after about 1 second.
Can somebody help me check if I am setting my DMA correctly? or maybe it is something else?
-------------------------------------------
My dma3 is set up as following
void Initdma3() {
sim.timer[3].dtmr = 0;
sim.timer[3].dtrr = VAR_20ms;
sim.timer[3].dtmr = 0x03D;
SetIntc((long) &dt3Input, 22, 6, 1);
}
INTERRUPT( dma3int, 0x2600)
{
sim.timer[3].dter = 0x03;
if (Flag) {
Flag = 0;
Pins[PWM] = 1;
sim.timer[3].dtrr = VAR_1_3ms;
}else{
Flag = 1;
Pins[PWM_CH0] = 0;
sim.timer[3].dtrr = VAR_20ms - VAR_1_3ms;
}
sim.timer[3].dtmr = 0x03D;
}
Thanks
Haiyang
The DMA3 is set to generate a 50Hz PWM signal. However, I got servo glitches after about 5 min after bootup. I used Larry's StopWatch (DMA0) to measure the time between interrupts (Thanks Larry). I found out that the DMA timer is somehow messed up. For example, it goes to 1.2ms although it should be a solid 1.1 ms pulse width. The strange thing is that it comes back to solid 1.1 ms after about 1 second.
Can somebody help me check if I am setting my DMA correctly? or maybe it is something else?
-------------------------------------------
My dma3 is set up as following
void Initdma3() {
sim.timer[3].dtmr = 0;
sim.timer[3].dtrr = VAR_20ms;
sim.timer[3].dtmr = 0x03D;
SetIntc((long) &dt3Input, 22, 6, 1);
}
INTERRUPT( dma3int, 0x2600)
{
sim.timer[3].dter = 0x03;
if (Flag) {
Flag = 0;
Pins[PWM] = 1;
sim.timer[3].dtrr = VAR_1_3ms;
}else{
Flag = 1;
Pins[PWM_CH0] = 0;
sim.timer[3].dtrr = VAR_20ms - VAR_1_3ms;
}
sim.timer[3].dtmr = 0x03D;
}
Thanks
Haiyang