Hi,
I am using the TMS570LS1227.
I am trying to use the het ide, but I am having trouble monitoring the pulses I an generating.
I am successfully generating three pulses:
pulse 1 - freq 853 kHz, DC 50%; pulse 2 - freq 640 kHz, DC 50%, pulse 3 - freq 512 kHz, DC 20%.
These pulses are being generated using pins 0,2,4. They are then routed back in on pins 6, 8, 10.
When I try to read the period and duty cycle in my code (right now only trying to read for pulse 1) through the PCNT register, I always read 0. Am I trying to get the data incorrectly?
Het IDE code
; PWM, 3 channels with different PWM frequencies, using MCMP P1S CNT { reg=A, irq=OFF, max= 2 } P1E MCMP { en_pin_action=ON, order=REG_GE_DATA, pin=0, action=PULSELO, reg=A, data=1, hr_data=64 }; P2S CNT { reg=A, irq=OFF, max= 3 } P2E MCMP { en_pin_action=ON, order=REG_GE_DATA, pin=2, action=PULSELO, reg=A, data=2, hr_data=4 }; P3S CNT { reg=A, irq=OFF, max= 4 } P3E MCMP { en_pin_action=ON, order=REG_GE_DATA, pin=4, action=PULSELO, reg=A, data=1, hr_data=0 }; L00 PCNT { type=RISE2FALL, pin=6}; L01 PCNT { type=RISE2RISE, pin=7}; L02 PCNT { type=RISE2FALL,pin=8}; L03 PCNT { type=RISE2RISE,pin=9}; L04 PCNT { type=RISE2FALL,pin=10}; L05 PCNT { type=RISE2RISE,pin=11}; L06 BR { next=P1S,cond_addr=P1S,event=NOCOND};
Init code in my program
memcpy( (void *)&e_HETPROGRAM0_UN, HET_INIT0_PST, sizeof (HET_INIT0_PST)); //Initialize high end timer hetREG1->PFR = 0x00000500; /* lr = 32; hr = 1 */ hetREG1->DIR = 0x00000015; // 0,2,4 output hetREG1->HRSH = 0x00000037; //Set HR share for bits 6,8,10 hetREG1->GCR = 0x00070001;
Trying to read the values
uint32 pwmDuty = (hetRAM1->Instruction[25U].Data) >> 7U; uint32 pwmPeriod = (hetRAM1->Instruction[26U].Data) >> 7U;