Specialist Supplier of Crystals & Frequency Control Componentssales@mecxtal.com.cn0755-26500570
MERLIN home / Rednote / Digital Interfaces and Clock Division

A 2 MHz clock for the TCD1304DG: why does a 3,648-pixel barcode line require 3,694 readout positions?

If every light-to-dark edge on a line-scan barcode reader seems displaced to one side, retain a whole uncropped acquisition and locate the active pixels relative to its beginning. Measuring the master clock alone will not tell you which sample the software calls pixel zero.

Toshiba's TCD1304DG has one row of 3,648 active photosites. Its timing diagram also includes outputs before and after the active row, giving 3,694 positions per line. A quartz reference can set the timing generator's timebase. The master clock delivered to the sensor, the rate at which pixel positions emerge and the number of elements stored in the image are separate quantities. An indexing error can displace barcode edges even when the reference frequency is exact.

Locate the first active cell in the complete line

In Toshiba's normal timing diagram, 32 leading outputs precede the 3,648 active outputs, followed by 14 trailing outputs. The leading region contains both light-shielded elements and other dummy outputs. They have different origins and uses, so averaging the entire leading region does not automatically establish the sensor's dark level. If electronic shuttering is enabled, consult its particular timing diagram. Identify whether the acquisition starts at an integration-clear event, a shift event or the sampling instant of the first readout position.

For zero-based storage, assume index zero corresponds to the very first output of the complete line. Indices 0 through 31 are then leading positions, 32 through 3679 are active, and 3680 through 3693 are trailing positions. A half-open active slice starts at 32 and ends at 3680. This notation depends on the alignment just defined. If acquisition hardware has already discarded the front porch, applying an additional offset of 32 in software removes image data. Identify cropping separately at the raw buffer, transfer and export stages.

Set an acquisition window long enough for the measurement

At 25 °C the manufacturer's typical master clock is 2.0 MHz, with a typical data rate of 0.5 MHz. One output position then occupies 2 µs. A master-clock cycle takes 0.5 µs, giving four cycles per position. If the ADC acquires several samples in one position, distinguish the number of analog samples from the number of sensor outputs. Dividing the active-pixel count by the ADC's sampling rate does not give the full line-readout time.

Region within a lineOutput positionsTime at 2 µs per position
Leading outputs3264 µs
Active photosites3,6487,296 µs
Trailing outputs1428 µs

The complete readout takes 7,388 µs in this example. Active data occupies 7,296 µs, a difference of 92 µs. A recorder that starts at the very beginning but runs only for the active-data duration necessarily misses active data at the far end. The calculation covers the readout interval in the timing diagram. Software gaps, transfer time and integration timing must be considered separately before inferring a scanner's line rate. Mark the start and end edges and identify the actual interval they delimit.

Use a shadow edge to separate displacement from a timing error

Mount the reader on a fixture with constant illumination and exposure. Put a sharp light-to-dark boundary in the active field. Use two edges with known separation, save several raw lines and check both ends of the captured format before locating the edge indices. If the spacing is correct but both edges move by a fixed number of samples, examine the window start, line trigger and coordinate origin. If the time per position also changes, check the master clock and the sampling cadence. Common displacement alone cannot prove a software fault: optical alignment or motion of the fixture can produce the same shift.

Toshiba specifies an 8 µm pixel pitch. If software mistakenly treats the first 32 leading positions as image pixels, the index displacement corresponds to 32 × 8 µm, or 256 µm at the sensor plane. Converting this into displacement on a barcode label requires lens magnification and the actual geometry. Do not record 256 µm as a printing error. Move the shadow edge a known distance, record the change in index and check it against the measured optical scale and a known-good reader on the same fixture.

A faster reference cannot restore discarded line data

The 25 °C clock tables distinguish two supply conditions, with the analog and digital voltages equal. At 4.0 V or higher within the recommended supply range the master-clock upper limit is 4.0 MHz. From 3.0 V to below 4.0 V the upper limit is 2.4 MHz. Both tables list 2.0 MHz as the typical master clock. Buying a precise 4 MHz oscillator does not raise the sensor's allowable clock to 4 MHz on a 3.3 V board.

Measure period, levels and edges at the sensor clock pin, then acquire a shift or clear control signal together with the analog output. The sensor accepts logic pulses. A passive crystal requires an oscillator circuit and cannot be connected across a single digital input. If a processor divides a crystal-derived clock to drive the sensor, record the reference frequency, divider and measured input. When a fixed number of line positions is missing, establish the complete capture length or the hardware trigger offset and verify buffer capacity. Speeding up the clock shortens each interval without restoring samples discarded by software. Check the trigger location over consecutive lines and record array lengths before and after export under the same software version so acquisition and image-processing engineers can compare changes using one raw record.

Ask suppliers to define the line format before replacing a board

Identify the sensor ordering code and timing revision. Check the clock-generating circuit's supply, output logic and board loading as well as the ordered crystal or oscillator. One module sold as “3,648 pixels” may crop the line in its own controller, while another sensor board presents all the leading and trailing outputs. Request the interface frame format, a raw capture with a defined origin and an explicit description of internal cropping. Keep both a uniform-illumination image and a shadow-edge image with the sample. They test active-region boundaries and coordinate mapping respectively.

Record three separate acceptance results. A reference-frequency measurement belongs in the electrical record. A full set of output positions establishes readout timing. The coordinate check passes only when a known target gives the expected position and separation within the active region. Any product claim about barcode read rate additionally requires labels with specified size, contrast and motion. A single captured line cannot establish that rate.

Must the host store all 3,694 positions if only a central barcode strip is needed?

The acquisition hardware can store just the region of interest. First use a complete line to map physical positions to indices, then document which actual output begins the stored strip. Reducing memory use is distinct from shortening the sensor's required readout sequence, which must still meet its timing and exposure requirements.

If shifting the picture restores alignment, has the crystal passed?

Shifting corrects the coordinate origin. Check the clock range, output interval and sampling edges at the board's actual supply as well. If the line origin drifts with temperature or mode, a fixed correction may work for only one image. Retaining the raw line and trigger capture allows a later test to distinguish geometric origin from acquisition timing.

WeChat

MERLIN · TIMING COMPONENTS

Scan with WeChat to contact Sales

Add our WeCom contacts from your usual WeChat app.

On desktop, scan with your phone. On mobile, save the QR image and select it from your album in WeChat Scan.