6 years, 8 months ago.

PMWIn period

Hi, I need to read pulses from an RC control with 4us period, is this possible with pwm with KL25Z hardware? Thanks.

2 Answers

6 years, 8 months ago.

A little bit by directly controlling some hardware, which means you lose a few other functions since contrary to the LPC1768 the KL25Z doesn't have spare timers after the mbed lib uses what it needs. However are you sure you have to measure pulses with 4us period? RC control generally uses a 20ms period. Now some might be faster, but 4us makes no sense.

6 years, 8 months ago.

Ok, I'm trying to use an nintendo wavebird control from an old gamecube, so in the link below, there are the protocol used.

"The transfer speed is rather fast at around 4us per bit. As with the N64 controller, a low bit is signalled by a 3us low followed by 1us high, and a high bit is signalled by 1us low followed by 3us high."

http://www.int03.co.uk/crema/hardware/gamecube/gc-control.htm

Ah, I assumed you meant an RC plane control or something. This also are digital bits which are sent via an irritating protocol. But at least you only need to make comparisons.

Is it possible? Yes. But it won't be trivial. You can try it with the standard mbed timer lib, but good chance it is too slow at its default 1us tick speed. (I wouldn't bother with interrupts either, just read a pin as fast as possible, and when it changes store the time/calculate the bit (You might even consider calculating the bit later, and initially just storing the times in an array).

posted by Erik - 31 Jan 2014