Specialist Supplier of Crystals & Frequency Control Componentssales@mecxtal.com.cn0755-26500570
MERLIN home / Rednote / Passive Crystals and Oscillator Circuits

DALI runs at just 1,200 bit/s. Why do commands fail after the controller clock changes?

A dimmable light responds to bench controls after a board change but sometimes ignores commands on the installed DALI bus. Both bills of materials list the same protocol rate. Before replacing the crystal, find where the timer generating the signal gets its clock and how the receiver decides whether an edge interval is a half bit or a full bit. The same 1,200 bit/s setting can require different timer counts at these points.

DALI uses Manchester coding. Each bit has a transition at its midpoint, and its direction represents the data. Depending on the adjacent data, there may also be a transition at a bit boundary. Adjacent edges can therefore be separated by either one or two half-bit times. Reading each edge as a new bit can shift the decoded address and brightness command. Incorrect timing can produce a similar symptom if the decoder treats two half-bit times as one.

Calculate the half-bit time and find the counter that generates it

At 1,200 bit/s, one bit takes about 833.33 microseconds and a half bit takes about 416.67 microseconds. Microchip's control-gear example uses a timer running at 2 MHz, which gives roughly 833 counts per half bit. In that example the oscillator feeds a peripheral clock and prescaler before reaching the timer. The oscillator frequency is a starting point for the calculation. Verify the active divider and register values when changing the controller or power mode.

Suppose the original timer counts at 2 MHz and uses 833 counts, giving about 416.5 microseconds. A new divider makes the timer run at 1 MHz, but the firmware still uses 833 counts. A half bit now takes 833 microseconds, nearly a full bit at the intended rate. A crystal with ten times better accuracy will not restore the divider. Measure a known timer output or test signal and work backward from the actual waveform to the clock tree.

If the new timer runs at 3 MHz, about 1,250 counts are needed for one half bit in this example. Check whether the register value is inclusive of zero and whether the counter can also cover longer protocol delays. A register written as 833 may produce 834 actual ticks. That difference is usually smaller than missing a divider, but it still belongs in the error budget. Measure the period produced by the hardware.

Separate transmit timing, receive decisions and response timing

Choose a known data pattern with many bit-boundary transitions and a second pattern with several two-half-bit intervals. Observe the same command at the controller output, each side of the transceiver and the receive logic input. Save the half-bit and full-bit intervals and transition direction. If the controller is already twice as slow, fix its timebase. If its output is correct and the pulses change across the interface, inspect the transceiver, loading and receive threshold.

Check the reply window independently. A controller can decode queries correctly and still respond too late if another task preempts it or firmware waits on a busy resource. Capture the end of the command, start of reply and complete reply on the bus. Compare the applicable frame and turnaround rules for the project's protocol version and function. When commands consistently decode but only status queries time out, investigate response scheduling before adjusting half-bit timing.

Keep a worksheet with controller part number, protocol clock source, actual timer rate, prescaler, measured half-bit and full-bit times, and transmit or reply mode. Purchasers can use the designator and function to quote the right component. Firmware teams can rerun the same timing measurements after a software change. This ties the nominal bit rate on the spec to the edges that receivers must see.

Test first with a short bench cable, then with the installed harness and representative loads. A device connected beside the transmitter may work even when the installed network distorts the edges. Compare the same command across schematic, waveform and protocol log and locate the first place behavior differs. Include different addresses and commands of equal length so you can check receive polarity. Confirm that high-to-low and low-to-high transitions represent the intended data before attributing a gap to the timer.

References

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.