# IO Module Blazor Dashboard A Blazor Server web application for monitoring and controlling the STM32H723ZG Nucleo IO module over CAN bus and serial. ## What This App Does - **Button Status** — Live indicators for the three push buttons (User/Button1/Button2) received via CAN - **Termination Control** — Toggle TERM_ON and TERM_OFF outputs on the CAN hat (sends CAN `0x240`) - **CAN Monitor** — Full CAN management: connect/disconnect, live message stream, filter and signal decoder, manual message sender - **Serial Terminal** — Connect to the STM32's ST-Link VCP for NVMEM EEPROM read/write commands ## Requirements - **.NET 10 SDK** - **PEAK PCAN adapter** (e.g. PCAN-USB) with PCAN-Basic drivers installed - STM32H723ZG Nucleo board running the [IOModuleBlazorTest firmware](../STM32Nucleo/) ## Running the App ``` cd IOModuleTestBlazor dotnet run ``` Then open `https://localhost:5001` in a browser. ## Pages | Page | Route | Description | |------|-------|-------------| | Home | `/` | Button status, termination control, CAN message list | | CAN Monitor | `/can-monitor` | Full CAN management — connect, filters, signal decoder, send | | Serial Terminal | `/serial` | ST-Link VCP terminal for NVMEM EEPROM commands | ## CAN Bus Setup 1. Connect the PCAN-USB adapter to the Nucleo CAN transceiver 2. Open the app and navigate to **CAN Monitor** 3. Select the PCAN channel and set bitrate to **500 kbps** 4. Click **Connect** — the app auto-scans for available PCAN USB channels ## Termination Control (Home page) Two independent toggles map directly to the CAN hat's termination relay outputs: | Button | CAN `0x240` bit | STM32 pin | |--------|-----------------|-----------| | TERM_ON | Bit 0 | PB10 (CN10-32) | | TERM_OFF | Bit 1 | PB11 (CN10-34) | Clicking a toggle immediately sends a `0x240` frame. Buttons are disabled when not connected. ## Serial Terminal (NVMEM Commands) Connect to the Nucleo's ST-Link USB virtual COM port at **115200 baud**. | Command | Description | |---------|-------------| | `r ` | Read `len` bytes (1–5) from EEPROM at hex address | | `w [b1...]` | Write 1–5 bytes to EEPROM | | `?` | Show help | Example: `r 0000 4` reads 4 bytes at address 0x0000. See [STM32 firmware docs/NVMEMCommands.md](../STM32Nucleo/docs/NVMEMCommands.md) for the full reference. ## Project Structure ``` IOModuleTestBlazor/ ├── Components/ │ ├── Layout/ │ │ └── NavMenu.razor # Navigation sidebar │ └── Pages/ │ ├── Home.razor # Dashboard: buttons + termination + messages │ ├── CanMonitor.razor # Full CAN management UI │ └── SerialTerminal.razor # NVMEM serial command terminal ├── Services/ │ ├── ICanService.cs / CanService.cs # PCAN adapter wrapper │ └── ISerialPortService.cs / SerialPortService.cs # Serial port wrapper ├── Models/ │ └── CanModels.cs # CanMessageDto, CanFilter, CanBitmask ├── CanWorker.cs # Background CAN message reader └── Program.cs # DI registration, middleware ``` ## Dependencies | Package | Purpose | |---------|---------| | `Peak.PCANBasic.NET` | PCAN hardware CAN adapter driver | | `Microsoft.AspNetCore.SignalR.Client` | Real-time Blazor Server transport |