cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 how to encode in a packet ppm signals

Bogdan
Senior
Posted on January 03, 2015 at 14:58

Hello, i am staring a remote control project for a quadcopter, the main ''processor'' is a stm32f103c8t mcu wich is intended to work with nrf24l01 or cc2500 wireless devices.

My main concern is after reading lets say 4 adc channels wich are wired with my analog potentiometers, i want to generate a ppm frame with a frequency of 50 hz, each 50hz frame will contain lets say 4 ppm impulses wich the width of the impulse vary between 1ms and max 2ms,  this means that my 4 impulses accumulates a maximum lenght 8 ms, and the remains of 12 ms are free for the moment.

Ok, lets say i understand the encoding of each ppm impulse in the 50hz frame.

I was thinking of reading adc signals and convert them to  values between 1000 and 2000 wich are considerd to be microseconds, and after loading them in a timer.

But does anyone have a ideea how to encode these 4 impulses in one packet/byte ?

My experience with ppm signals is zero :(

3 REPLIES 3
Posted on January 03, 2015 at 15:19

But does anyone have a idea how to encode these 4 impulses in one packet/byte ?

For the purpose of transmission across a radio link or network connection?

For ONE byte per channel, perhaps you could encode the signal a 1/256th for the 1ms range, and on reception multiply that out, and add the 1ms offset, so the range is 1..2ms rather than 0..1ms

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Bogdan
Senior
Posted on January 03, 2015 at 16:19

Hello Clive,  this is for rf radio link.

I was thinking of something like this in a loop, wich constantly reads the adc`s values (range between 1000 and 2000 units)

port 1 =1

timer1 counts till adc1 in us

port1 =0

port1=1

timer counts til adc2 in us

port1 =0

port1=1

timer counts til adc3 in us

port1 =0

port1=1

timer counts til adc4 in us

port1=0

the port1 is just a regular gpio port pin,  signal from this pin i was thinking to put it in the rf wireless circuit.

Posted on January 03, 2015 at 17:30

Yeah, well I'd set the ADC+DMA to cycle through my 4 potentiometers, and then every 20ms (50Hz) push the measurements over a radio link.

The ADC could be in 12-bit mode giving a value between 0 and 4095. Your high/low points might be between there, so you'd drop out the minimum and then scale across the min-max range into 256 (or 1000) points.

Depends a lot on the sweep of the potentiometers being used, and the sweep of the servos.

On the receiver/servo side I'd have the timer set up to pull it's pulse profile data out of a circular DMA buffer, so it loops automatically through the channel list, and slack time. On receiving data from the controller via the radio link it would modify the DMA buffer to reflect the new pulse profiles.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..