
A digital LiFi (visible-light / infrared communication) transmitter. The host writes arbitrary
8-bit bytes; the chip frames them and outputs a modulated on/off signal on uo[0] that drives an
LED through an external driver (no power driver on chip).
Modulations (selected per byte with MODE = uio[1:0]). All of them share one time grid:
1 bit = 2 slots, 1 symbol = 2 bits = 4 slots, so all three have the same bit rate for a given speed.
| MODE | Scheme | Waveform of one symbol (slots 0..3) for dibit 00 / 01 / 10 / 11 |
|---|---|---|
| 00 | OOK (NRZ) | 0000 / 0011 / 1100 / 1111 |
| 01 | Manchester (IEEE 802.3: 1 = low→high) | 1010 / 1001 / 0110 / 0101 |
| 10 | 4-PPM (one 1-slot pulse per symbol) | 1000 / 0100 / 0010 / 0001 |
| 11 | reserved: LOAD is rejected (ERR=1) | – |
Bytes are sent MSB first.
Bit rate (SPEED = uio[5:3]): R_b = f_clk / 4^(SPEED+1). At 10 MHz this gives 2.5 Mbit/s,
625k, 156k, 39k, 9.8k, 2.4k, 610 and 153 bit/s.
Frame (lets a receiver find the start and end of every transmission):
| preamble 16b | SFD 8b | byte 8b | ctrl 2b | byte | ctrl | ... | gap 4b |
| 1010...10 | 10101011 | MSB 1st | M ~M | | | | LED off|
ctrl = 10 means another byte follows; 01 means the last byte. A frame continues while the
next byte is already loaded, LAST was not set and the next byte has the same mode and speed.
Otherwise the frame ends and the next byte opens a new frame. Mode and speed are latched with
each byte, so changing the pins never corrupts a frame on air.
Blocks:
Busy protection: a LOAD while the input register is full is rejected and sets ERR. The stored
byte is never overwritten.
rst_n = 0.READY (uo[2]) = 1.ui[7:0]. Set MODE (uio[1:0]), SPEED (uio[5:3]) and LAST (uio[6],
1 for the last byte of a message).LOAD (uio[2]) high for at least 4 clock cycles. Keep the data stable while it is high.DONE (uo[3]) = 1. ERR (uo[4]) = 1 means the
last LOAD was rejected.BUSY, SYNC, BIT_CLK and TX_BIT (uio[7]) help when triggering a scope. With the demo
board, the RP2040 can drive ui_in and uio[6:0] and read the outputs. For a visible test, use
SPEED = 7 (152 bit/s at 10 MHz) or a slower project clock.
Reference receiver algorithm:
10, then 11.01.uo[0], or uo[7] (LED_N) for an
active-low driver or "normally on" lighting.| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | DATA0 | LED (modulated output to LED driver) | MODE0 (in) |
| 1 | DATA1 | BUSY | MODE1 (in) |
| 2 | DATA2 | READY | LOAD (in) |
| 3 | DATA3 | DONE | SPEED0 (in) |
| 4 | DATA4 | ERR | SPEED1 (in) |
| 5 | DATA5 | BIT_CLK | SPEED2 (in) |
| 6 | DATA6 | SYNC | LAST (in) |
| 7 | DATA7 | LED_N | TX_BIT (out) |