Shop OBEX P1 Docs P2 Docs Learn Events
Bit Stream Generator with Propeller — Parallax Forums

Bit Stream Generator with Propeller

jbuehlerjbuehler Posts: 3
edited 2009-02-16 10:55 in Propeller 1
Hello there,
I'm new to the Propeller but I'm really loving it so far. Seems like there is a lot of knowledgeable folks on this forum. I've got a project that I figured I'd bounce off you guys. I'm working on the telemetry aspect of a pulse-oximeter (that white clip-on thing, goes on your finger in the hospital) for my senior project. Right now we're in the early stages, and need to test out our clock recovery circuit.

So what's the task? Ideally, we'd like to have an input data file on the PC (at least 32 bytes of hexadecimal numbers). Next, bit-serially transmit the data at a rate we control between 10-60kbit/s out one of the Propeller pins. I'm not quite sure how to control the timing of the transmission yet... but it would be great to understand how.
At the same time, we'll be sending a clock square-wave (50% duty) and an Output Enable (OE) signal out two other pins. I've only programmed one microcontroller in C (some ancient dinosaur my college had) so I'm vaguely familiar with how those two should work. It's timing them all together that I'm having trouble wrapping my head around.

I've spent a few weeks playing around with the Propeller and learning SPIN. That all makes sense now, and I can blink LEDs with the best of them, but how about something useful. My team and I are concerned that SPIN will be too slow to meet our timing constraints and that we will need to use ASM. This is when we stumbled upon ImageCraft's C compiler. From afar, it looks promising, but then I realized I won't be able to use the Serial SPIN object anymore (not without conversion anyway). So that's yet another fork in the road.

And this is only the first task we're going to use the Propeller to do. So you can get an idea of what we'll need to do by the end, here's a quick laundry-list.
* Reed-Solomon encoding of data (doubles our bits)
* Packetize the data
* Interleave multiple packets to form new interleaved packets
* Add framing, eg. headers, idle symbols, etc
* Turn the transmitter on (OE signal)
* Transmit encoded data in serial form through single Propeller pin to the radio transmitter
* Read serial data from the radio receiver at the instant a recovered clock goes high
* Deserialize the incoming channel-encoded bit stream
* Channel-decode the received data
* As each packet is completely decoded, transmit data over USB to PC/Matlab
- Our incoming data rate from the pulse-oximeter is ~2-20kbit/s

Suggestions/Recommendations/Warnings on this bit-stream generator?? Anything would be greatly appreciated. I'm shooting in the dark here, I'd rather not step in a gigantic pothole if someone knows where it is. Is SPIN fast enough? Is C worth using if it means converting any SPIN objects I need? Does this whole thing have to be written in ASM if we want any kind of control over microsecond timings?

Thanks much!,
Jonathan

Comments

  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2009-02-13 18:59
    jbuehler said...
    but then I realized I won't be able to use the Serial SPIN object anymore (not without conversion anyway). So that's yet another fork in the road.

    C FullDuplexSerial

    ICC version of FullDuplexSerial.spin. User must have a "..\output" directory for building this project as is. please see README.txt for more details.
    Version 1.1 fixed a bug where start always ...
    1.2
    obex.parallax.com/objects/361/

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Aka: CosmicBob
  • jbuehlerjbuehler Posts: 3
    edited 2009-02-13 19:15
    Bob-
    Sweet! Music to my ears. I did not see that on the Object Exchange... smile.gif

    -Jon
  • KyeKye Posts: 2,200
    edited 2009-02-13 19:32
    Um, spin will be to slow for the data rate you want, you'll need to go into asm for that type of transmiter rate.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • LawsonLawson Posts: 870
    edited 2009-02-13 19:47
    I've managed a fairly complex loop at 4kHz in spin, a simple serial communication loop should be able to go much faster. Timing will be tight, but with careful use of the WAITxxx instructions you should be able to achieve one clock precision. (12.5nS assuming a 80MHz clock) The counters that each cog has can be a massive help too. At some point it will make sense to transition to assembly. Thankfully Propeller Assembly isn't too hard to learn. (plenty of help on the boards here)

    Lawson

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lunch cures all problems! have you had lunch?

    Post Edited (Lawson) : 2/13/2009 7:52:20 PM GMT
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-02-15 01:54
    I think you will need to do your I/O bit code in pasm. However the rest of your code can probably be done in spin (in another cog(s)).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps (SixBladeProp)
    · Prop Tools under Development or Completed (Index)
    · Emulators (Micros eg Altair, and Terminals eg VT100) - index
    · Search the Propeller forums (via Google)

    My cruising website is: ·www.bluemagic.biz
  • jbuehlerjbuehler Posts: 3
    edited 2009-02-15 23:43
    ASM it is. Time to dive in!

    It looks like the C compiler won't be very useful for our application. From what I have read, using it requires losing the ability to use SPIN on the same chip/kit (the SPIN interpreter is overwritten). We have other teams who will be wanting to run small SPIN code in one of the 8 cogs... and they would not take kindly to being told they must write in Assembly at this point...
  • DroneDrone Posts: 433
    edited 2009-02-16 10:55
    Hi Johnathan,

    Man - if you get convolutional/Reed Solomon working on the Propeller, do share it with us. Post it to ObEx.

    Personally, rather than re-invent the radio link I would probably take a different approach: Today you can buy sophisticated radio data modules that have all sorts of capabilities like error correction and mesh. Check out the data radios at www.sparkfun.com. So you can do your link budgets, the radio data sheet or an email to the manufacturer should yield Eb/No curves, transmit power, receive thresholds/RSL, etc. for the radio of interest unless perhaps it is some simple dirt-cheap module used in toys.

    Good Luck,

    David
Sign In or Register to comment.