Shop OBEX P1 Docs P2 Docs Learn Events
Another reason the prop is great! — Parallax Forums

Another reason the prop is great!

BaggersBaggers Posts: 3,019
edited 2010-10-01 13:12 in Propeller 1
Hi All,

I thought I'd share this with you guys as I thought you'd appreciate it! :)

On Friday, a friend of mine, asked me to write an app to help him out, in which he had 10 serial ports all receiving data, and then having to be fed through a single port! Now to us propheads, it's yeah dead easy, but when you think about it, there's hardly another microcontroller out there that could do the job, Pic, nope, Arm, not without a LOT of messing! AVR, nope, ( OH and Leon, you're permission to quote your favourite on this thread, is denied, we all know already! lol ), but anyway, for the Prop it was a piece of cake, I wrote a 5 port reader in one cog, used it in two cogs, to read into 10*1K buffers, then had another cog scan those buffers for full lines ( ie check for carriage returns ) which then sent them to an 8K buffer for TX which was the fourth cog, leaving 4 cogs idle, proving the prop could handle it without breaking into a sweat, ( something Leon's couldn't do, as that breaks into a sweat just turning on! :D )

Anyway, this is and other industry grade app win for the prop!

Thanks for reading!
Baggers.
«1

Comments

  • Heater.Heater. Posts: 21,230
    edited 2010-09-20 02:45
    Baggers, perfect example of Prop flexibilty. How fast can those sets of 5 ports go.
  • BaggersBaggers Posts: 3,019
    edited 2010-09-20 02:57
    Thanks, and yeah, it was like it was made for it, yet it wasn't lol because it's made for MANY MANY things, not dedicated, which is brilliant, and it was a pleasure to code also, although I've probably said that once or twice before :) lol

    btw, they all go at 115200.
  • LeonLeon Posts: 7,620
    edited 2010-09-20 03:31
    I designed something for a similar application some years ago, but I used a large PIC and several 2313 AVRs as intelligent UARTs connected via software SPI. The software wasn't easy. I'd use a Propeller these days, like you.
  • BaggersBaggers Posts: 3,019
    edited 2010-09-20 03:33
    Thanks Leon :) much appreciated!

    Yeah, I can imagine it being messy and a big chip count too!
  • ColeyColey Posts: 1,128
    edited 2010-09-20 06:42
    What Baggers isn't telling you is the whole story and how short the design cycle time was.

    I had a problem with some digital video recorders for a CCTV system which keep failing.
    In trying to narrow down the exact cause the manufacturer had asked us to monitor the debug port on the DVR. This is great in theory but a little challenging when there is ten on the one site.

    I needed a way to gather the data from each DVR and tag it with a label so I could then import it into Excel for sorting. This can be done by appending each string received with a deliumeter character then a reference.

    I thought about it and immediately knew a Prop could do it and I'd been looking at the modified full duplex serial that can handle four ports in once cog by Tim Moore. Anyway long story short I'd had a few problems implementing it and was spoke to Baggers about it and he came up with the idea of doing a bespoke app.

    Now this is the good part, in the space of a few hours (and I really mean a few hours) we had a framework up and running, Baggers writing the code, me setting up the hardware, testing and debugging all done on the fly.

    The only reason it took as long as it did was because real life got in the way lol

    Anyway we finished the code on Saturday afternoon and I spent Sunday making up the PCB. Final tests were done this morning when I connected them to the DVR's.

    Now name me another micro that you could have done this so quickly with?

    Or anybody that can code as fast as Baggers for that matter lol

    Thanks Jim, you are a star!

    Regards,

    Coley
  • LeonLeon Posts: 7,620
    edited 2010-09-20 06:49
    It could have been done quicker on the other chip, perhaps. Existing UART code would simply be run in parallel.
  • BaggersBaggers Posts: 3,019
    edited 2010-09-20 07:07
    No worries Coley, Glad to help out!

    Leon :( I'm disappointed! you just couldn't resist could you?
  • Cluso99Cluso99 Posts: 18,069
    edited 2010-09-20 07:07
    Thanks for the info baggers. It is a perfect app for the prop, that's for sure. And you can have two of those in the one prop.

    With one of the spare cogs you could use 1pin and a resistor for 1pin mono TV out to display what is being sent out the port. Of course it may be too fast to see the data.

    These are the things that we appreciate in the prop. We don't have to go and look through all the pic chips (or whatever) family to find a chip with 5 UARTs (well we could do it with 4) and then set about coding it.
  • BaggersBaggers Posts: 3,019
    edited 2010-09-20 07:13
    Cluso99, you said it there, we don't have to go find a chip that can, like looking for a needle in a haystack, we have it here :D always ready to jump and I mean jump at whatever you throw it ( within reason obviously ), and do a bloody good job of it too.
    there isn't a PIC that comes anywhere close to be as good at just about everything :D
  • LeonLeon Posts: 7,620
    edited 2010-09-20 07:14
    My UART is only 20 lines of code!
  • BaggersBaggers Posts: 3,019
    edited 2010-09-20 07:18
    Is that 20 lines of C or ASM?

    I can do it for the prop in 25 lines for RX+TX in PASM
  • jazzedjazzed Posts: 11,803
    edited 2010-09-20 07:26
    Baggers wrote: »
    I thought I'd share this with you guys as I thought you'd appreciate it! :)
    Nice story :)
  • LeonLeon Posts: 7,620
    edited 2010-09-20 07:29
    XC, so that it can be used in parallel if necessary. It could be done in assembler, of course, but there isn't much point.
  • Bill HenningBill Henning Posts: 6,445
    edited 2010-09-20 07:32
    Thanks for sharing - that is a nice application for the Prop!

    I am curious - Coley mentions a problem with the quad serial object in a later posting - could you or Coley elaborate on what the problem was?
    Baggers wrote: »
    Hi All,

    I thought I'd share this with you guys as I thought you'd appreciate it! :)

    On Friday, a friend of mine, asked me to write an app to help him out, in which he had 10 serial ports all receiving data, and then having to be fed through a single port! Now to us propheads, it's yeah dead easy, but when you think about it, there's hardly another microcontroller out there that could do the job, Pic, nope, Arm, not without a LOT of messing! AVR, nope, ( OH and Leon, you're permission to quote your favourite on this thread, is denied, we all know already! lol ), but anyway, for the Prop it was a piece of cake, I wrote a 5 port reader in one cog, used it in two cogs, to read into 10*1K buffers, then had another cog scan those buffers for full lines ( ie check for carriage returns ) which then sent them to an 8K buffer for TX which was the fourth cog, leaving 4 cogs idle, proving the prop could handle it without breaking into a sweat, ( something Leon's couldn't do, as that breaks into a sweat just turning on! :D )

    Anyway, this is and other industry grade app win for the prop!

    Thanks for reading!
    Baggers.
  • BaggersBaggers Posts: 3,019
    edited 2010-09-20 07:54
    Leon, how many lines would it be in Assembler?
    and if done in parallel, can you get 10 ports? how many threads can you have running?
    using this method, we can have 30 ports/threads on the prop, plus the cog/thread supporting the ports for lines, and could have 5 tx ports +

    jazzed, thanks, it was only a nice story, because the prop lends it's hands at everything, and is so quick and nice to code on.

    Bill, Coley will give you better details on that, as it was before he talked to me about it.
  • edited 2010-09-20 08:00
    Hi PropGFX guys, great work and thanks for sharing this. I have a feeling this is a thread people will be searching for in the future :) Any chance of a pic of the PCB?
    cheers
    TonyF
  • BaggersBaggers Posts: 3,019
    edited 2010-09-20 08:03
    Hi Tony, I'm sure Coley will once he gets to a PC :D
  • T ChapT Chap Posts: 4,224
    edited 2010-09-20 08:10
    Well as far as design time, it could have been even shorter had you used the 4port object. Obviously less fun to go that route though. But how fast would the project have taken if you didn't have to write the 5 port if the 4port had of worked?
  • jazzedjazzed Posts: 11,803
    edited 2010-09-20 08:12
    Baggers wrote: »
    using this method, we can have 30 ports/threads on the prop
    Almost 30 on one stand-alone Propeller :)

    Yes, it's a good application for propeller - I designed a 4 port concentrator a few years ago.
  • LeonLeon Posts: 7,620
    edited 2010-09-20 08:25
    Baggers wrote: »
    Leon, how many lines would it be in Assembler?
    and if done in parallel, can you get 10 ports? how many threads can you have running?
    using this method, we can have 30 ports/threads on the prop, plus the cog/thread supporting the ports for lines, and could have 5 tx ports +

    I'm not sure, probably about the same as for the Propeller. Assembler isn't used much, of course.

    Eight 50 MIPS hardware threads per core are available, and it should be possible to put several UARTs into each thread. They look like separate processors to the programmer. 64 I/Os are available, per core.
  • potatoheadpotatohead Posts: 10,261
    edited 2010-09-20 08:28
    Yeah? What about PCB design for that beastie?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-20 08:38
    This is a perfect example of why the Prop and software peripherals rule. What chip manufacturer would put ten hardware UARTs in one micro? But the Prop handled it with ease and the development was quick.

    The Perl 5 programming language has a slogan: "It makes the easy things easy and he hard things possible. Perl 6 goes one better: "It makes the easy things trivial, the hard things easy, and the impossible things merely hard." The Propeller, OTOH, makes the impossible things (for other micros) easy.

    Thanks, Baggers, for sharing your experience. It would make a great case study for Propeller marketing!

    -Phil
  • BaggersBaggers Posts: 3,019
    edited 2010-09-20 08:40
    Glad you're all appreciating it, which is why I decided to post the story in the first place :)

    Edit: I like this quote!
    The Propeller, OTOH, makes the impossible things (for other micros) easy.
  • BaggersBaggers Posts: 3,019
    edited 2010-09-20 08:52
    TChap, I could have done it quicker using the 4 port object, but Coley said he wasn't sure how to get three copies of it working, so because prop is fast to program I decided to do it from scratch :D but yeah it would have been faster still without going from scratch.

    jazzed, yeah 30 serial ports on one prop :D who'd have thought? lol

    Leon, I bet it wouldn't have been anywhere near as nice and tidy to program though!
  • LeonLeon Posts: 7,620
    edited 2010-09-20 09:13
    I don't think there is much in it - one has to be programmed in assembler for an application like that, the other can be programmed in parallel C.
  • blittledblittled Posts: 681
    edited 2010-09-20 09:31
    The closest micro controller I can find that may be able to handle mutiple serial ports is the Tiny Tiger with 8 software ports BUT they warn you that using the software ports puts a strain on the RTOS :) Also the FEZ Domino has 4 hardware ports you can access so the Propeller still wins hands down.
  • LeonLeon Posts: 7,620
    edited 2010-09-20 09:38
    The Atmel Xmega A1 chips have eight hardware UARTS.
  • TimmooreTimmoore Posts: 1,031
    edited 2010-09-20 09:45
    Running multiplex copies of the 4 port object is possible but fiddly. Because of the way it shares all the variables in DAT you can't just include it 3x as normal. You copy the file to another name and change the version variable that is in the object for this reason. Then include each version of the file once - takes more memory that way but it was really targeted for the 4 port case and I wanted to access the ports from any object just by including the object in another object. What I do to save memory is to reuse the hub memory once the cog is loaded.
  • jazzedjazzed Posts: 11,803
    edited 2010-09-20 09:48
    Baggers wrote: »
    jazzed, yeah 30 serial ports on one prop :D who'd have thought? lol
    At least one of those ports is unreliable under certain conditions of which you are surely aware unless you have added special sauce.

    If you don't mind giving up your console and having one input unavailable on startup, recycling the EEPROM SCL pin is possible by forcing the SDA pin high from inside the Propeller after bootup. This allows 30 input pins and 1 output pin.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-20 09:48
    Leon wrote: »
    The Atmel Xmega A1 chips have eight hardware UARTS.
    and a hundred pins (!), to which the U(S)ART ports are statically assigned. Anther nice feature of the Propeller, when doing a board layout, is that you can assign pins for ease of routing and edit your program for that selection after the fact.

    -Phil
Sign In or Register to comment.