Year 2 Project: Slave Computer Development

Juntong20XX 于 2025-02-10 发布

Link to Chinese Version.

In embedded development, Slave computers typically don’t participate in decision-making and serve as actuators or sensors.

In this project, each module functions as a slave computer executing instructions from the host computer.

Development Setup

Code Design

State computer Design

The slave computer doesn’t make decisions and can be treated as a state computer:

slave computer status computer

stateDiagram-v2
    [*] --> Disconnected
    Disconnected --> CheckConnection: Periodic check
    CheckConnection --> Disconnected: No response
    CheckConnection --> WaitCommand: Responded
    WaitCommand --> CheckConnection: Periodic check
    WaitCommand --> FeedbackConfirm: Checksum confirmed
    FeedbackConfirm --> Execute: Verified & confirmed
    FeedbackConfirm --> CheckConnection: No response/canceled
    Execute --> WaitCommand

Communication Protocol Design

communication system

uart packet

packet-beta
title UART Packet
0-7: "Start Byte"
8-15: "CRC"
16-79: "Data"
80-87: "Stop Byte"

Protocol details available in the Year 2 Project Slave Computer Wiki.

Debugging Design

With no display/terminal, the onboard LED indicates status:

The following figure is a screenshot of the protocol design during development (translated by Google):

Screenshot of Protocol Design Notes

Issues & Solutions

Serial port occupation during programming

Analysis: Conflict between host computer process and programming process

Solution: Manually close host computer process before programming

Intermittent connectivity

Analysis: CRC validation failures (observed via serial debugging)

Solution: Track last 8 ping records - consider connected if majority succeed

CRC ERROR

Testing

Connection test: Verify slave computer status changes when host computer starts/stops

测试 ping

Servo control test: Validate host computer command execution

测试舵机

Serial message capture: Oscilloscope verification of communication

示波器照片

示波器截图

Synchronized testing with host computer - see Host Computer Development Blog for details.

舵机在上位机操控下旋转