rrTV-PHOTO   New HD TV
HOME   rrTV-PHOTO   GALLERIES   MY GALLERY   HELP-FAQ
myHOME PM pmRR MEMBERS 827 ONLINE 21 EVENTS SEARCH REGISTER  START HERE
 
9 pages [ <<    <     2      3     ( 4 )     5      6     NEXT    >> ]14494 viewsPOST REPLY
Century Helicopter . MTA Hobbies . Model Rectifier Corp

.
.
Radio - Servo - Gyro - Gov - Batt > Starting a Home-Brewed PCM Receiver Project
 
 
Angelos
Key Veteran
Location: nr Oxford, OX11, UK

Inter-processor protocol.

Mark,
I have just started working on the PCM/PPM encoder. There is a small issue that worth discussing before we go on our separate ways. It seems that we both decided to use two CPUs. A main one for doing the calculations and a secondary for encoding the protocol. It will be nice if we use the same protocol for the inter-procesor cooms. Irrespectively of whether SPI, I2C or RS232 is used the data transfers are 8bits. To make the protocol compatible with I2C the first byte must be in the format:

A3 A2 A1 A0 xx xx xx RW

You will probably also need to define RW (read or write) so this gives an overhead of 4bits to the SPI which does not need the Ax bits.

How about transferring the channel data? Any ideas?

Timing… It is stupid to compute more frames than needed. Thus I recommend that the CPU that produces the protocol to send a trigger each time a frame starts to be transmitter. This trigger will tell the main CPU to read the joysticks and produce the data for the next frame. This trigger may be an extra connection between the two or it could be a flag that is polled by the main CPU. Any thoughts?

My recommendation is:

1. The protocol CPU sets the new frame flag
2. The main CPU polls the flag and detects that it is time to compute the next frame
3. The main CPU delays reading the joysticks as long as possible so that it does not induce delay to the controls.
4. The main CPU reads the joysticks and computes the next frame.
5. The main CPU transfers the frame data to the protocol CPU just before the last frame is completed.
6. The protocol CPU calculates the PCM stream on the fly or during the preamble time.
10-20-2003 Over year old.
 
 
MarkF
Senior Heliman
Location: Palo Alto, CA

Hi, Angelos!

Actually, my current work on the receiver is focused on a single-chip PCM-FSK solution. Even if I do decide to develop a PCM-QPSK receiver, I’ll probably try to make a single-chip receiver there, too. For the transmitter, I haven’t thought too much about it yet, but the Synchronous Serial Controllers in the Atmel chip would make it pretty straightforward to implement all the digital processing on a single chip. Still, I can definitely understand why you might choose to split up these two functions, for it’s certainly more straightforward to do so!

>
> 1. The protocol CPU sets the new frame flag
>

This certainly makes sense – that way the transmitter is uncoupled from the transmit frame time.

>
>2. The main CPU polls the flag and detects that it is time to compute the next frame
>

Ideally, it’d be an interrupt, but that’s obviously not a big deal.

>
> 3. The main CPU delays reading the joysticks as long as possible so that it does not
> induce delay to the controls.
>

To do this, the transmitter would need to know the frame time. Instead, why don’t you provide a processing time budget for the transmitter to prepare a frame, and let the protocol CPU know how long this time period is. Then, the protocol CPU could make its request just in time for the CPU to create the data and deliver it.

>
> 6. The protocol CPU calculates the PCM stream on the fly or during the preamble time.
>
Ah, now I see, you are planning on having the transmitter not even know about the RF protocol, which makes sense. In that case, you’ll need to just send all channels once/frame, and the protocol CPU would perform differential encoding, CRC, etc. Sounds like a good plan!

As far as my project goes, once I do get around to the transmit side, I’ll definitely keep your architecture in mind, so that it’ll be easy to port my code to your setup, whether or not it’s initially written for a single-chip transmitter.

Thanks for the advice!

Cheers!
MarkF
10-20-2003 Over year old.
HOMEPAGE  
 
 
Angelos
Key Veteran
Location: nr Oxford, OX11, UK

Mark,
Yes, the intention is not to include any air-protocol specific stuff in the main software. If the main CPU is not aware of the how the data are transmitted to the model then switching to a different method will work without any modifications.

I like the idea of the slave CPU generating an interrupt. Thus you can have the main CPU doing stupid stuff (like managing the menu system, measure volts, updating the LCD, etc) and when the interrupt comes in it computes the next frame and returns to the “stupid stuff”. What I was trying to achieve by polling the flag though I2C was to avoid an addition connection between the two.

The idea of having the slave CPU to generate the delay is also good. Here is my proposal… before the main CPU start computing a frame it sends the protocol header byte to the slave CPU. The salve CPU starts counting time and will stop when the last byte of channel data is received. This way the slave CPU will be aware of how much time it takes to read the joysticks, compute the frame and send it to the slave CPU. Then the slave CPU can adjust the interrupt timing accordingly allowing a 10% extra time for safety. Also if the user activates some other function that affect the computation time of the frame the system will be able to adjust for best performance automatically. We can have a small monitor routine that checks this timing and how often it readjusts. As long as it happens only when you are switching flight conditions etc, then I am happy with it.

What are your thoughts?

Cheers,
Angelos
10-21-2003 Over year old.
 
 
MarkF
Senior Heliman
Location: Palo Alto, CA

Hi, Angelos!

That sounds like a very appropriate choice, and a great way to go! It definitely makes sense to me. Great stuff!

Cheers!
MarkF
10-22-2003 Over year old.
HOMEPAGE  
 
 
MarkF
Senior Heliman
Location: Palo Alto, CA

Howdy, Folks!

QPSK in the R/C Bands

As I’ve been thinking about the QPSK project, I delved into the FCC rules for R/C transmitters, and have learned a few things. Most importantly, the FCC has assigned 2 KHz guardbands between our control frequencies (essentially 1 KHz on either side of the modulated signal) so that the maximum legal channel bandwidth is 8 KHz, not 10 KHz. Consequently, we won’t have quite as high a data rate as I’d hoped for.

Given an infinite budget, we could approach a data rate of about 40K bits/second. However, that’s a little on the expensive side! Using QPSK modulation, and a reasonable “alpha”, or “excess bandwidth” figure of 0.25 (meaning that the modulated signal is 25% larger than the symbol rate), we can expect realistic communication rates of 6.4K symbols/second. Since QPSK transmits two bits for every symbol, we’d be able to deliver a data rate of 12.8K bits/second. This throughput would be 2.5 times higher than current generation R/C gear – not bad at all!

The next question is: “Is it legal”? Fortunately, the answer is yes. The FCC specifically permits any form of modulation to be used for our R/C transmitters, as long as it fits within the spectral envelope that they’ve mandated, which isn’t too bad (-25 dB outside the +/- 4 KHz bandwidth region out to +/- 8 Khz, -45 dB from >8 KHz to +/- 10 KHz, -55 dB out to +/- 20 KHz, and about 56 dB beyond that). So, the answer is that this can be done! I’m still collecting information before tackling the QPSK project, but the news is encouraging so far!


The Project

Meanwhile, back to the current project. It’s turned out to be even tougher than I’d thought to create the single-chip receiver, for two reasons. First of all, the 5X oversampling that I’ve specified makes timings extremely tight without DMA, mandating a quite sophisticated event management mechanism. After knocking my head against more than a few walls, there’s now light at the end of the tunnel. While the new structure isn’t quite running yet, I’m getting very close – it should be able to perform simultaneous RF sampling and high-precision servo driving within the next couple of days. Now, that’s still with its own proprietary data format, so nothing will be able to drive it other than test code, but it’s still pretty good progress (about 20 pages of C and assembler code so far).

The second challenge is that in this tight timing environment, the performance of every element counts, and as it turns out, the C compiler I'm using (from IAR Systems) has a terribly inefficient runtime library that’s unbelievably slow, so I’m removing nearly all calls to standard C library functions and replacing them with my own code. In the most extreme example, I sped up the process of moving events around in memory by a factor of about 20X! This has obviously taken a fair amount of time.


Why 5X Oversampling?

Well, to begin with, I’ve never heard of a receiver that uses 5X oversampling, so why not? Won’t it be “a bit better”? Actually, this format is interesting, since it lets us make a stronger determination of whether each received bit is a ‘1’ or a ‘0’. I use each group of 5 samples to index into a lookup table that results in a ‘1’ decision if three or more of the received samples was high, or a ‘0’ decision if three or more samples was low. This will improve SNR [Signal/Noise Ratio] performance considerably, as compared to normal single-sample receivers.

The downside of 5X oversampling is that it leaves very little time between samples. With the new (to me) 8 KHz bandwidth limit, the PCM-FSK version will be pumping through ~6.4K bits/second, which works out to about 31 uS/sample - that's not much time to do anything! So, that’s why it’s taking longer to create than I’d initially thought.


A Bit More about QPSK

However, one great learning experience from this project is that I’ve decided that the compute power available with this core is almost certainly enough to create a single-chip QPSK version. As I mentioned before, we’ll definitely need the kind of DMA controller that the Atmel chip uses to do so, but there is sufficient horsepower to perform the necessary “software-defined radio” tasks.

I’ve decided that my target for QPSK, if I decide to pursue it, will be to use 8X oversampling, which is 51.2 KHz – that’d be 102,400 twenty-four bit samples per second flowing out of the A/D converter (and these are analog samples, not just simple digital samples). While I’d love to use just 8-bit A/D converters, the most appropriate choice here are standard PC stereo audio codecs - we’ll try to live with the additional overhead. Anyway, by using what is known as a “matched filter” architecture, this receiver should be able to deliver much better SNR performance than current FSK gear.

As you can tell, I’m definitely leaning towards creating at least a baseband version of the QPSK receiver (that is, everything but RF), but I’ll need to do more investigating before I commit to it.

For what it’s worth, that’s where things sit at this stage!

Have Fun!
MarkF
10-22-2003 Over year old.
HOMEPAGE  
 
 
Angelos
Key Veteran
Location: nr Oxford, OX11, UK

Mark,
Perhaps you would like to know that the shortest pulse (positive or negative) in PCM1024Z is 300usec. This means that the shortest period will be 300+300usec or 1.667KHz. This obviously leaves much larger guardbands.
10-22-2003 Over year old.
 
 
MarkF
Senior Heliman
Location: Palo Alto, CA

Hi, Angelos!

Yup - that's exactly the issue. For cost and simplicity reasons, the R/C manufacturers aren't pushing the data communications envelope at all currently. With this project, I intend to do just that!

Best Regards!
MarkF
10-22-2003 Over year old.
HOMEPAGE  
 
 
MarkF
Senior Heliman
Location: Palo Alto, CA

Hi, Gang!

One more quick thought. The QPSK receiver that we're developing at work has a completely different target than we do here: it's designed for "burst" transmissions, where many different transmitters send an individual ~"frame" sequentially. In systems like this, it can be tricky to rapidly figure out how to achieve timing synchronization - that is, where to sample the signal for optimal data recovery.

This application is completely different. Since R/C transmitters are essentially transmitting continuously, a very different form of synchronization can be used. Since we'll be doing this all digitally, we'll be able to achieve a great lock to the transmitted signal that'll be very resistant to noise.

Since this is, after all, an R/C heli forum, what does all this mean? Faster, better, more precise control of your helicopter, plus a more noise-resistant control link that should result in far fewer control problems!

Have Fun!
MarkF
10-23-2003 Over year old.
HOMEPAGE  
 
 
Andy Williamson
Heliman
Location: Pahoa, Hi

Cool, I what one!
10-23-2003 Over year old.
 
 
MarkF
Senior Heliman
Location: Palo Alto, CA

Hi, Andy!

Thank you very much! I'm working on it, and all I can do at this stage is to apologize that it's taking longer than I'd hoped for to pull this off! However,on the positive side, the entire reason I'm publishing the source code for this project is to try to ratchet things up a notch so that we all can start receiving better performance from our commercial gear.

Thanks again!

Have Fun!
MarkF
10-23-2003 Over year old.
HOMEPAGE  
 
 
Angelos
Key Veteran
Location: nr Oxford, OX11, UK

Don’t let this thread die…

Ok, nothing much done since my last post but I thought to post this pointless update to keep the thread alive.

I had enough developing PIC firmware with the PICSTART Plus programmer. For those of you who are not familiar with the process, it is required to remove the chip from the prototype board place it on the programmer to flash the new firmware and then place the chip back on the prototype board to test the firmware changes.

So I got myself an ICD2. The ICD (In Circuit Debugger) allows to flash new firmware without taking the chip out of the prototype PCB, monitor the registers (data variables), change the registers and set breakpoints as the program is running. I really love this device, it really makes life easy.

PIC microcontrollers are nowhere as powerful as ARM. However the have more than enough computational power to generate PCM1024Z and this is all I need for now until MarkF comes up with a better system. Mark, I don’t intend to pay very much effort on how the data are transmitter to the model so I am counting on you for this one. I will use PCM1024Z for now and concentrate on the actual transmitter software which as I previously said runs on an ARM9.

That’s all for now… keep up the good work.

-Angelos

10-24-2003 Over year old.
 
 
MarkF
Senior Heliman
Location: Palo Alto, CA

Hi, Angelos!

Nice pic! I'll post one about my setup once I'm to the stage of actually driving servos. It's a deal on the transmit/receive code; I'll be delighted to share it with you!

Meanwhile, work's tied me up for the last couple of days, so I'm just getting going again, too. However, I did discover something today that has me really excited!


A Better Form of Modulation!

After playing around with the idea of building a QPSK receiver, I managed to stumble across a new form of modulation that NASA is using for space telemetry! It's called FQPSK-B, for Feher-patented QPSK - revision B. This is an absolutely amazing system.

First of all FQPSK-B is far more spectrally efficient than conventional QPSK, typically needing just 0.78 Hz/bit! With this scheme, it should be possible to deliver well over 10K bits/second - I'm not sure of the actual numbers yet, since I'm still playing around with the "spectral masks"/envelopes that define acceptable and required bandwidths. Moreover, a well-designed FQPSK-B receiver can deliver very similar SNRs to QPSK. While its noise performance is about 1 dB worse than conventional QPSK, that still makes it 2 dB better than today's PCM-FSK systems!

From a horsepower perspective, it'll take more work, but I'm now reading some research papers from authors who are coming up with ways to reduce the complexity of receiving FQPSK-B. My early SWAG is that it'll be doable on the chips we've been looking at. Yee-hah!

So, I can't stand it anymore - I'm going to create an FQPSK-B receiver one of these days. Before that happens, I've still got a lot of work to go on the PCM-FSK version, but I just can't resist tackling this eventually. I still haven't decided whether I'll do the RF part, as well, but there's yet another fabulous attribute of FQPSK-B that makes it just about irresistable. FQPSK-B works fine with (normal) nonlinear RF chains!!! It might even be possible to adapt existing RF transmitters and receivers, though probably at a somewhat reduced bitrate. I guess I'll be using 53 MHz versions, since then we'll even be legal (I've had a ham license for almost 30 years).

This really is getting to be a lot of fun, and we'll get to do something really new, to boot. Thanks again, folks, for the encouragement!

Have Fun!
MarkF
10-25-2003 Over year old.
HOMEPAGE  
 
 
Angelos
Key Veteran
Location: nr Oxford, OX11, UK

Tom,
have you tried assembly? BASIC is ok for slow stuff but when timing must be accurate you need to use assembly. If you haven't already used it, give it a go. Once you practice a bit you will be able to see the advantages.
-Angelos
10-25-2003 Over year old.
 
 
MarkF
Senior Heliman
Location: Palo Alto, CA

Hi, Gang!

Tom: Congratulations!!! Now that's cool - this was Tom's first time programming, and he's already gotten his head speed tachometer running?!? WAY cool! Keep it going, dude - I wanna' see those little Tom robots running around one of these days!

Angelos: Actually, the PicBasic PRO compiler that Tom's using is quite fast, and even gives C compilers a run for the money. I recommended that he start with it, for it supports full-blown interrupt service routines, has great support for PIC hardware, and is easily the most approachable environment for the PIC.

There are indeed times when assembler language is the only way to go (like in my receiver - ugh!), but for most folks, assembler is generally something better to advance to, rather than to start with. This is especially true on the PIC, which IMHO has one of the quirkiest assembler languages around . Seriously, PicBasic PRO is an excellent choice on the PIC family, and it's probably the best way for new PIC programmers to start!

All: Oh, by the way, did I mention that FQPSK-B has vastly better spectral characteristics than other modulation formats? Amazingly enough, if we do this right, it will significantly reduce adjacent channel interference!

Have Fun!
MarkF
10-25-2003 Over year old.
HOMEPAGE  
 
 
MarkF
Senior Heliman
Location: Palo Alto, CA

Hello!

For those who would lke to learn more abourt FQPSK-B, I'd recommend two very interesting resources. First, there's the IRIG 106-00 Telemetry Standard. In this one, check out chapter 2, and then Appendix A for FQPSK-B information. This is the most readable and authoritative information I've seen on FQPSK-B.

Another great reference is a research paper that describes the initial FQPSK (not -B) system in excellent detail, then describes how to make it much better, no doubt similar to FQPSK-B, which uses different techniques (special filters) to achieve its spectral efficiency. Warning: this is seriously technical stuff, but FQPSK-B's so neat I actually enjoyed wading through it! Check out NASA's Performance Evaluation and Interpretation of Unfiltered Feher-Patented Quadrature-Phase-Shift Keying (FQPSK).

For those, like me, who are loony enough to get into this stuff, I think you'll find this to be pretty cool!

Cheers!
MarkF
10-25-2003 Over year old.
HOMEPAGE  
 
 
George You
Heliman
Location: West Pacific Island

PLD decoder or micro controller decoder

Hi Angelos and Mark-
have you ever considered using a CPLD/FPGA for the receiver decoder? They have the advantage to parallel decode job and most tempting, it can be "ASIC"ed.
10-27-2003 Over year old.
 
 
MarkF
Senior Heliman
Location: Palo Alto, CA

Hi, Folks!

George: Now I have! That's actually an excellent idea, and would be much easier than what I've been doing in S/W. The PCM-FSK solution's no problem, but the FQPSK-B solution would need a fairly hefty device. It wouldn't be all that difficult with FPGAs like Xilinx's Virtex II - they definitely have the capability, but they're not exactly cheap (remember that the CPU I'm using is only ~$4 in volume). Still, this would give us a "perfect" jitter-free solution. Hmmm - where's my Verilog book? Seriously, thanks for the recommendation - I may just play around with device sizing after we've gotten through the FQPSK-B project!


It's Working!

My "Omega 16" PCM-FSK receiver code is finally up and running, including 5X oversampling! While the jitter is too high at this stage thanks to the fact that I haven't been able to "tune" it yet, it definitely is working! Right now, the worst case long-term jitter is ~1/2 a PCM step, which is unacceptable to me. Once I complete the failsafe activation functionality (currently, the RX is set up to receive failsafe frames, but doesn't do anything with the data yet), then I'll improve the timing precision.

One factor in the jitter was something that I'd forgotten about completely: the wait-states in the FLASH ROM are very difficult to predict, thanks to the FLASH prefetch mechanism that I'd mentioned earlier. Consequently, I'm trying to decide whether I'll eventually move the exec_events() assembler routine into the zero wait-state RAM, or whether I'll build a full-blown event compiler that creates its own code in RAM on the fly. I'll think about this one, and will let you know what I decide.

I ran into one very interesting challenge while I was working on the project. I noticed that the receiver would run just fine most of the time, but would encounter a timing overflow once in a while. In other words, it would reach the point where an event that it was supposed to execute was slightly in the past! The cause? As the control position varied, it was possible for an RF sampling event to just precede or follow an output event, which could lead to the event handler needing to process two events that were separated by 500 nS or less, which is too fast for it to handle.

This problem is essentially a function of the RF sampling rate, and could easily have been fixed by tweaking the data communications rate slightly. Instead, though, I decided to create a generic fix that would work at any communications rate. What I did was to change the add_event routine to check to see if an output event is within one microsecond of an input event. If so, I change the time of the input event to match the time of the output event, and merge the two events into one. This works very well, and is completely insensitive to the communications rate used.

There is a downside to this approach: by forcing the RF sampling event to match the timing of the output event, RF sampling can jitter by +/- one microsecond. However, this is only about 1/150th of a bit time at an FSK data rate of 6,400 bits/second, which means that it's completely harmless, and will have no measurable impact on RF performance. By giving "priority" to output events, we get more accurate servo pulses, without any significant disadvantages. Yay!

As a reminder, this is still running with test data inputs, and isn't actually driving servos yet. Once I get to the point of reducing that output jitter, then we'll start soldering!

Have Fun!
MarkF
10-27-2003 Over year old.
HOMEPAGE  
 
 
Andy Williamson
Heliman
Location: Pahoa, Hi

Amazing!
Or sounds amazing. Don't really understand most of that, but I'm sure the final product will be amazing as well.

Andy
10-27-2003 Over year old.
 
 
Angelos
Key Veteran
Location: nr Oxford, OX11, UK

Here is a screenshot of the first version of the model menu. 3 pages like the 9z (system, model, condition) so there are (Page+) and (Page-) buttons. Selections are performed by 4 switches in the shape of a cross. Most items in the menu don't open yet, but I will progressively write the code for all of them. This is an early menu system. I am investigating the possibility of using a touch screen. I have already taken my old Palm m105 apart and the touch layer is a perfect fit for the LCD that I am using.

I would appreciate suggestions for the GUI for both existing and touch-screen implementations. I am not sure which way I will go yet. To give you an idea of what screen area I have to work with… the resolution is 320x200 pixels.

10-27-2003 Over year old.
 
 
pilotError
Key Veteran
Location: Long Island, NY

Menus

Angelos,

Jeez, if you wanna build a high end transmitter, the menu has to be cryptic and unuseable to the novice!

Nice job, I particularly like the little help window at the bottom.

Mike...

Good Judgement comes from Experience. Great Judgement comes from Bad Experience.
10-27-2003 Over year old.
 
 
9 pages [ <<    <     2      3     ( 4 )     5      6     NEXT    >> ]14494 viewsPOST REPLY
Heli Wholesaler . 3D Heli Depot . JR-Spektrum

.
.
Radio - Servo - Gyro - Gov - Batt > Starting a Home-Brewed PCM Receiver Project
 PRINT TOPIC Advertisers 

Subscribe to This Topic

Thursday, December 4 - 10:38 pm - Copyright © 2000 - 2008 runryder.com | email | link to rr | runryder needs cookie