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.

TMS570LS3137: TMS570LS3137

Part Number: TMS570LS3137

Tool/software:

Hi im trying read pwm from pin number 0 below i written the code im unable Update the data in read variable. is it correct method anything i need to add. please solve my query.

quicker response is appreciated. thankyou 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

L06   ECNT { next=L07,reqnum=2,request=GENREQ,pin=0,event=RISE,reg=B,data=2000};
L07   MOV32 { remote=L06,type=IMTOREG&REM,reg=B,hr_data=INIT_HR_DELAY};
; Looping
L07   BR { next=L00, cond_addr=L00, event=NOCOND }

 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

SAMPLE_SIZE=1;

 htuRAM1 ->DCP[2].ITCOUNT = 0x00010000 + SAMPLE_SIZE;

htuRAM1 ->DCP[2].IHADDRCT = (htuRAM1 ->DCP[2].IHADDRCT & 0x0) |
       0x0 << 23 | // DIR
       0x0 << 22 | // SIZE
       0x0 << 21 | // ADDMH
       0x0 << 20 | // ADDFM
       0x0 << 18 | // TMBA
       0x1 << 16 | // TMBB
       0x78 << 0;  // IHADDR

 

htuRAM1 ->DCP[2].IFADDRB = (unsigned int)&HET_Read_data;

 

htuREG1 ->CPENA = 0x00000025;//3 requests im using so i enable 

 

  • Hi Suguresh,

    First i don't understand how you are trying to read the PWM with below code, i think this code have some issues.

    L06   ECNT { next=L07,reqnum=2,request=GENREQ,pin=0,event=RISE,reg=B,data=2000};
    L07   MOV32 { remote=L06,type=IMTOREG&REM,reg=B,hr_data=INIT_HR_DELAY};
    ; Looping
    L07   BR { next=L00, cond_addr=L00, event=NOCOND }

    Let me explain instruction by instruction:

    L06   ECNT { next=L07,reqnum=2,request=GENREQ,pin=0,event=RISE,reg=B,data=2000};

    As per my understanding this ECNT instruction is used to count the rising edge pulses on the Pin-0, and this instruction stores the counted pulses into the Reg-B and the data value.

    So, whenever an event occurs, first it is copying immediate data field value +1 into the register and then it also incrementing immediate data value by one. And i don't know why you keep the initial data value as 2000, maybe it will start incrementing from 2000 for every rising edge.

    L07   MOV32 { remote=L06,type=IMTOREG&REM,reg=B,hr_data=INIT_HR_DELAY};

    Now using this MOV32 instruction you are replacing the data and register value of remote instruction with immediate data of this instruction.

    and what is the purpose of doing this it will replaces the counted pulsed of L06 instruction. So, pulse count might become zero, right?

    Please explain me this code to me, so that i can suggest you better.

    --
    Thanks & regards,
    Jagadish.

  • Hi, first I'm incrementing the counter value from 2000 so that im trying to read variable data using DCP Request. my main purpose of use is trying to Capture the pulse period .for that suggest me some method to read the data In c code.

  • Hi Suguresh,

    Please refer attached capturing example in below thread:

    (+) TMS570LS3137: PWM Capturing Code is working incorrectly - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    Here i generated capturing code using HET IDE to improve the resolution. Please refer and create in according to it.

    --
    Thanks & regards,
    Jagadish.

  • Which you provided is direct method of reading i need through HTU i need to read the data using DCP Request and that variable to be updates in HTU Memory.

  • Hi Suguresh,

    Which you provided is direct method of reading i need through HTU i need to read the data using DCP Request and that variable to be updates in HTU Memory.

    Understood, however i want you to take above code as reference for PWM capturing. And on top of that you can create HTU transfers.

    Try from your end, if not possible then i will try to create an example for you.

    --
    Thanks & regards,
    Jagadish.