Commit Graph

22 Commits

Author SHA1 Message Date
Eduard Iten b836f9a2f4 feat(slave_node): Implement system registers
- 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.
2025-07-01 14:56:56 +02:00
Eduard Iten 032ddf2cc0 feat(slave_node): Implement uptime registers
- 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.
2025-07-01 14:38:10 +02:00
Eduard Iten 1067796df4 fix(slave_node): Stabilize Modbus RTU communication
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.
2025-07-01 14:30:22 +02:00
Eduard Iten 6f81e84541 feat(slave_node): Implement initial Modbus RTU server
- 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.
2025-07-01 13:41:22 +02:00
Eduard Iten 0d3696bf93 feat(slave_node): Switch to RTT console output
- Reconfigure the project to use SEGGER RTT for console output instead of UART.
- Update the main loop with a new printk message for testing purposes.
2025-07-01 12:36:11 +02:00
Eduard Iten b005fd5c11 feat(slave_node): Enable UART console and printk
- 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.
2025-07-01 12:13:59 +02:00
Eduard Iten 6c15b7021f refactor(slave_node): Clean up initial configuration
- 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.
2025-07-01 12:09:36 +02:00
Eduard Iten 842b204d36 refactor(build): Streamline multi-app CMake configuration
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.
2025-07-01 12:05:18 +02:00
Eduard Iten 5ce96a662d feat: Establish functional multi-app structure
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.
2025-07-01 11:05:12 +02:00
Eduard Iten fbeaa916b9 feat(project): Restructure software for multi-app setup
- 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.
2025-07-01 08:20:25 +02:00
Eduard Iten d36f3b85b4 sync 2025-06-20 18:41:50 +02:00
Eduard Iten a4aeaa5f91 Fixed modbus init 2025-06-19 17:09:46 +02:00
Eduard Iten e9fc370094 canbus, modbus working, valve has to be implemented in real 2025-06-19 16:56:21 +02:00
Eduard Iten 852c5c72be Added shell functions 2025-06-17 16:43:13 +02:00
Eduard Iten 9d017f9f8d Zwischenspeichern 2025-06-16 13:09:27 +02:00
Eduard Iten 1a85b40444 Fixed setting in canbus 2025-06-13 10:26:57 +02:00
Eduard Iten ade514cbf3 startet canbus implementation 2025-06-13 09:57:34 +02:00
Eduard Iten bd42d85783 moved modbus Kconfig to defconfig 2025-06-13 08:37:29 +02:00
Eduard Iten dc83c27306 renamed modbus test to fit other tests I will add 2025-06-13 08:29:22 +02:00
Eduard Iten 5ab33e3a7b minimal changes 2025-06-13 08:26:49 +02:00
Eduard Iten 57f7060c0e Added modbus lib and test 2025-06-12 17:04:34 +02:00
Eduard Iten 8d5139c621 Added board files for valve node 2025-06-12 10:00:49 +02:00