"gptin" (general purpose timer inputs) driver for MQX on MCF52259

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

"gptin" (general purpose timer inputs) driver for MQX on MCF52259

Jump to solution
1,615 Views
trailman
Contributor V

Hi all,

 

I have developped a simple driver to measure the period of a signal on a GPT (general purpose timer) pin configured as input.

I currently use it with MQX 3.4 to measure the speed of some fans having a tachometer output connected to GPT0 through GTP3 pins.

This is a quite specific usage of the GPT module where only the input mode is used, and I don't know i this could be useful to someone.

 

The driver has 4 IOCTLs :

- one to confgure the GTP module (prescaler, ...)

- one to configure a specific pin for measurement (choose trig on rising, falling, or both edges, ...)

- one to start measuring on a pin (measure can be done simultaneously on seveal pins)

- one to stop measuring on a pin and get min/max period between trigs and trig count since measure was started

 

If someone is interested I can provide the source code.

 

0 Kudos
Reply
1 Solution
1,077 Views
trailman
Contributor V

I forgot to mention the following #define to be added to mqx/source/include/ioctl.h :

For MQX 3.4, I used :
#define IO_TYPE_GPTIN              0x13
but this value must be changed if already used in your BSP

View solution in original post

0 Kudos
Reply
6 Replies
1,077 Views
trailman
Contributor V

Please find the code attached below

0 Kudos
Reply
1,077 Views
trailman
Contributor V

Hi,

 

Here is the source code. Please see the README file for infos.

This code is supplied "as is" without any warranty. Do as you want with it.

I hope it will be as useful for you as it was for me.

 

0 Kudos
Reply
1,078 Views
trailman
Contributor V

I forgot to mention the following #define to be added to mqx/source/include/ioctl.h :

For MQX 3.4, I used :
#define IO_TYPE_GPTIN              0x13
but this value must be changed if already used in your BSP

0 Kudos
Reply
1,077 Views
trailman
Contributor V

Please also note that to build on MQX 3.7, the

    #if MQX_CPU == 5225
must be changed to

    #if PSP_MQX_CPU_IS_MCF5225X
in the driver's .h files

0 Kudos
Reply
1,077 Views
LordMarkFRT
Contributor II

I'm interested, too :smileyhappy:

0 Kudos
Reply
1,077 Views
codewarrior_use
Contributor I

Hello,

I'm certainly interested.

I've tried to do this myself and have been having problems with spurious transitions which are producing wrong results.

If you were successful in measuring a waveform's period, I'd appreciate if you would post your solution.

Regards,

 

0 Kudos
Reply