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.

Changing dynamically the value of the length of a pulse with N2HET - error: EID005 : Program Overflow

Hi,

I am trying to change dynamically the value of the length of a pulse.

In the following program I just want to modify the data field of L02 instruction:

EnablePer           .Equ       20           ; Period of Enable

EnableLgnt         .Equ       01           ; Length of Enable signal

L01    CNT   {reg=A, irq=OFF, max = EnablePer};

L02    ECMP  {next= L01, cond_addr= L01, hr_lr=LOW, en_pin_action=ON, pin=1, action=PULSELO, reg=A, irq=OFF, data=EnableLgnt, hr_data = 0x0 };

 

I just want to increase the data field value by one each loop cycle and clear the data field when it is equal to EnablePer. To do that I first imagine using the ADM32 instruction and I need to use an internal register. So, for me the first thing to do is to initialize the B register to one. I try it with the instruction L00 and I tested the following program:

 

EnablePer           .Equ       20           ; Periode of Enable

EnableLgnt         .Equ       01           ; Length of Enable  signal

 

L00    ADD   {next= L01, src1=IMM, src2=B, DEST=B, data=1, brk=ON }

L01    CNT   {reg=A, irq=OFF, max = EnablePer};

L02    ECMP  {next= L01, cond_addr= L01, hr_lr=LOW, en_pin_action=ON, pin=1, action=PULSELO, reg=A, irq=OFF, data=EnableLgnt, hr_data = 0x0 };

 

But I got the following error: EID005 : Program Overflow has occurred, Please clear the overflow flag.

The register A seems to be instantiated forever.

I need some explanation.

Thanks a lot by advance for your Help.

Jerome

  • Jerome,

    First, I need to understand what you want to achieve. Assume that the period of the pulse is 20 (looptime). Do you want generate pulse with width of 1, 2, 3, ... , 19, 1,2, 3,......,19, 1,...

    Thanks and regards,

    Zhaohong
  • Hi Jerome,

     

    What is the Loop Resolution value you have configured? This error usually pops up when the LR Period is too small to perform all the instructions completely in one loop. What I understand from your post is that the first program(2 instructions) is working correctly, but not the second program(3 instructions).

    Try increasing the Loop Resolution to the next higher value.

     

    Thanks and Regards,

    Vineeth

  • Hello Zhaohong,
    Yes It's exactly what you wrote.
    I want generate pulse with width of 1, 2, 3, ... , 19, 1,2, 3,......,19, 1,...
    The length of the pulse increases of one to each loop cycle.
    Furthermore I need the cpu able to read at any time the value of the length of the pulse.
    Thank a lot for your help
    Regards
  • Hi Vineeth,
    Thanks for your Help.
    I tried to set the Loop Resolution to the maximum value : 128X32 but the problem is still there. It’s just occurs later.
    Regards
    Jerome
  • Hi Jerome,

     

    I just noticed a problem with your program. No instruction branches to L00 instruction. The sequence should branch to the first instruction before the end of a loop(causes overflow otherwise). I think the “next” and “cond_addr” field of L02 instruction should be L00 and not L01. I’m not sure if your program will work as expected, but this should take care of the overflow problem. Please check if this works.

     

    Thanks and Regards,

    Vineeth

     

  • Jerome,

    I am afraid that there are some misunderstanding about the terms used for NHET operation. "Looptime" is acutally how often the NHET code repeats. The user has to make sure that the NHET code can complete within the looptime.

    In the your code, the period of the pulse is set to be 20 looptimes. You should only change the data field of the ECMP instruction when the register used in the CNT instruction returns to zero. I will look for a old test code and post it later.

    To be safe, you can add a BR instruction at the end of your code as proposed by Vineeth. If you initialize all NHET RAM content to zero, NHET will automatically complete the operation when it sees zeros.

    Thanks and regards,

    Zhaohong
  • Jerome,

    The information and examples in the following forum thread should help you.

    http://e2e.ti.com/support/microcontrollers/hercules/f/312/p/196085/699527#699527
    http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/159329
    http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/234096
    http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/117748

    Thanks and regards,

    Zhaohong
  • Hi Vineeth,
    Yes you are right, the program must loop to the first instruction.
    So I need to rethink the algorithm.
    Thank a lot for all.
    Kind Regards
  • Hi Zhaohong,
    Thanks a lot for all these links, It's more clear for me now.