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.

TMS570 31x - Hercules HDK - Hall effect / MR sensor speed capture

Other Parts Discussed in Thread: HALCOGEN

Hello,

I am using the Hercules HDK to capture the angular position and speed of a motor shaft. The Hall / MR sensors generate pulses as the motor starts to rotate. Depending on the design I can adjust the resolution such that the maximum pulse frequency is about 10 KHz -  80 KHz ( I prefer to use the higher resolution alternative- i.e 20 KHz ). I would like to use the TMS570 to calculated the position and speed of the motor. From what I understand there are two ways of doing it: 1) To use GIO to generate an edge detection interrupt, count a few pulses and use RTI to capture time difference between X number of pulses. 2) to use N2HET 

While method 1 is more accurate it is quite interrupt intensive and is not ideal especially since my system has 8 speed sensors. I am wondering if N2HET could be used to capture the speed and position given the pulse frequency of 80 KHz or at least 10KHz? 

I am also not clear what the "edgeGetCounter", "hetGetTimeStamp" (from HALCOGEN generated code) function do ? can they be used to count the number of pulses in a given time to calculate speed? How can I use N2HET to count the number of pulses in a given period of time?

Thanks,

Darius

  • Hello Darius,

    The N2HET timer peripheral on the LS31x MCUs is ideally suited for these types of input capture applications. The N2HET is a specialized micro-machine with its own instruction set comprising of 30 instructions. There are instructions that you can use for counting edges, measuring pulse widths and measuring periods.

    There are also instructions that allow you to create an angle-reference to synchronize signals to a toothed-wheel using a set of three instructions.

    The N2HET instruction set as well as the special angle functions are described in the technical reference manual, SPNU499. Please refer this TRM and let us know if you have any queries.

    Regards, Sunil

  • Hi Sunil,

    From my understanding the angle-reference synchronize is only limited to N2HET pin 2. Is there any application guides for the N2HET instruction special angle functions or some examples? Can you explain what the HALCOGEN generated "edgeGetCounter" and "hetGetTimeStamp" functions do? 

    Darius 

  • Hi Darius,

    I will look for example code for the angle functions. In the mean while, you can use the HET IDE for evaluating the behavior and performance of any N2HET program or snippet that you write. You can find the HET IDE here.

    Now for the descriptions for the functions you asked about (sorry missed this earlier):

    The HALCoGen utility creates a default N2HET program which it programs into the N2HET memory based on the configuration you make using the GUI. This supports up to 8 PWM outputs, up to 8 edge counters, and up to 8 input signal period captures.

    The edgeGetCounter reads the data field of the edge counter (ECNT) instruction for the edge number you provide (from 0 to 7 supported by the default program).

    The getGetTimeStamp reads the data field of the one WCAP instruction provided in the default N2HET program. I see that the GUI does not offer any capability of configuring this instruction.

    Regards, Sunil