EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Entering the embedded world... help?

Started by ScottM February 23, 2006
OK, the subject isn't quite accurate. I've been hacking around with
Parallax Javelin processors and Basic stamps for a few years, and I
used a pair of Javelins to automate a home theater. The problem is the
implemtation was 1) a hack and 2) not entirely stable. Unstable home
theaters are annoying.

So I'd like to do it over, but I've got large areas of ignorance and
concerns, and I'm looking for guidance.

First off, what's a good processor?

I need a lot of I/O. I need an interface to 10/100mb ethernet, able to
handle TCP or at least UDP; I need at least 1 and ideally 4 buffered
RS-232 ports, and I have about 32 logic inputs (which I've multiplexed
down, because I don't need to see them all simultaneously or at
incredibly high speeds) and about 20 outputs. Some of the outputs are
candidates for being controlled in interrupts routines at a fairly high
rate (~500/sec); I'm doing 4 channels of PWM to drive 4 dimmer
channels, and would rather have more. I'd also like to do a few
channels of tone generation, which right now I"m doing with 555's and
would rather have in the processor. (So maybe I need an interrupt rate
more like 2000/sec, to get a decent range of possible tones.)

I don't need a lot of speed, but I'd like to run faster than the
embedded Java I'm uising now. I don't think I need a lot of memory,
either. I don't need floating point, but I'd kind of like 32 bit
integers.

I need something sturdy. The Javelin processor can sink and source a
few mA on each pin; by all accounts if you try that with a more typical
PIC, smoke comes out. I'm comfortable with using optoisolators to keep
my 12v input signals from cooking processors, but I worry about output
pins providing enough power to trigger devices. If I want to drive a
darlington pair on and off, how do I know how big a resistor to put
between the output pin and the input of the darlington?

I'd like to code in C++ or C, but I can learn assemblers. Coding is not
a problem for me; blowing up hardware occasionally is. Because I like
coding and coding is what I do, I want to do as much as possible in
software and have as few external components as possible. (Parts can
burn out, come loose or change tolerances; but working code is a thing
of beauty forever.)

Etching circuit boards isn't an option, so I need to build on a
breadboard.

I have a 5v/12v power supply that I'd like to use. It all has to run
SILENTLY; I can't use a fan.

It has to run for years in a trouble free fashion; it will be a
permanent part of my house.

Oh, yeah - cheap hardware and free tools would be a big help. I went
with the parallax javelin because they cost $89, and if you blow one
up, you slap yourself hard and buy another one. I don't want to do that
with $250 hardware, which I'm locked into using because of a $750 tool
set.

I suspect I'm asking for the world here... are there any good
candidates for this kind of thing? And what books should I be reading?

Thanks.

ScottM wrote:

> OK, the subject isn't quite accurate. I've been hacking around with > Parallax Javelin processors and Basic stamps for a few years, and I > used a pair of Javelins to automate a home theater. The problem is the > implemtation was 1) a hack and 2) not entirely stable. Unstable home > theaters are annoying. > > So I'd like to do it over, but I've got large areas of ignorance and > concerns, and I'm looking for guidance. > > First off, what's a good processor?
Why does _everyone_ ask that. There's gazillions to choose from.
> > I need a lot of I/O. I need an interface to 10/100mb ethernet, able to > handle TCP or at least UDP; I need at least 1 and ideally 4 buffered > RS-232 ports, and I have about 32 logic inputs (which I've multiplexed > down, because I don't need to see them all simultaneously or at > incredibly high speeds) and about 20 outputs. Some of the outputs are > candidates for being controlled in interrupts routines at a fairly high > rate (~500/sec); I'm doing 4 channels of PWM to drive 4 dimmer > channels, and would rather have more. I'd also like to do a few > channels of tone generation, which right now I"m doing with 555's and > would rather have in the processor. (So maybe I need an interrupt rate > more like 2000/sec, to get a decent range of possible tones.)
You may be better driving your PWM outputs from a processor that has PWM hardware. Are you driving SCRs directly (i.e. do you need to synchronize with the power line) or are you just PWMing for DC? For tones you can either use the PWM outputs or you could drive a DAC (to get nicer tones). Either way you're not going to get much complexity from 2000Hz.
> > I don't need a lot of speed, but I'd like to run faster than the > embedded Java I'm uising now. I don't think I need a lot of memory, > either. I don't need floating point, but I'd kind of like 32 bit > integers.
Almost anything compiled will run faster than almost anything interpreted. You'll have to run benchmarks to make sure, though. If you use an ANSI compliant compiler you're guaranteed a 32 bit integer by using 'long int'.
> > I need something sturdy. The Javelin processor can sink and source a > few mA on each pin; by all accounts if you try that with a more typical > PIC, smoke comes out. I'm comfortable with using optoisolators to keep > my 12v input signals from cooking processors, but I worry about output > pins providing enough power to trigger devices. If I want to drive a > darlington pair on and off, how do I know how big a resistor to put > between the output pin and the input of the darlington?
You can get drivers to go on your output pins if you choose a processor with wimpy drive electronics.
> > I'd like to code in C++ or C, but I can learn assemblers. Coding is not > a problem for me; blowing up hardware occasionally is. Because I like > coding and coding is what I do, I want to do as much as possible in > software and have as few external components as possible. (Parts can > burn out, come loose or change tolerances; but working code is a thing > of beauty forever.)
Most everyone uses C or C++ these days.
> > Etching circuit boards isn't an option, so I need to build on a > breadboard.
I would suggest that you get a processor board then, and just breadboard your peripheral stuff.
> > I have a 5v/12v power supply that I'd like to use. It all has to run > SILENTLY; I can't use a fan. > > It has to run for years in a trouble free fashion; it will be a > permanent part of my house. > > Oh, yeah - cheap hardware and free tools would be a big help. I went > with the parallax javelin because they cost $89, and if you blow one > up, you slap yourself hard and buy another one. I don't want to do that > with $250 hardware, which I'm locked into using because of a $750 tool > set.
Greedy.
> > I suspect I'm asking for the world here... are there any good > candidates for this kind of thing? And what books should I be reading? > > Thanks. >
Subscribe to Circuit Cellar magazine. Consider using a PC-104 stack -- the hardware is more expensive but it'll look just like a PC to your tools. You can choose to run DOS, Linux or (ick Windows). -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/
>> First off, what's a good processor?
>Why does _everyone_ ask that. There's gazillions to choose from.
I ask because there's a gazillion of them, and I'm ignorant. The Javelin looked good to me, until I ran out of both speed and pins. So I ended up with 2, and a fiddly protocol between them, and sucking more power than I expected, which made things unstable, so I ended up with a PC's power supply just to keep things happy... I made a bad choice at the outset and it cost me days of work and plenty of dolalrs. Ignorance is expensive.
>For tones you can either use the PWM outputs or you could drive a DAC
(to get nicer tones). Either way you're not going to get much complexity from 2000Hz. My needs are minimal, and it'll be better than the current 555's, whose options are beep or silent. Given my desire to minimise external components (I'm a software guy: I loathe hardware), I'm willing to keep to simple tones, to keep the external part trivial (a ULN2003 driving a speaker is what I use now).
>I would suggest that you get a processor board then, and just breadboard
your peripheral stuff. Sounds good. What's a clever choice? I'll look at the PC-104, but I was having trouble finding ethernet support and multiple serial ports for cheap...
ScottM wrote:
> OK, the subject isn't quite accurate. I've been hacking around with > Parallax Javelin processors and Basic stamps for a few years, and I > used a pair of Javelins to automate a home theater. The problem is the > implemtation was 1) a hack and 2) not entirely stable. Unstable home > theaters are annoying. > > So I'd like to do it over, but I've got large areas of ignorance and > concerns, and I'm looking for guidance. > > First off, what's a good processor? > > I need a lot of I/O. I need an interface to 10/100mb ethernet, able to > handle TCP or at least UDP; I need at least 1 and ideally 4 buffered > RS-232 ports, and I have about 32 logic inputs (which I've multiplexed > down, because I don't need to see them all simultaneously or at > incredibly high speeds) and about 20 outputs. Some of the outputs are > candidates for being controlled in interrupts routines at a fairly high > rate (~500/sec); I'm doing 4 channels of PWM to drive 4 dimmer > channels, and would rather have more. I'd also like to do a few > channels of tone generation, which right now I"m doing with 555's and > would rather have in the processor. (So maybe I need an interrupt rate > more like 2000/sec, to get a decent range of possible tones.)
As Tim pointed out there are a lot of good MCU's. What I suggest is to pick up datasheets and read them and then decide. This way you can find the MCU that shines where you need it to shine in your application.
> I don't need a lot of speed, but I'd like to run faster than the > embedded Java I'm uising now. I don't think I need a lot of memory, > either. I don't need floating point, but I'd kind of like 32 bit > integers.
If this is the case, you may be limitied to a 32-bit MCU (ARM). These are fairly cheap and by the looks of it may be the best choice.
> I need something sturdy. The Javelin processor can sink and source a > few mA on each pin; by all accounts if you try that with a more typical > PIC, smoke comes out. I'm comfortable with using optoisolators to keep > my 12v input signals from cooking processors, but I worry about output > pins providing enough power to trigger devices. If I want to drive a > darlington pair on and off, how do I know how big a resistor to put > between the output pin and the input of the darlington?
If I recall correctly PIC's can sink or souce close to 25mA on each pin. Definitely more than the Javelin you posted.
> I'd like to code in C++ or C, but I can learn assemblers. Coding is not > a problem for me; blowing up hardware occasionally is. Because I like > coding and coding is what I do, I want to do as much as possible in > software and have as few external components as possible. (Parts can > burn out, come loose or change tolerances; but working code is a thing > of beauty forever.)
>From a business perspective where time is money, C is used. But you can
code in assembly as a learning experience. You do gain an insight and gain more respect for the work that compilers do.
> Etching circuit boards isn't an option, so I need to build on a > breadboard. > > I have a 5v/12v power supply that I'd like to use. It all has to run > SILENTLY; I can't use a fan.
If you are using 7805 or 7812 and a decent supply of AC bypass caps I believe most of them can supply up to 1A of current (of course if you hit this, you will need cooling for sure). Of course you won't need to use active only passive cooling (heatsinks). If you need more than that, then you will need pretty BIG heatsinks.
> It has to run for years in a trouble free fashion; it will be a > permanent part of my house. > > Oh, yeah - cheap hardware and free tools would be a big help. I went > with the parallax javelin because they cost $89, and if you blow one > up, you slap yourself hard and buy another one. I don't want to do that > with $250 hardware, which I'm locked into using because of a $750 tool > set.
You paid that much for an MCU?! $89 is a lot of dough, you can buy like 20 PIC's and low end ARM's using single unit prices with that cash. Heck, I can buy myself a PSP game for that price :)
> I suspect I'm asking for the world here... are there any good > candidates for this kind of thing? And what books should I be reading? > > Thanks.
Books are a good help, but I prefer to learn by experimentation. I believe you learn a lot more this way. Grab a devkit for the PIC/ARM or whatever MCU your using and code away. As a side note, if you have a gameboy advance and a flash cart you can use that to program the GBA's CPU (ARM7TDMI at 16.777Mhz). That is what I have and plan to use it to experiment more with ARM chips.
"ScottM" <scott@mayo.name> wrote in message 
news:1140732036.030582.48310@p10g2000cwp.googlegroups.com...
>>I would suggest that you get a processor board then, and just breadboard > your peripheral stuff. > > Sounds good. What's a clever choice? I'll look at the PC-104, but I was > having trouble finding ethernet support and multiple serial ports for > cheap...
Maybe take a look at the Rabbit family - they have ethernet and upto about 6 serial ports, IIRC. And they're cheap, as are the dev tools. (This is my second plug for Rabbits recently. I have no connection other than as a happy customer.) Re interfacing etc: *the* book to get is Horowitz and Hill, "The Art of Electronics". Indispensable, and a very approachable primer for a code-monkey ;). Steve http://www.fivetrees.com
ScottM wrote:

>>>First off, what's a good processor? > > >>Why does _everyone_ ask that. There's gazillions to choose from. > > > I ask because there's a gazillion of them, and I'm ignorant. The > Javelin looked good to me, until I ran out of both speed and pins. So I > ended up with 2, and a fiddly protocol between them, and sucking more > power than I expected, which made things unstable, so I ended up with a > PC's power supply just to keep things happy... I made a bad choice at > the outset and it cost me days of work and plenty of dolalrs. Ignorance > is expensive. > > >>For tones you can either use the PWM outputs or you could drive a DAC > > (to get nicer tones). Either way you're not going to get much > complexity from 2000Hz. > > My needs are minimal, and it'll be better than the current 555's, whose > options are beep or silent. Given my desire to minimise external > components (I'm a software guy: I loathe hardware), I'm willing to keep > to simple tones, to keep the external part trivial (a ULN2003 driving a > speaker is what I use now). > > >>I would suggest that you get a processor board then, and just breadboard > > your peripheral stuff. > > Sounds good. What's a clever choice? I'll look at the PC-104, but I was > having trouble finding ethernet support and multiple serial ports for > cheap... >
Yea, "cheap" and "PC-104" don't go together real well. That's part of the reason I was suggesting Circuit Cellar -- for the ads in the back. I have yet to use anyone's pre-made processor board; everything I do somehow ends up being full-custom. For processors it's easy: once you choose 8/16/32 bit you've narrowed it down to 5 manufacturers or so, then you start looking at speed, tools and on-board peripherals. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/
ScottM wrote:
>>>First off, what's a good processor? > > >>Why does _everyone_ ask that. There's gazillions to choose from. > > > I ask because there's a gazillion of them, and I'm ignorant. The > Javelin looked good to me, until I ran out of both speed and pins. So I > ended up with 2, and a fiddly protocol between them, and sucking more > power than I expected, which made things unstable, so I ended up with a > PC's power supply just to keep things happy... I made a bad choice at > the outset and it cost me days of work and plenty of dolalrs. Ignorance > is expensive.
Look at the SiliconLabs C8051F330 : Comes in DIP, and with Tools and a OnChip Debugger. Chain them up on the SPI bus, as you need more smarts... You can also get their USB ToolStick, just ~$10 to see if you like their tools and peripherals. -jg
Steve at fivetrees wrote:

> "ScottM" <scott@mayo.name> wrote in message > news:1140732036.030582.48310@p10g2000cwp.googlegroups.com... >
-snip-
> > Re interfacing etc: *the* book to get is Horowitz and Hill, "The Art of > Electronics". Indispensable, and a very approachable primer for a > code-monkey ;). > > Steve > http://www.fivetrees.com > >
"The Art of Designing Embedded Systems" by Ganssle -- http://www.powells.com/biblio/4-0750698691-0. I haven't even touched the book, but I read Ganssle's columns all the time in Embedded Systems Programming. If you have been doing software in an IT context then you need to shift gears somewhat to program for embedded systems. Oh -- and subscribe to Embedded Systems Development (or whatever they're calling themselves now). At least check their website once a month -- their subscription department is _weird_; it can be hard to get copy from them. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/
Tim Wescott wrote:

> > First off, what's a good processor? > > Why does _everyone_ ask that. There's gazillions to choose from.
Different people ask it for different reasons. Almost half of my upcoming book talks about roughly half a dozen different processors, and why those specific chips might be one "correct" answer to the question "which CPU should I learn? [to get into the embedded world]" That's about 60,000 words on the topic, and it's only an introduction.
> > I'd like to code in C++ or C, but I can learn assemblers. Coding is not > > a problem for me; blowing up hardware occasionally is. Because I like > > Most everyone uses C or C++ these days.
I take a bit of exception to the idea that "everyone uses C++", especially in the embedded arena. I guess it's been a few months since this particular chestnut was sizzled on the coals in c.a.e., so maybe we should just cut and paste the last argument thread to save everyone's time. I'm starting to see an approach that approximates sanity with regards to the use of Java in high-end embedded projects, rather than C++ (a language which is abhorred on any architecture by all right-thinking embedded engineers - and of course, only an exceptionally jaded masochist who has lost the phone number of his dominatrix or can no longer afford her dungeon rates would contemplate C++ on an 8-bit micro). If you're prepared to live with the overhead of C++, and you're convinced that there is something to be gained in your application from a language that has OO syntactic elements (like C++) rather than merely OO capability (like C), using Java instead can be a pleasant surprise. Among other advantages of Java over C++, it is occasionally possible to find someone who can answer a Java question both exactly and correctly. Furthermore, positively several Java questions do not have as their "real" answer a 5,000 word argument amongst five language lawyers. No C++ question can be answered without either: a) employing several language lawyers of opposing viewpoints, and/or b) developing a new draft standard defining a version of the language with the desired functionality. Dogma is a wonderful thing, isn't it? In Australian universities, they [used to?] teach a subject called creative accounting. The core of this subject is: Your company bought $X, sold $Y and received $Z over the past year. Your CEO, stockbroker or drug dealer wants the company to show a profit of $F. Obtain this result in a GAAP-compliant way. In the past, I've seen vast practical use for this coursework in terms of justifying (or killing) value engineering projects, obfuscating projected bill-of-materials costs, and demonstrating that a department has met its budgetary goals. But the single most useful fact it taught me is that all metrics not directly derived from underlying measurable physical phenomena are nonsense - and cost/productivity/reliability savings realized by moving to C++ are at the bad end of the spectrum. Moving from assembly to C at a certain [fuzzy] size/complexity point can be justified merely in terms of the number of people that are comfortable programming in the language (though I am quite convinced that there's more gain than merely this one point, and most c.a.e readers would agree with this). Moving to C++ in embedded projects(*) requires justifications that typically end in the words "MY GOD! A MAUVE DOLPHIN ON A BICYCLE IS FLYING PAST THE WINDOW!" (Alt-F4 PowerPoint drivel while everyone looks out the window). "This concludes the presentation; in summary, you should do what I say". (*) Special exceptions apply. These are mostly ludicrous, e.g. designing a project that is not a PDA around Windows CE.
larwe wrote:
> Tim Wescott wrote: > > > > First off, what's a good processor? > > > > Why does _everyone_ ask that. There's gazillions to choose from. > > Different people ask it for different reasons. Almost half of my > upcoming book talks about roughly half a dozen different processors, > and why those specific chips might be one "correct" answer to the > question "which CPU should I learn? [to get into the embedded world]" > That's about 60,000 words on the topic, and it's only an introduction.
Hey you are currently drafting a book?!? Please let me know of the title and does your publisher have any plans of releasing the book in Canada? -Isaac

The 2024 Embedded Online Conference