Adds a commented-out clock configuration to the file. This allows switching the clock source from the external high-speed oscillator (HSE) to the internal high-speed oscillator (HSI), which can be useful if an external crystal is not present.
Also, removes the debug log level for the settings subsystem from the project configuration.
This commit introduces application versioning, exposing version information through the Modbus server and logging it at startup.
- Add to provide version information
- Update to log the application version at startup
- Update to expose firmware version via Modbus
- Add file association for in
- Initialize RST pin as active to keep VND7050AJ out of reset state
- Clarify S0/S1 pins as output select pins with descriptive comments
- Add initialization logging to show configured max open/close times
- Ensure proper valve controller startup sequence
This commit implements the real valve control using the GPIOs connected to the VND7050AJ driver.
- The `weact_stm32g431_core.overlay` is updated with a specific compatible string and a device tree label for the valve controller.
- `valve.h` is extended to include GPIO device specifications.
- `valve.c` now initializes and controls the GPIOs for opening and closing the valve, including the reset logic. The IN0 and IN1 pins are interlocked to prevent simultaneous activation. The RST pin is activated before each movement and deactivated afterward.
This replaces the previous virtual/simulated valve logic with actual hardware control.
Updated the weact_stm32g431_core.overlay to define the GPIO and ADC
pin assignments for the VND7050AJ driver. This includes:
- Digital I/O pins (IN0, IN1, RST, S0, S1, SEN) configured as GPIOs.
- Analog input pin (MULTISENSE/PA0) configured for ADC1.
This commit introduces a major refactoring of the project structure to align
with Zephyr's recommended multi-application and library organization.
Key changes include:
- Relocation of custom modules from 'software/modules/' to 'software/lib/'.
- Introduction of a central 'software/CMakeLists.txt' to manage application
and library subdirectories.
- Creation of new Kconfig files for 'software/' and 'software/apps/slave_node/'
to define project-wide and application-specific configurations.
- Removal of the 'gateway' and 'stm32g431_tests' applications.
- Removal of 'shell_modbus.c' and 'shell_system.c' from 'slave_node' application's
direct source files, indicating a shift towards library-based shell commands.
- Updates to 'software/apps/slave_node/CMakeLists.txt', 'prj.conf', and
'boards/bluepill_f103rb.conf' to reflect the new structure and dependencies.
- Implemented CDC-ACM (USB Virtual COM Port) support for the slave_node application.
- Removed the now obsolete 'hello_world' and 'stm32g431_tests' applications.
- Adjusted Device Tree Overlays for bluepill_f103rb and weact_stm32g431_core
to correctly define Modbus UART via 'modbus0' subnode with 'zephyr,modbus-serial'
compatibility, aligning with rtu_server sample.
- Prepared modbus_server.c to use the correct Device Tree node for Modbus UART.
Refactor slave_node application to support building for both bluepill_f103rb and
weact_stm32g431_core boards.
- Moved RTT-specific console and shell backend configurations from prj.conf
into board-specific .conf files (bluepill_f103rb.conf).
- Configured USART2 as console/shell for weact_stm32g431_core.
- Added Device Tree Overlay for weact_stm32g431_core to enable USART1 for Modbus
communication (PA9/PA10).
Add comprehensive Doxygen-style comments to all functions, enums, and macros in `main.c`. This improves code clarity and maintainability. The Doxygen configuration itself was removed after deciding against generating a separate HTML manual, but the in-code comments provide significant value on their own.
- Add Doxygen-compliant comments to functions, enums, and state variables in `main.c`.
- This provides a foundation for automatically generating source code documentation.
- Remove the separate, now redundant, `firmware-manual.de.md` file.
- Add a fail-safe watchdog using a Zephyr kernel timer.
- The timer is reset on any successful Modbus communication.
- If the timer expires (no communication within the configured timeout), the valve is automatically closed as a safety measure.
- The watchdog is enabled by writing a non-zero value to the `WATCHDOG_TIMEOUT_S` register and disabled by writing 0.
- Implement all remaining Modbus registers as defined in the documentation v1.0.
- Add support for digital I/O, system status, and a simulated watchdog.
- Implement a placeholder for the firmware update mechanism, including CRC calculation for received data chunks.
- Remove the input simulation timer; digital inputs are now static and ready for real hardware.
- Add shell commands 'valve set_open_time' and 'valve set_close_time' to configure the virtual valve.
- Extend the 'show_config' command to display the new timing values.
- The new settings are persisted to flash storage.
- Implement virtual valve logic with time-based movement simulation.
- The valve state is now set to 'OPEN' immediately when the opening process starts, ensuring a safe and correct state representation.
- The state is only set to 'CLOSED' after the closing process has finished.
- Add persistence for max opening and closing times.
- Integrate the Zephyr Settings subsystem to persist Modbus parameters.
- Use NVS (Non-Volatile Storage) as the backend with a dedicated flash partition.
- Modbus baudrate and slave ID are now loaded at startup.
- Changes made via the shell are saved to flash and survive a reboot.
- Add a 'reset' command to the shell for easier testing.
- Fix all compiler and devicetree warnings for a clean build.
- Implement a new 'modbus' command in the shell.
- Add sub-commands 'set_baud', 'set_id', and 'show'.
- Add validation for baud rate and slave ID inputs.
- The new parameters are applied to the Modbus server at runtime, allowing for live reconfiguration of the communication settings.
- The shell backend is set to RTT.
- Add read support for system-level input registers:
- FIRMWARE_VERSION_MAJOR_MINOR (0xF0)
- FIRMWARE_VERSION_PATCH (0xF1)
- DEVICE_STATUS (0xF2)
- Use enums for register addresses to improve readability.
- Implement a workaround for a Kconfig issue by hardcoding the firmware version.
- Stabilize multi-register reads by returning 0 for unhandled input registers instead of an exception.
- NOTE: Writing to holding registers is currently unstable with mbpoll and will be addressed separately.
- Add a callback for reading Modbus input registers.
- Implement logic to provide the system uptime in seconds, split across two 16-bit registers (UPTIME_SECONDS_LOW at 0x00F3 and UPTIME_SECONDS_HIGH at 0x00F4) as per documentation.
- Return 0 for unhandled registers to prevent "Invalid data" errors with certain Modbus masters.
The Modbus server was previously unstable, leading to intermittent CRC errors when polled by a master. This was caused by the main thread exiting after initialization, which created timing and race condition issues for the interrupt-driven Modbus stack.
This fix ensures the main thread continues to run in a low-power sleep loop (). This provides a stable context for the Modbus server, resolving the CRC errors and ensuring reliable communication.
- Add a basic Modbus RTU server implementation based on Zephyr samples.
- Configure usart1 for Modbus via a board overlay.
- The server initializes and runs, but polling with mbpoll results in a timeout.
- This commit captures a functional but non-working state for further debugging.
- Enable the console subsystem and printk for debugging output.
- Configure the console to use the UART peripheral (usart1 on PA9/PA10).
- Disable RTT to ensure UART is the active console.
- Remove redundant DTS_ROOT from CMakeLists.txt as it's inferred from BOARD_ROOT.
- Clear the project configuration (prj.conf) to start with a minimal baseline.
Remove the top-level and configure each application to directly include the directory as a module or root. This simplifies the build process by making each application more self-contained while still allowing access to shared boards and libraries.
This commit captures a working multi-app build where the board definition is located in the 'software' directory and explicitly included by the slave_node application. This serves as a stable baseline.
- Reorganize the software directory to support multiple Zephyr applications (gateway, slave_node).
- Create a clear separation between applications and shared libraries.
- Add placeholder files for gateway and slave_node applications.