Other Parts Discussed in Thread: HALCOGEN
Hi Jean,
I'm a user of TMS570LS04x board. I want to generate a pwm pluse with NHET24. Here is my project. It can'n work. I can't find the reason. Can you help me?
Thanks!!6254.TMS570LS04x_PWM.rar
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.
Other Parts Discussed in Thread: HALCOGEN
Hi Jean,
I'm a user of TMS570LS04x board. I want to generate a pwm pluse with NHET24. Here is my project. It can'n work. I can't find the reason. Can you help me?
Thanks!!6254.TMS570LS04x_PWM.rar
Dem,
First, I've created a new thread for your question.
Apparently the code you send me was created with Halcogen and you did a lot of modification to meet your requirement.
For NHET, Halcogen provides example code to generate PWM. 8 PWM from PWM_0 to PWM_7.
In your modified code, you removed all the code that you don't need and this is causing problems.
The NHET code generated by HalCogen is not supposed to be modified.
NHET executes code in sequence. Each instruction has a field to point to the next instruction.
Your code consists of:
instruction1 CNT, next is instruction2
instruction2 PWCNT, next is instruction3
instruction3 DJZ, next is instruction1
That way you create a loop.
Also, each instruction are composed of 4 32bit fields for a total of 128 bits per instruction.
1 Opcode field,
1 Control field,
1 Data field,
1 Reservef field.
In your NHET code, apparently you removed the reserved field. This is not correct.
So for each instruction you have to keep the following structure:
{
/* Program */
0x00002C80U,
/* Control */
0x01FFFFFFU,
/* Data */
0xFFFFFF80U,
/* Reserved */
0x00000000U
}
and not
{
/* Program */
0x00002C20,
0x0004C4B2,
0x00000000,
},
The function pwmSetDuty() is working with the original NHET code from Halcogen.
If you want to experiment with NHET, I suggest to use the NHET GUI application is available for download at:
http://www.ti.com/tool/het_ide
You will find basic NHET applet to perform basic PWM.
Here is an example of PWM code using NHET:
L00 CNT { reg=A, irq=OFF, max= 1000 }
L01 ECMP { en_pin_action=ON, pin=24, action=PULSELO, reg=A, data= 500, hr_data=0}
L02 BR { next= L00, cond_addr=L00, event= NOCOND }
You can also use the code provided in my other response available at:
http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/116477.aspx