This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

N2HET programming with PWCNT

Other Parts Discussed in Thread: TMS570LS3137

Hello

While programming for the HET-Module of TMS570LS3137, I discovered that the PWCNT-Instuction decrements Data Field at the LSB (Bit 0) . This means, the instruction is decrementing the HR portion of the 32 bits instead of the LR Portion only, as I expected. Can somebody tell me the reason for this and how I can change that. The manual tells me, that the hr_lr bit ignores the LR part when set .  (is this statement only related to pin-actions) What ever HIGH or LOW means in realtion to set and reset of he_lr, I tried both and neither worked as I expected. LOW = set = 1 and HIGH = rest = 0 in this context.  

do  I have to rewrite my whole code or is there a way out?

regards, matthias

  • Based on the document, the right behavior is:

    1. If hr_lr=0 and you set datafield to 2 x 128+3, you will get a pulse width 2 LRP+ 3HRP (assume LRP=128HRP)

    2. If hr_lr=1 and you set datafield to 2 x 128 +3, you will get a pulse width 2 LRP(assume LRP=128HRP).

    DO YOU MEAN THAT, IN REALITY, WITH BOTH CASE, YOU GET a pulse with width:

    (2 x 128 + 3) LRP ?

    Regards,

    Haixiao

  • hello Haixiao

    Thanks for answering. I further analyzed the situation in between and found out, that my problem happens only in first (or last, depending on point of view) loop (LRP).

    Assumed my LRP = 128 HRP: Period is 256HR, I expected my signals to occur in Loop0 with a delay between 0 and  127 but they show up at 128 instead. So I'm not able to produce a duty cycle below 50% in this constellation. From 128 to 255, i get the expected high resolution. (This is not a real world example from my project.) perhaps I loose the high resolution  even in two LRP instead of one. Sometimes it look to me like missing more than 128 HR-clocks accuracy. I have no hardware to analyze that at the moment. but at most LRP-Cycles with multiple loops per period, i get the expected high resolution. I wanted to make some tests to see if it comes from the use of HTU transfers in this loop, but had no time to do that yet. (I have some days off now.) I tested with PWCNT first and rewrote it later to MCMP statements -> same thing. think it must be a silly mistake I made but I can't find it.

    best regards, matthias

     

  • You probably hit one of the limitations of NHET: One pin can only generate one action in one LRP IF XOR FEATHER IS NOT USED.

    You can take a look at my previous post in the HTU example: To generate a pulse less than 1 LRP, I forced the center of this pulse at the transition edge between two LRPs. By doing this, I can generate the rising edge in one LRP and the falling edge in the next LRP, then I can generate a pulse as narrow as 2HRP (1HRP is also possible in this case).

    Regards,

    Haixiao

  • Hi,

    I use XOR to generate the pulse. Assumed the pulse is LR0 it is not seen. in LR1 the pulse has right duration. if pulse starts in LR0 and ends in LR1 it has duration LR1+HR1 -LR0 instead of LR1+HR - LR0+HR0.

    regards Matthias

  • Hi

    Found bug in my own code

    One label was wrong. (Next step pointed to itself. This caused the unexpected behaviour.)

    This example is not my original code but it shows same sideeffect:

    L00 CNT {reg=B, max=22, data=0}
    L01   ECMP { next=L01,hr_lr=HIGH,en_pin_action=ON,pin=12,action=PULSELO,reg=B,data=0,hr_data=0};
    L02   ECMP { next=L00, hr_lr=HIGH,en_pin_action=ON,pin=13,action=PULSELO,reg=B,data=1,hr_data=50};

    L00 CNT {reg=B, max=22, data=0}
    L01   ECMP { next=L02,hr_lr=HIGH,en_pin_action=ON,pin=12,action=PULSELO,reg=B,data=0,hr_data=0};
    L02   ECMP { next=L00, hr_lr=HIGH,en_pin_action=ON,pin=13,action=PULSELO,reg=B,data=1,hr_data=50};

    Thanks for your input. There was no way for you to find the bug in my NOT published code -> sorry for that.

    BR, matthias