Download pptx

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Reactive programming wikipedia , lookup

Structured programming wikipedia , lookup

ILLIAC IV wikipedia , lookup

Supercomputer wikipedia , lookup

Multi-core processor wikipedia , lookup

Stream processing wikipedia , lookup

Supercomputer architecture wikipedia , lookup

Parallel computing wikipedia , lookup

Transcript
EECS 473
Advanced Embedded Systems
Bonus lecture
Bootloaders, processors vs FPGAs, and
PCB wiring issues.
Bootloaders
• One thing that we haven’t covered in class is
how to program a new chip.
– Development boards, such as the Arduino, allow
you to program the processor.
– Most processors have a mechanism for
programming the chip
Default programming method
• Processors need to have some kind of default
programming method. Many work hard to
make it difficult to enter programming mode
on accident
– That would be an ugly failure mode.
PIC18 example
• Drive the MCLR pin with the programming
voltage (generally 13V)
• Program using clock and data (PGC and PGD)
• There is also a low
voltage programming
mode on some PICS
– Can use 5V to program.
• Wastes pin, why?
– Or clock a special 32-bit
pattern via PGC/PGD to enter
programming mode
http://www.best-microcontroller-projects.com/pic-icsp.html
JTAG programming
• JTAG was originally a port that
could be used to do “boundary
checking”.
– That is, checking to see if the PCB
connections between devices were
correct.
– Could walk each pin and see if it
was connected to what it was
supposed to be connected to.
JTAG continued
• Could even use JTAG to test connections between devices.
– Darn handy automatic way of looking for wiring errors
(bridges, etc.)
• Pretty good overview (which seems largely correct and is
well written) at http://blog.senr.io/blog/jtag-explained
– Though it’s largely about hacking a device via jtag.
A lot of devices allow you to program
them via the JTAG port
• Not much to add other than each device tends to
be a bit different.
– TI has a nice document here:
• http://www.ti.com/lit/ug/slau320x/slau320x.pdf
– FPGAs also often are programmed via the JTAG port.
• http://microblog.routed.net/wpcontent/uploads/2006/11/xilinx-jtag.pdf
• Exact scheme and information tends to vary
wildly by manufacturer and often by
processor/FPGA family.
– Basically opens up a programming/debugging window
to the hardware.
How else can you program a device?
• Well, you could program the device once with
a program that waits for data input on reset.
– If it sees the data, it programs the chip with said
data.
– If not, it just runs whatever program it has.
• Called a bootloader.
Bootloader overview
• Bootloaders are
fairly simple
– Generally wait for
input on some serial
port
– If no input, timeout
and jump to
application
– Otherwise program
chip with incoming
data.
http://www.microchip.com/stellent/groups/sitecomm_sg/documents/devicedoc/en558478.pdf
Some bootloaders are very complex
• Intel has a whole set of bootloader development
kits.
– Lots of components to turn on.
– Lots of configurations to walk through
• In part due to backwards compatibility of x86.
– The “minimal bootloader” documentation is 25 pages
long and discusses:
• Reset vector handling, preparation for memory initialization,
memory initialization, post memory initialization, interrupt
enabling, processor intterup modes, timers, caching, I/O
devices, and more.
https://www.cs.cmu.edu/~410/doc/minimal_boot.pdf
http://www.intel.com/content/www/us/en/intelligent-systems/intel-boot-loader-development-kit/intel-bldkinitialization-firmware-development-solutions-toolkit.html
Moral of the story
• When designing a PCB, you need to be sure
you can program your chip.
– In some cases it makes sense to program the chip
with a bootloader before you solder it.
– In some cases you need special programmers.
• SPL has PIC and Atmel programmers.
• Often require special voltages or other magic.
An overview of embedded
processors
Microcontrollers, DSPs,
System-on-a-chip (SoP), ASICs
and more
Processing unit overview
Where to start?
• When designing an embedded system, one key question is:
– “What processor should I use?”
• Obviously the answer depends on a massive number of
factors.
– CPU computational power needed
• And even the type of computational power needed
–
–
–
–
Interfaces needed
Cost
Power
Expected design time
• Debug capabilities
• Current familiarity with tools
– Etc.
Processing unit overview
Highest level:
ASIC, off-the-shelf processor, FPGA
• These three categories are pretty straightforward and
mostly non-overlapping.
– An ASIC is an Application Specific Integrated Circuit.
• You are “spinning” a chip designed specifically for your application.
• Manufacturing costs are a bit difficult to figure out
– MOSIS would charge $10,000 for an extremely small chip (40 chips, 1
square mm each) in a very large (700nm) process.
– I’ve seen groups pay prices of $50K for a couple of larger ARM-based
chips.
– Design costs are yet more.
» I know one company spending “high single-digit millions” for the
design and manufacture of a few thousand chips
» Of which they will probably only use a few hundred.
– So:
• Pros?
• Cons?
ASIC
ASIC
• Not a lot to say here, each case is, by definition,
different.
– A lot of embedded systems work is with ASICs these days.
• The (vast?) majority of cell phones use in-house designed
processors, 95%+ of which are ARM based.
• The iPad uses an ASIC.
• What’s interesting is how design costs generally dominate over the
one-off mask costs
– Not that mask costs aren’t a major factor.
– You really want to avoid respins…
– If you have a large market, need decent performance and
are highly power constrained
• ASIC is clearly the way to go.
Processing unit overview
Highest level:
ASIC, off-the-shelf processor, FPGA
• An off-the-shelf processor is one that has
been manufactured by someone else.
– This doesn’t mean that the processor isn’t highly
specialized.
• There are chips designed just for printers for example
– the HP Unity is MIPs based, ½ GHz, ½ Gbyte standard
– Pros?
– Cons?
Processing unit overview
Highest level:
ASIC, off-the-shelf processor, FPGA
• You all know what an FPGA is.
– But when would you choose to use one in an
embedded system?
– Even if it isn’t in your embedded system, why else
might an FPGA be helpful to embedded system
designers?
– Pros?
– Cons?
FPGA
FPGA
• There can be quite a bit of feature difference
between the different FPGA choices.
– You can find FPGAs for as little as $10 and as much
as $3000.
– Some use non-volatile memory, others need
external help on power-up.
Processing unit overview
But at this high level, things are fuzzy
• Sometimes an FPGA
and off-the-shelf
processor are
integrated.
– Actel in 373
– Cypress Semiconductor
• Their fabric is generally a
bit less flexible than an
FPGA, but easier to work
with.
• And many ASICs are
based on standard “offthe-shelf” architectures
– ARM being the most
common these days
• MIPS was similar at one
point.
Off-the-shelf
What device options are there?
– For example, what’s the
difference between a
microprocessor, a
microcontroller and a
System-on-a-Chip (SoC)?
SoC
More peripherals and
interface capability
• One fun part about this
is that there are a
number of terms used
to describe the options,
but they aren’t very
well defined.
Micocontroller
Processor
• It’s really not clear
– One axis is that a SoC is
expected to have a
richer set of peripheral
interface capability
Off-the-shelf
However the terms also carry other
connotations
– And correspondingly, the
microcontroller is
expected to have lower
power needs.
Processor
CPU-capability
• For example, in the
“CPU-capability” axis
microcontrollers are
generally thought of as
being very limited,
generally in the 1-30
MIPs range.
SoC
Micocontroller
• So keep in mind that
terms aren’t always
well-defined!
Off-the-shelf
So…
• While those terms (SoC, Microcontroller,
Processor) are commonly used
– They aren’t all that well-defined.
• None-the-less, we are stuck with them
– So let’s explore a bit…
Off-the-shelf
Microcontroller
• The AVR processor is an example of a
microcontroller
– Flash, SRAM, EEPROM
– 6-30 GPIOs
– 4-20MHz
– Basic serial I/O capability
Off-the-shelf
Example SoC:
Cypress PSoC 3: CY8C38
Off-the-shelf
Example SoC: Cypress
• It looks similar to the AVR processor
– A bit faster for sure, but when you are advertising
multiply and divide…
– Power:
• How long would a 2000mAh battery be able to keep this
thing running?
• But it’s peripherals are much more significant.
– 68 GPIOs,
– Highly configurable on the fly. Can have:
• Built-in hardware blocks for FIR/IIR filters @67MHz
• Has 4 built-in op-amps (less parts on board)
• Can directly interface to a capacitive touch screen
Off-the-shelf
Just the analog…
Off-the-shelf
Processor
• When people discuss processors they often
mean something like a desktop CPU.
– Power in the 20-200W range for example, but
speeds in the 2-3 GHz range.
• However there are things like the Atom core
(which, Intel markets as a SoC…)
Off-the-shelf
Intel Atom
What looks different?
Off-the-shelf
What type of specialized off-the-shelf
processors are there?
• Generally speaking, you are looking at either
– CPU instructions and features focused on
improving performance on a specific type of
application
• DSP and encryption both have very specific needs.
– Specialized I/O.
• So CAN bus (standard automotive shared serial bus)
• Capacitive touch screen interfaces
A bit on power
• There are a lot of things we could talk about
with respect to power issues.
– Easiest to screw up are probably ground issues
• We think of “ground being ground” but wires on our
board that claim to be ground aren’t exactly at the
battery/Power supply ground.
• Further, EMI/EMC issues can exist.
Care with grounding
• Return paths.
– Ground isn’t ground.
• This is an important rule.
– Say that “A” is a processor
3.3V@100mA and “B” is a
motor 12V@10A.
• Say that the wire between A and the
power supply has a resistance of .05Ω
(1 oz/ft2, 20 mil, 2 inch)
• What is the voltage at A’s ground?
3.3V
0.1A
0.05Ω
12V
10A
Ground loops
• Basic theme:
– Use a ground plane.
– Be sure the plane runs under any high-speed
signals.
– If you can’t use a ground plane, be sure your high
speed signals have a return (ground) wire right
underneath them.
– Nice 3 page paper at
http://www.ultracad.com/articles/loop.pdf