12.07.2015 Views

The Circuit Designer's Companion - diagramas.diagram...

The Circuit Designer's Companion - diagramas.diagram...

The Circuit Designer's Companion - diagramas.diagram...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Digital circuits 223InterruptsFor similar reasons to those outlined above, it is preferable not to rely on edge-sensitiveinterrupt inputs. Such an interrupt can be set by a noise spike as readily as by its propersignal. Undoubtedly edge-sensitive interrupts are necessary in some applications, butin these cases you should treat them in the same way as clock inputs to latches or flipflopsand take extra precautions in layout and drive impedance to minimise their noisesusceptibility. If you have a choice in the design implementation, then favour a levelsensitiveinterrupt input.6.5.2 Data and memory protectionVolatile memory (RAM, as distinct from ROM or EEPROM) is susceptible to variousforms of data corruption. <strong>The</strong>se vary from “soft” errors due to cosmic radiationparticles, to unintentional write accesses in severe noise environments. You cannotprevent such corruption absolutely, but you can in some cases guard against itsconsequences.If you place critical data in tables in RAM, each table can then be protected by achecksum, which is stored with the table. Checksum-checking diagnostics can be runby the background routine automatically at whatever interval is deemed necessary tocatch RAM corruption, and an error can be flagged or a software reset can be generatedas required. <strong>The</strong> absolute values of RAM data do not need to be known provided thatthe checksum is recalculated every time a table is modified. Beware that the diagnosticroutine is not interrupted by a genuine table modification or vice versa, or errors willstart appearing from nowhere! Of course, the actual partitioning of data into tables is acritical system design decision, as it will affect the overall robustness of the system.Data communication<strong>The</strong> subject of data comms has a literature all to itself. <strong>The</strong> communication of digitaldata over long distances is prone to corruption in a statistically predictable way, andgreat effort has been expended to develop techniques to combat this corruption. <strong>The</strong>setechniques range from simple parity checks on individual bytes through to sophisticatederror detection and correction algorithms on large data blocks. This is not the place fora review of such methods. Many of the protocols mentioned in the standards of section6.2.6 include them. All that can be said here is that when your products use longdistancedata communication, your software should incorporate some form of errordetection on the received data to be at all reliable.Unused program memoryOne of the threats discussed in the section on watchdogs was the possibility of themicroprocessor accessing unused memory space due to corruption of its programcounter. If it does this, it will interpret whatever data it finds as a program instruction.In such circumstances it would be useful if this action had a predictable outcome.Normally a bus access to a non-existent address returns the data #FF H , providedthere is a passive pull-up on the bus, as is normal practice. Nothing can be done aboutthis. However, unprogrammed ROM also returns #FF H and this can be changed. Agood approach is to convert all unused #FF H locations to the processor’s one-byte NOP(no operation) instruction (Figure 6.36). <strong>The</strong> last few locations in ROM can beprogrammed with a JMP RESET instruction, normally three bytes, which will have theeffect of resetting the processor. <strong>The</strong>n, if the processor is corrupted and accessesanywhere in unused memory, it finds a string of NOP instructions and executes these

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!