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.
Solved! Go to Solution.
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
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.
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
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
I'm interested, too
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,