Skip to content

Conversation

@markushx
Copy link
Contributor

@markushx markushx commented Dec 7, 2025

A sample that logs frames on a DALI bus to UART/RTT.

Depends on #88128. Once #88128 is merged, this sample should move samples/driver/dali into samples/driver/dali/blinky and move the sample of this PR into samples/driver/dali/logger.

A sample that logs frames on a DALI bus to UART/RTT.

Signed-off-by: Markus Becker <markushx@gmail.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 7, 2025

@SvenHaedrich
Copy link

Consider using this implementation for dali_rx_callback:

void dali_rx_callback(const struct device *dev, struct dali_frame frame, void *user_data)
{
	uint8_t length = 0x80;

	switch (frame.event_type) {
		case DALI_EVENT_NONE:
			return;
		case DALI_FRAME_CORRUPT:
			break;
		case DALI_FRAME_BACKWARD:
			length = 8;
			break;
		case DALI_FRAME_GEAR:
			length = 16;
			break;
		case DALI_FRAME_DEVICE:
			length = 24;
			break;
		case DALI_FRAME_FIRMWARE:
			length = 32;
			break;
		case DALI_EVENT_BUS_FAILURE:
			length = 0x91;
			break;
		case DALI_EVENT_BUS_IDLE:
			length = 0x90;
			break;
	}
	LOG_INF("{%08llx:%02x %08x}", k_uptime_get(), length, frame.data);
}

The output format would be compatible to dali_mon and the DALI commands are translated directly to a human readable format:

$ stty -F /dev/ttyACM0 115200
$ ./dali_mon < /dev/ttyACM0
135.083 |    0.000 |     FF05 | BC GEAR              RECALL MAX LEVEL
149.184 |   14.101 |   C13100 |                      DTR1 0x00 =   0 = 00000000
149.218 |    0.034 |   C13000 |                      DTR0 0x00 =   0 = 00000000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants