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.

CCS/TMS570LS1224: Using the EDGE INTERFACE INSTRUCTIONS to control the N2HET

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hi

I had some problems with the other post and I couldn't figure out how to make them work.

I also had to pause the project at work before and I'm being requested to finish that area in particular as fast as possible. 

We are controlling 11 DC motors using quadrature encoders without Index pin. 

Before we were trying to use the HET IDE to program it and use the application note on quadrature encoders as well as other posts to make the code. We had some problems with the simulation and the retrieving of the data from the co-processor. 

I was reading the previous posts and I still have this question: 

Please take a look at the red rectangle. There is a set of instructions for edge detection. The encoders (rising and falling edges) provide 14453 pules per revolution, at 25.8RPM, having a frequency of 6214.79pulses per second, 6.2kHz, which is quite slow. 

Can I use that specific set of instructions to make a code in C to read the 11 quadrature encoders? 

if the answer is yes, could you please explain to me what is the meaning on hetREG (is it the pin I want to use?) and the edge? like, what to write in there. And what is the hetRAM? like... how can I retrieve the count in a specific encoder using that instruction?

Thanks 

 

  • Hi Miguel,

    These functions are generated by HALCoGen. You can refer to the "Help" menu within HALCoGen for explanations of each of the arguments that these functions take.

    Regards,

    Sunil

  • I'm aware of that. 

    The main question is whether or not I can use those instructions for 11 quadrature encoders or if those instructions have a maximum number of HET pins that can be linked. 

    I'm aware that in Halcogen you can only use up to 7 of those pins

  • HALCoGen places an artificial constraint on the number of pins that you can use for input-capture timings. This is just to be able to use a template N2HET program to support some number of output-compares (PWM) and some number of input-captures.

    Take this function as an example:

    /** @fn void edgeResetCounter(hetRAMBASE_t * hetRAM, uint32 edge)
    *   @brief Resets edge counter to 0
    *   @param[in] hetRAM Pointer to HET RAM:
    *              - hetRAM1: HET1 RAM pointer
    *              - hetRAM2: HET2 RAM pointer
    *   @param[in] edge Edge signal:
    *              - edge0: Edge 0
    *              - edge1: Edge 1
    *              - edge2: Edge 2
    *              - edge3: Edge 3
    *              - edge4: Edge 4
    *              - edge5: Edge 5
    *              - edge6: Edge 6
    *              - edge7: Edge 7
    *
    *   Reset edge counter to 0.
    */
    /* SourceId : HET_SourceId_009 */
    /* DesignId : HET_DesignId_009 */
    /* Requirements : HL_SR372 */
    void edgeResetCounter(hetRAMBASE_t * hetRAM, uint32 edge)
    {
        hetRAM->Instruction[edge + 17U].Data = 0U;
    }
    

    As you can see the above code expects the counter to be implemented by an N2HET instruction at a certain location in N2HET RAM, as per the "edge number". This is entirely dependent on the template program which has the counter instruction at that specific address.

    You can write your own N2HET program to count edges or measure input pulse widths and duty cycles for as many N2HET channels as supported on the part you are working with. You can use the N2HET IDE to simulate your programs: http://www.ti.com/tool/HET_IDE

    Regards,

    Sunil

  • Is there a way to go over that constraint?? 

    I'm trying to see if there is a way to not use the HET IDE. 

    I already have a code, https://e2e.ti.com/support/microcontrollers/hercules/f/312/p/813986/3012691#3012691 for 10 encoders. The code I think, only detects falling edges. I have a frequency of around 6.2kHz. I haven't been able to simulate that. 

    The code looks too large, but you can focus on the first set of instructions. Is pretty much the same code, just copied 10 times

  • You cannot use HALCoGen to create N2HET code that requires more than 8 input-captures.

    The code for quadrature encoder interfaces that you posted on the other thread is not generated by HALCoGen. You cannot use the edge* functions generated by HALCoGen on this code without modifications.

  • Ok. So there is no way to modify the code from Halcogen to be used for more input capture then...

    I know is not generated by Halcogen... I wrote that code, based on another post.

    I will try and run the code in the next days. I need to finish some connections on the electronics for the encoders. I just need to read the information from the N2HET. I think I have the information on how to do that

  • For the HTU, I need to program the instructions from the HET IDE? or can I just do that on C??

  • An N2HET instruction has an optional enable to generate a transfer request to the HTU. The instruction's condition field needs to be updated to enable this request generation.

    See section 23.2.9 on page 1110 of SPNU515C for more details.

  • I will check that. If I have any questions I will come back =)

    Thanks Sunil