Hello, im newbie with mbed and i would like get some advice with customizing following library PWMAverage.h which i found in here:
https://os.mbed.com/cookbook/Accurately-measuring-duty-cycle#implementation
this library is used to measure dutycycle of incoming PWM signal on pins 29 and 30 on LPC1768 board.
I copy pasted the example code “PWMAverage_test - main.cpp” into my offline Mbed studio, compiled it and uploaded it into the LPC1768 board, send PWM signal and got the same result that i measured with osciloscope, so everything is nice in this part.
However, I ran into a problem with my application where im testing drivers of other NXP boards, where LPC1768 is used as verifying device that is recieving signals from the tested board (not important for this matter tho, i think). Im already using pin 30 during SPI bus tests that are provided from microsoft and i dont really want to interfere much with their implementation of those tests → therefore pin 30 is not available for me (I tried connecting both at the same time and SPI tests stopped working, even when i ran the tests separately - so i excluded the possibility of using the pin 30).
(I suppose that a workaround could be a simple HW relay switching between PWM and SPI wires used in those tests, but i would love to solve this with just software change with no additional HW components)
**So, I wanted to ask, how can i accomplish same behaviour of the example using different pins of the LPC1768 board (or if it can be accomplished at all). ** I tried modifying the code
PWMAverage pa(p29,p30);
to
PWMAverage pa(p15,p16);
= to different pin numbers and physically connect then to pwm signal input and got no results (i guess it has something to do with Timer 2 judging from " In this example we are using Timer 2 and therefore pins 30 and 29 ." sentence in the article.).
Can anyone please help me, what to change (my guess in the library .cpp file) so i can use different pins for this?
Thank you very much.
(Sorry for long post, i hope i described the problem enough, never used programming forum before :D)