Skip to content

choco-technologies/dmuart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DMUART - DMOD UART Driver Module

License

A DMOD (Dynamic Modular System) module for UART (Universal Asynchronous Receiver-Transmitter) communication on embedded microcontrollers.

Features

  • Standard DMDRVI Interface: Read/write/ioctl device access pattern
  • Configurable Parameters: Baud rate, data bits, parity, stop bits, flow control
  • Multiple Instances: Support for multiple UART peripherals simultaneously
  • Hardware Abstraction: Platform-independent API with hardware-specific implementations
  • DMDRVI Integration: Full DMOD driver interface implementation
  • STM32 Support: STM32F7 family currently supported
  • Extensible: Easy to add support for additional microcontroller families

Quick Start

Installation

Using dmf-get from the DMOD release package:

dmf-get install dmuart

Or install with a pre-configured setup for your board:

# Create a dependencies file (deps.dmd)
echo "dmuart@latest board/stm32f746g-disco.ini" > deps.dmd

# Install with configuration
dmf-get -d deps.dmd --config-dir ./config

Basic Usage

  1. Create a configuration file (config.ini):
[dmuart]
baudrate=115200
databits=8
parity=none
stopbits=1
flowcontrol=none
instance=1
  1. Use in your code:
#include "dmuart.h"
#include "dmdrvi.h"
#include "dmini.h"

// Load configuration and create device
dmini_context_t config = dmini_load("config.ini");
dmdrvi_dev_num_t dev_num = {0};
dmdrvi_context_t uart_ctx = dmuart_dmdrvi_create(config, &dev_num);

// Open device for read/write
void* handle = dmuart_dmdrvi_open(uart_ctx, DMDRVI_O_RDWR);

// Write data
const char* msg = "Hello UART!\n";
dmuart_dmdrvi_write(uart_ctx, handle, msg, strlen(msg), 0);

// Read data
char buffer[64];
size_t n = dmuart_dmdrvi_read(uart_ctx, handle, buffer, sizeof(buffer), 0);

// Cleanup
dmuart_dmdrvi_close(uart_ctx, handle);
dmuart_dmdrvi_free(uart_ctx);
dmini_free(config);

Building

Prerequisites

  • CMake 3.18 or higher
  • ARM GCC toolchain (for embedded targets)
  • DMOD framework (automatically fetched)

Build Commands

# Configure for STM32F7
cmake -DDMUART_MCU_SERIES=stm32f7 -B build

# Build
cmake --build build

Documentation

Comprehensive documentation is available in the docs/ directory:

View documentation using dmf-man:

dmf-man dmuart          # Main documentation
dmf-man dmuart api      # API reference
dmf-man dmuart config   # Configuration guide
dmf-man dmuart port     # Port implementation guide

Supported Platforms

Platform Status Notes
STM32F7 βœ… Supported Full UART support (USART1-6, UART4-5, UART7-8)
Other STM32 πŸ”§ In Progress Easy to add using STM32 common code
Other MCUs πŸ“‹ Planned Contributions welcome

Configuration Examples

Standard 115200 8N1

[dmuart]
baudrate=115200
databits=8
parity=none
stopbits=1
flowcontrol=none
instance=1

9600 Baud with Even Parity

[dmuart]
baudrate=9600
databits=8
parity=even
stopbits=1
flowcontrol=none
instance=2

High-Speed with Hardware Flow Control

[dmuart]
baudrate=921600
databits=8
parity=none
stopbits=1
flowcontrol=rts_cts
instance=1

Development

Project Structure

dmuart/
β”œβ”€β”€ configs/           # Pre-configured board and MCU configurations
β”‚   β”œβ”€β”€ board/        # Board-specific configurations
β”‚   └── mcu/          # MCU-specific configurations
β”œβ”€β”€ docs/              # Documentation (markdown format)
β”œβ”€β”€ examples/          # Example configurations
β”œβ”€β”€ include/           # Public headers
β”‚   β”œβ”€β”€ dmuart.h      # Main API
β”‚   β”œβ”€β”€ dmuart_port.h # Port layer API
β”‚   └── port/         # Port-specific headers
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ dmuart.c      # Core implementation
β”‚   └── port/         # Hardware-specific implementations
β”‚       β”œβ”€β”€ stm32_common/  # Common STM32 code
β”‚       └── stm32f7/       # STM32F7 port
β”œβ”€β”€ tests/             # Test applications
β”œβ”€β”€ CMakeLists.txt    # Build configuration
└── manifest.dmm      # DMOD manifest

Adding New Platform Support

See Port Implementation Guide for detailed instructions on adding support for new microcontrollers.

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Authors

  • Patryk Kubiak - Initial work

Related Projects

  • DMOD - Dynamic Modular System framework
  • DMINI - INI configuration parser for DMOD
  • DMDRVI - DMOD Driver Interface
  • DMGPIO - GPIO driver module
  • DMCLK - Clock configuration module

Support

For issues, questions, or contributions:

  • Open an issue on GitHub
  • Check the documentation in docs/
  • Use dmf-man dmuart for command-line help

About

Repo with UART driver

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors