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.

N2HET Endat encoder



Hello,

I am a bit stuck with the n2het as I am trying to generate two signal to communicate with an EnDat encoder.

I have to generate a signal corresponding to the clock, and another to send data on the rising edges of this clock signal.

I am not sure of what n2het instruction a need.

I can generate a clock signal with the ECMP for instance on the het 0, but how to do for the transmition of data with another het pin ? (I am using HET-IDE)

Thank ou for your help

Brice

  • Hello Brice,

    I can help you with your Endat query.

    Can you please let me know what speed you are trying to communicate with Endat Encoder?  

    Endat required 8x oversampling on RX data from MCU side.  

    Do you plan to support propagation delay?  Do you plan to interface to RS-485?

    also, are you trying to support Endat 2.2 / 2.1, continuous, interrupted clock mode?

  • Hello Henry,

    Thank you for your help, I am trying to figure out how the N2HET works and may help me to achieve this task.

    meanwile, I am also reading the EnDat datasheet 2.2.

    Basically I want to communicate with the ENDAT at 4MHz, I will need to support the propagation delay, as I understood it so far, I need to compute this value first.

    and you are spot on ! This with RS-485 exactly.

    For the continuous or interrupted clock mode, I don't know for the moment (need more reading), what I know is that I need to reduced at the maximum the CPU load, and continous mode would be best if possible if that means that I read countinously in the encoder.

    I also need to send data to the encoder as it is a bidirectional line.

    so I need a generated signal for clock purpose that I can modify in frequency, and on another hetpin the possibility to select TX or RX to send parameter to the Encoder and receive the value from the encoder.

    I tried to combine the PWCNT and ECMP with interrupt and maybe a mov64 to modify the program itself

    but I am not sure to be on the good way

    Thank you very much for your help.

     

  • Hi Brice,

    OK, i can help you with this information.

    It happened that i have spent sometimes last many weeks implementing the example for Endat and will be writing up an apps note in the future, so i am a bit familiar with this protocol now.

    The solution will be using NHET as the state machine controller to send Endat CLK to encoder & TXEN to RS-485 interface then, use MIBSPI to shift data (TX and RX) (SPICLK, SPICSx controlled by the state machine in NHET).

    Reason to use MIBPSI to shift data: RX data needs to be 8X oversampling, thus using NHET to actually shift in data (using SHIFT instruction) will limit the speed down to 1 MCLK due to the fact that the SHIFT instruction only works on LRP period.  However, using the NHET to send SPICLK can be done at NHET high resolution, thus, we can potentially shift in faster than 3 MHz and still satisfy the 8x oversampling requirement.

    I have an NHET state machine "example" codes that i can send to you if you want.  Please note that this is an EXAMPLE codes only, not for production purpose.

    The example codes seems to be in the final testing phase, so i will send you a snap shot for now in private email.  please let me know your private email....

    Once it is done testing through the final phase, i will upload example codes to this forum or somewhere on Wiki for used as an example, but don't want to pose incremental example on public forum...

  • Hi Brice,

    we communicated via private link and i have sent you an example codes of the on-going endat codes.

    I would like to close this public thread if the example already provided the answer for you.

    We can continue with the private link discussion for this topic.

  • hi.

    can you provide me the example code of endat??? 

    i can give you my personal email address.

    It is not for production purpose i am just studying endat 2.2.

  • Hi EmbeddedEngineer,

    Sorry Henry has left us and I don't think anyone has picked up his work on Endat.
  • Hi,

    Sorry but I am not allowed to give my code.

    I can help however if you have started a design yet, by answering question you may have.

    Best Regards

    Brice