Speed measurement for two engines using LPC2129

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Speed measurement for two engines using LPC2129

Jump to solution
1,097 Views
alessandromelin
Contributor II

Hello.

I'm developing a Keil project to measure the angular speed of two engines using the board LPC2129. Each engine has a two channels encoder of 7ppr.

I've tried to do it using external interrupts to see rising and falling edges of the encoder, but that's a little bit tricky.

Do anybody know a better way to get the angular speed with this conditions?

Thank you.

Labels (3)
1 Solution
1,003 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Alessandro,

For the solution 1, I have checked the user manual of LPC2129, it does not have timer which supports the quadrature mode, so I suggest you change another processor which supports the quadrature mode for example KV family KV10 or DSC family:

Kinetis® V Series: Real-time Motor Control & Power Conversion MCUs based on Arm® Cortex®-M0+/M4/M7 |... 

This is the screenshot copy from KV10Z16_32_V.

From the copy, you can see that both FTM1 and FTM2 supports Quadrature decoder mode, in other words, both FTM1 and FTM2 can counts rising/falling edges of both PhaseA and PhaseB signals (solution1).

If you do want to use LPC2129, I think you can use an EOR gate circuit(Exclusive OR logic) and use Timer0/1 to count the EOR output signal.

BR

XiangJun Rong

pastedImage_2.png

View solution in original post

6 Replies
1,003 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Alessandro,

As far as I know that the encoder sensor outputs PhaseA, PhaseB, Home(optional), index(optional), the PhaseA and PhaseB are phase-shifted by 90 degree. In general, in high speed, we need to count the rising/falling edges of both PhaseA and PhaseB in the fixed cycle, then figure out the speed. In low speed, it is required that rising or falling edge of ONE signal for example PhaseA can trigger capture interrupt, we can use another Timer as free Timer to count the tick, in the capture ISR, we can read the Timer counter and figure the speed.

I have checked the UM of LPC2129, the LPC2129 appears to not have decoder module, I do not know how you use LPC2129 to figure out speed.

Can you use for example LPC43xx or LPC18xx?  they have QEI module, this is the chapter Chapter 32: LPC18xx Quadrature Encoder Interface (QEI) in UM10430, but the LPC18xx is a bit old. You can use for example Kinetis KV family or DSC family.

Hope it can help you

BR

XiangJun Rong

1,003 Views
alessandromelin
Contributor II

Hello, thank you for your quick answer.

I tried to do it using capture function of timers, but there was not a way to know the direction of speed, or I did not know how to get that, so if you have the solution, please share it, I will be very glad.

About the QEI, I have a LPC1768 and I used the QEI function, but the problem is that we have two engines, and just one LPC1768. I was looking for a uC of the family LPC but the research was not productive.

Thank you for all the information,

Alessandro

0 Kudos
1,003 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Alessandro,

I want to confirm which solution you are using?

solution1)The counter counts the rising/falling edge of both PhaseA and PhaseB so that you can get the position and speed, in this way, you can get the direction inf by a flag bit in the decoder module.

solution2)A free counter counts ticks, a rising or falling edge of for example PhaseA trigger a capture ISR, in the ISR, you can read the free counter number, in this way, you can figure out the speed, but you can NOT know the direction.

Pls tell me the solution.

BR

XiangJun Rong

0 Kudos
1,003 Views
alessandromelin
Contributor II

Hello XiangJun.

I am using solution 2. So, how can I implement solution 1 with LPC 2129?

Thanks,

Alessandro

0 Kudos
1,004 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Alessandro,

For the solution 1, I have checked the user manual of LPC2129, it does not have timer which supports the quadrature mode, so I suggest you change another processor which supports the quadrature mode for example KV family KV10 or DSC family:

Kinetis® V Series: Real-time Motor Control & Power Conversion MCUs based on Arm® Cortex®-M0+/M4/M7 |... 

This is the screenshot copy from KV10Z16_32_V.

From the copy, you can see that both FTM1 and FTM2 supports Quadrature decoder mode, in other words, both FTM1 and FTM2 can counts rising/falling edges of both PhaseA and PhaseB signals (solution1).

If you do want to use LPC2129, I think you can use an EOR gate circuit(Exclusive OR logic) and use Timer0/1 to count the EOR output signal.

BR

XiangJun Rong

pastedImage_2.png

1,003 Views
alessandromelin
Contributor II

Hello XiangJun.

I will try to solve the problem with the LPC2129 or at last, I will change the processor.

Thank you very much for the help.

Best regards,

Alessandro

0 Kudos