Posts Tagged ‘copy dsp cpld source code’

PostHeaderIcon Copy DSP and CPLD Firmware: Two Valid Files, One Broken System

A copy operation on a mixed board has a seductive logic to it. Read the DSP, read the CPLD, write both into blank parts, verify, done. Every step is verifiable and every verification passes. Then the board fails to boot, or boots and misbehaves on the bus, and the failure is blamed on whichever device was copied second.

The problem is that neither file contains the thing that broke. What broke is a timing relationship: the number of wait states the DSP inserts, against the delay the CPLD’s decode actually presents. Both values are properties of the pair. Copying each device faithfully preserves each device’s contribution and can still change the relationship, because the relationship depends on silicon parameters that are not in the configuration.

Where the relationship is hidden

Element Lives in Preserved by a copy
Wait state count DSP code, as a constant Yes
Decode propagation delay CPLD silicon and fit No; depends on the physical part
Bus clock frequency DSP clock configuration Yes
CPLD clock source Board, or DSP output Not if the source changed
Setup and hold at the pins Board and both devices No

The second row is the one that surprises people. Two CPLDs programmed with identical fuse maps can present different decode delays, because propagation delay varies with speed grade, temperature, and the particular die. A design that was closed with a comfortable margin will tolerate that variation; one that was closed tightly will not, and the copy is where the tightness becomes visible.

Why the DSP is usually the one that fails

When the bus misbehaves, the DSP is usually the device that reports the problem, because it is the one that samples data. A CPLD that asserts a chip select slightly late produces a DSP that reads stale data, and stale data in a boot sequence is a hang.

Symptom Likely cause
Hang on the first external access Chip select not asserted before the DSP samples
Intermittent wrong data at boot Marginal setup time on the data bus
Boot succeeds but a peripheral misconfigures Write strobe too short
Failure only when cold Delay longer at low temperature
Failure only at high supply Delay shorter, hold time violated

The fourth and fifth rows are diagnostic: a failure that depends on temperature or supply is a timing margin problem, not a logic error, and no amount of re-reading the files will find it. It requires a scope on the bus at the failing condition.

What “verified” should mean

The verification protocol for a mixed copy has to test the interface, not the devices.

Level Test Catches
1 Read back each device Programming errors
2 Boot a blank pair on a current-limited supply Gross logic errors
3 Capture the bus during boot Timing violations
4 Repeat boots across temperature and supply Margin
5 Full functional test with the real peripherals Everything else

Level two is where most projects stop, and it is not enough. A board that boots once has demonstrated that the margins happened to be sufficient on that occasion, at that temperature, with that particular pair of parts.

Coping with a tight original

If the original design was already marginal, a copy will be marginal in a different direction, and the fix is usually not in the devices. It is in the board or in the boot sequence.

Approach Effect Cost
Insert additional wait states in the DSP boot code Buys margin at the expense of throughput Requires code modification
Use the fastest available speed grade for the CPLD Restores delay margin Part cost and availability
Add a small delay before the first external access Avoids the worst window Code modification
Slow the bus clock during boot Buys margin where it matters Code modification
Leave it and accept yield loss Nothing Field failures

The first and fourth rows are the same technique at different points, and both require modifying the DSP image, which means the copy is no longer a copy. That is a legitimate outcome, but it has to be agreed with the customer before delivery, because it changes the acceptance criteria.

The order of work that avoids the trap

Step Output
Capture bus timing on the original board Reference measurement
Read both devices Two images
Program a blank pair A candidate board
Capture bus timing on the candidate Comparison
Compare the two measurements The actual difference
Decide whether to adjust, or to accept A documented decision

The fifth step is the one that turns an argument into a measurement. Comparing two captured waveforms answers the question directly, whereas comparing two files answers a different question.

Where the individual copies are covered

The logic device side is in copying CPLD IC code, the DSP memory side in reading DSP chip program, and the power-up boundary in general in copying CPLD and MCU software data. This page is about the case where the system fails even though both copies are exact.

Services at this boundary

Work covers device copying, reference timing capture before any modification, candidate timing capture, comparison and diagnosis, and code modification where margin has to be bought. It does not cover guaranteeing a copy on a design that was already at its timing limit, and it does not cover repairing a board whose bus problems predate the copy.

The honest statement is that contents can be copied and timing cannot, so a mixed copy is only complete when the interface has been measured rather than assumed.