Crate freemdu

Crate freemdu 

Source
Expand description

Communicate with Miele appliances via their proprietary diagnostic interface.

§Overview

The freemdu crate implements the proprietary Miele diagnostic protocol. It offers an asynchronous, platform-agnostic API for communicating with Miele appliances via the diagnostic interface.

Depending on your needs, you can:

  • Use the high-level device module to query diagnostic properties and trigger actions.
  • Instantiate device implementations (e.g. device::id629) to access model-specific methods.
  • Work directly with the low-level diagnostic Interface.

§Getting started

Most Miele appliances expose a diagnostic UART on their control board. To communicate with it, you need a UART interface configured as follows:

  • Baud rate: 2400
  • Parity: Even
  • Data bits: 8
  • Stop bits: 1

If you enable the native-serial feature, you can obtain a compatible serial port instance using serial::open:

let mut port = freemdu::serial::open("/dev/ttyACM0")?;

The UART connection can be provided by a USB–UART adapter. In that case, the adapter’s RX, TX and GND lines must be connected to the corresponding pins on the appliance’s control board.

Because the control board is typically not galvanically isolated, working on it may expose you to dangerous voltages. Always take appropriate safety precautions!

Alternatively, you can access the interface through a compatible optical communication adapter. Instructions for building a simple adapter are available on the FreeMDU project page.

§Examples

The following examples demonstrate the primary ways to communicate with devices:

§Querying device properties using the high-level device module

The recommended way to connect to a device is via device::connect, which identifies the device and provides access to its properties and actions:

let mut dev = freemdu::device::connect(&mut port).await?;

for prop in dev.properties() {
   let val = dev.query_property(prop).await?;

   println!("{prop:?}: {val:?}");
}

§Working with a specific device implementation

For model-specific access, a corresponding device instance has to be instantiated directly. This provides additional methods beyond the general device::Device trait:

use freemdu::device::{Device, id629::WashingMachine};

let mut machine = WashingMachine::connect(&mut port).await?;

println!("Program type: {}", machine.query_program_type().await?);
println!("Program options: {}", machine.query_program_options().await?);

machine.start_program().await?;

§Low-level diagnostic access using Interface

Advanced users can interact with the raw diagnostic protocol through the low-level Interface:

let mut intf = freemdu::Interface::new(port);

println!("Software ID: {}", intf.query_software_id().await?);

intf.unlock_read_access(0x1234).await?;
intf.unlock_full_access(0x5678).await?;

let mem: [u8; 16] = intf.read_memory(0x0000).await?;

println!("Memory contents: {:x?}", mem);

§Protocol details

The diagnostic interface is protected by two 16-bit keys. Each appliance model or electronics board typically has its own unique keys required to unlock the diagnostic interface. The supported devices are listed on the FreeMDU project page.

Once fully unlocked, the appliance accepts all diagnostic commands. However, the interface automatically locks again after 3 seconds of inactivity, so tools must send commands periodically to maintain access.

Re-exports§

pub use embedded_io_async;

Modules§

device
High-level device abstractions.
serialnative-serial
Native asynchronous serial port support for Interface.

Structs§

Interface
Asynchronous diagnostic protocol interface.
Payload
Diagnostic interface payload.

Enums§

Error
Error type for Interface operations.

Type Aliases§

Result
A specialized Result type for Interface operations.