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.

Main RAM to N2HET RAM using HTU

Other Parts Discussed in Thread: TMS570LC4357

Hi TI,

I am using TMS570LC4357 to Generate a SENT Waveform as shown below using N2HET peripheral with HTU Module.

Here I had made all the configurations for both N2HET and HTU as defined below.

N2HET Configuration:

VCLK2 = 100MHz

HR Prescalar = 50

LR Prescalar = 2;

So=> HRP = 500ns and LRP = 1us;

and HR Cycles per LRP = 2;

HTU1 Configuration:

1. DCP0 is enabled.

2. Buffer full Interrrupt is disabled.

DCP0 Configuration:


DCP0 Element count = 1;

DCP0 Frame count = 20;

DCP0 Direction = Main RAM To N2HET RAM

DCP0 transfer = 32 bit transfer

DCP0 ADDMH = 16 byte

DCP0 ADDFM = post-increment main memory

TMBA = Circular buffer

TMBB = One Shot Buffer (not used)

IHADDR = (0x6)<<2; // Data field of Second N2HET Instruction.

And my N2HET Program is

_3us DJZ {next=_3us, cond_addr=Tick, reg=A, data=2}


Tick DJZ {next=Reload, reqnum=0, request=genreq,cond_addr=Shift, data=4, reg=A}

Shift SHFT{next=ChkShift, reg=B, smode=OR0, cond=UNC, pin=0, irq=OFF, data=0xAAAAA}

ChkShift ECMP {next=Reload, cond_addr=ShiftCnt, reg=B, en_pin_action=OFF, pin=0, data=0, hr_lr=LOW}
ShiftCnt MOV32{next=Reload, remote=Shift, data=0xAAAAA, z_cond=OFF, init=OFF, type=IMTOREG&REM, reg=A}

Reload MOV32 {next=_3us, remote=_3us, data=2, z_cond=OFF, init=OFF, type=IMTOREG&REM,reg=A}

That's all my set up.

NOTE:
According to this setup, HTU1 DCP[0] will be get triggered again and again at least after 15us (minimum case).
So HTU has at least 15us time span to complete it's transmission from the instance it gets the trigger (minimum case).

I refer the N2HET and HTU appnote from TI. (spna217.pdf, spna130a.pdf and TMS570LC4357 trm also)

I have read these documents many times.

But still I can not predict what is the error I have made.

Please anybody guide me to correctly utilize this HTU module and N2HET.

I have attached my CCS project, and HETIDE Project with this post.


5618.N2HETHTU.zip

6052.N2HET_Sent.zip


Please help me to resolve this problem soon.

Thanks in advance.

Regards,
Karthikeyan.K

  • Hi Karthikeyan

    Did you simulate your N2HET program first in the HET IDE?

    The 3us delay loop strikes me as a potential problem.  

    HET programs are not written like C programs where they will run continually until exit.

    Instead the HET begins executing your program from the starting address 0x00 (offset in HET RAM) and your program must complete and branch back to address 0x00 within  LRP -  1 CLOCK (I believe -1 VCLK2) or you will get an overrun error.

    Normally you'd have LRP set to something like 1.28 us or less - of course this depends on your LR and HR prescaler settings.

    Anyway a program with a 3us DJZ loop running within a 1.28us period is going to do basically nothing  but execute the DJZ until it overflows.

    If I had to implement a SENT transmitter on the N2HET - I'd build it upon a precise PWM program.

    I'm attaching one you can play with. 4527.pwm.zip

    Then you can actually do a 5-bit multiply on N2HET pretty easily - with several shift-add steps (See the ADD instructon).

    So you could take the base period of the unit interval - and multiply it by (nibble value + offset) to get the period of the next pulse you want to ouput.    I forget exactly how the high/low phases of the SENT signal look but you could do the same sort of thing to calculate the 'duty cycle'.

  • Hi Anthony,

    Thanks for your reply first.

    Please make the following change. (I made this change for testing purpose and I forget to correct it again.)

    So please do the following in HET IDE.

    (Of course You can understand easily if I simply write the steps. But for clarity of any other reader I attached the Snap shots of steps.)

    I had modified these field wrongly and just forget to undo the changes.

    Sorry for the inconvenience.


    I do the changes you said and come back to you.

    Really Thanks a lot.

    Regards,

    Karthikeyan.K

  • Hi Anthony,

    I have looked your PWM.zip HET IDE Project. I also tried this similar way before. Using only the HET is not my aim. I want to use the hardware resource best. If I am able to use HTU with HET, then I can complete the same task with 6 or 8 line of HET Code. So I should make use of HTU module.

    In my CCS project I tried that kind of approach only.
    Please refer that also. It will help to understand my problem better.

    Please guide me to figure out my mistake and to use HTU module.

    Thanks in advance.

    Regards,
    Karthikeyan.K
  • Hi Anthony,
    Guess what? I did my logic worked. Actually all the configurations I have made are correct only. So HTU tries to Read a data from a Main RAM and to write a data to a N2HET RAM. But the Problem is MPU unit. Since the Read location to the HTU is not configured as device shareable, HTU cannot read from Main RAM. This is what the problem.

    So I just make the Main RAM Location where the Source Buffer is located as Device Shareable. After then HTU can read the data from Main RAM and it can place data in N2HET RAM.

    This way my code works.

    Really thanks for your Contribution Anthony.

    And I want to know mode about that MPU unit. (trm expalins about NMPU Unit. I'm not sure these both are same,?)
    Can you brief slightly about what MPU and NMPU are?

    Thanks,

    Regards,
    karthikeyan.K