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.

Pin doesn't Toggling N2HET using ECMP Instruction Issue

Other Parts Discussed in Thread: HALCOGEN

Here is my HET code snippet. My Target platform : champion series

FCT: CNT {data=0,  reg = R, max= 0x1FFFFFF };

TRG1: ECMP { en_pin_action=ON, reg= R, pin=10, action=SET, data= 20 };

TRG1_R: ECMP { en_pin_action=ON, reg= R, pin=10, action=CLEAR, data= 23 };

Currently I am running with issue, where TRG1 executes and set the pin high when R reaches to 20, but when reg = R reaches to 23, it doesn't reset the same pin. I am using HR_data field as well, which is continuously updating, but TRG1 & TRG_R will never trigger in same LR loop cycle (verified in HET IDE)

I did try to setting up hr_lr = high, even though  didn't work.  

Any suggestion why this is not working, both instruction set /clear the same pin different LR loop. 

  • Keyur,

    Champion devices (TMS570LS12xx) are based on N2HET.

    In HET IDE you have to select the correct device type for your simulation. There is no TMS570LS12xx but you can select TMS570LS31xx.

    With N2HET the following registers can be used with a CNT: A, B and T only. R cannot be used and if N2HET is selected in the HET GUI, you should have an error message on the CNT instruction when R is used.
    So first change R by either A, B or T.
    Modify your ECMP to match the register in use.

    Another important point, it is not possible to have in the same loop resolution to action on the same pin if HR is enable.
    In your code, there is no argument to specify not to use HR mode, it is the default. So for your code to work, it is necessary for each ECMP to add hr_lr=low.

    With this modification your code should look like:

    A0   CNT    {reg= A,max=0x10,data=0};
    A1   ECMP { hr_lr=LOW,en_pin_action=ON,pin=0,action=SET  ,reg=A,data=0x6,hr_data=0}; drives pulse High @ regA = data
    A2   ECMP { hr_lr=LOW,en_pin_action=ON,pin=0,action=CLEAR,reg=A,data=0x8,hr_data=0}; drives pulse LOW @ regA = data

    Please have a try and let me know.

  • Thanks for your support.

    I did change the counter to T instead of R and In my code, I will be using all 32 bit including HR_data, so I set the hr_lr = HIGH, but doesn't working.

    I have been using TMS570LS31xx for my implementation testing.  

    second question would be if LR data are same, but HR data field are different. In this case, ECMP1 & ECMP2 which one gets implemented first.

  • Keyur,

    As I said in my previous post, it is not possible to have two instructions acting on the same pin in 1 loop resolution when HR_LR=HIGH.

    To realize your function, here is an example.

    1] You will have to use 2 HET pins (0 and 1, or 2 and 3 or 4 and 5....) and use the HR sharing option.
         2 options are available when share is used. AND function between the 2 selected pins or XOR function between the 2 selected pins.
         In my example I will use pin0 and pin1 and will use an AND sharing. Pin0 will start LOW  and will PULSEHI on the first match. Pin1 will start HIGH and will PULSELO on the second compare. The HET code will look like:

    L00 CNT  { reg=A, irq=OFF, max= 10}
    L01 ECMP { en_pin_action=ON, pin=0, action=PULSEHI, reg=A, data= 5, hr_data=0}
    L02 ECMP { en_pin_action=ON, pin=1, action=PULSELO, reg=A, data= 6, hr_data=0}
    L03 BR   { next= L00, cond_addr=L00, event= NOCOND }

    The instruction L03 is optional.

    When sharing option is used on a pair of HET signal, the shared result is visible on the even pin number. In this case PIN0. PIN1 will not show any activity.
    With this example, the PIN0 will be active high for 1 Loop Resolution.

    I've attached the HET IDE, HalCogen and CCS project to this post.5658.HET_AND_SHARE.zip




         

  • Jean,

    Thanks for your reply. 

    I did check the option using XOR, but in this case, I have to sacrifice adjustment pin, which is biggest constraint that I have, so Is there any other option available except XOR.

  • Keyur,

    There is another implementation possible.

    This method will use one of the capability of HET to modify synchronously his own code by using the MOVE instruction.

    As I've explain in a previous post, it is not possible to act on the same pin with more than 1 instruction per loop resolution.
    So the idea is to use only one ECMP instruction.
    ECMP have a conditional branch address. This conditional branch is taken only when there is a match between the data field (with or without HR) and the register in use.
    When the conditional branch is taken, you will branch to a MOV instruction. This MOV instruction will modify the ECMP instruction to change the DATA field, HR (if necessary) and the conditional address. Here is how the code look like:

    L00 CNT    { reg=A, irq=OFF, max = 10 }
    L01 ECMP   { next=L00, cond_addr=L02, en_pin_action=ON, pin=0, action=SET, reg=A, data= 5, hr_data=4}
    L02 MOV64  { remote=L01, cond_addr=L04,comp_mode= ECMP,  pin=0, en_pin_action=ON, action= CLEAR reg=A, data=6, hr_data=8}
    L03 BR     { next= L00, cond_addr=L00, event= NOCOND }
    L04 MOV64  { remote=L01, cond_addr=L02,comp_mode= ECMP,  pin=0, en_pin_action=ON, action= SET   reg=A, data=5, hr_data=4}
    L05 BR     { next= L00, cond_addr=L00, event= NOCOND }

    L00 is your counter, nothing new.
    L01 is the ECMP. Here we have a "cond_addr=L02. Whenever there is a matching comparison the execution will jump to L02 instead of L00.
    L02 is the MOV64. remote=L01 is the destination of the move. (in this case the ECMP instruction at L01.
                                      cond_addr=L04 will change the conditional address of the ECMP to L04.
                                      comp_mode=ECMP to keep the same instruction at L01
                                      pin=0, we still want to act on pin 0.
                                      en_pin=ON to keep the pin action on the ECMP at L01.
                                      action=CLEAR. For the next compare we want to clear the pin.
                                      reg=A to keep register A to be used by ECMP.
                                      data=6, this is the new compare value for the ECMP.
                                      hr_data=8, just to show that MOV64 can also change the hr_data field.
    L03 is a BR to L00
    L04 is the MOV64. remote=L01 is the destination of the move. (in this case the ECMP instruction at L01.
                                      cond_addr=L02 will change the conditional address of the ECMP to L02.
                                      comp_mode=ECMP to keep the same instruction at L01
                                      en_pin=ON to keep the pin action on the ECMP at L01.
                                      pin=0, we still want to act on pin 0.
                                      action=SET. For the next compare we want to clear the pin.
                                      reg=A to keep register A to be used by ECMP.
                                      data=5, this is the new compare value for the ECMP.
                                      hr_data=4, just to show that MOV64 can also change the hr_data field.
    L05 BR to L00

                                    

    Please try this solution and let me know if this will work for you.

  • Keyur,

    Have you try my other option to solve your problem?
    Is it an acceptable solution?

  • Jean, 

    This is exactly what I try and it did work. 

    Thanks for your support.