Skip to content

Tasks of the Motherboard

The following tasks have been implemented and are operational

  • Own Led control (blue, green, yellow, red). Implemented by GPIO writes (main-Loop).
    • green: is active when the BMS set is complete
    • yellow: is flashing upon power
    • red: currently unused
    • blue: currently unused
  • Local Analog Sensor Measurements

    • Voltages, Currents, Temperatures, Humidity. Implementation in class analog_thread/AnalogThread. Instantiated in Firmware before main-Loop.
      Related Kconfig options:

      ANALOG_THREAD_STACK_SIZE [default=2048]
      ANALOG_MEASUREMENT_NO_VAL_PRINT_INTERVAL_MS [default=5000]
      ANALOG_MEASUREMENT_NO_VAL_WRN_AFTER_MS [default=150]
      ANALOG_MEASUREMENT_NO_VAL_ERR_AFTER_MS [default=1000]
      ANALOG_THREAD_LOG_TIMING [default=false]
      ANALOG_THREAD_LOG_STDDEV_VALUES [default=false]
      
  • Monitor of BMS states

    • Custom implementation (only .cpp files) of class cyphal/BMSNode/BMSCyphalMonitor. Instantiated in Firmware before main-Loop.
      Related Kconfig options:

      CYPHAL_BMS_PACK_RECEIVE_TIMEOUT_MS [default=600]
      CYPHAL_PUBLISH_BMS_DATA_PORT [default=6064]
      
  • Enable output of MMB power. Implemented by GPIO write in main-Loop upon engage of all BMS.

  • Synchronization Pulse for MMB & Navlights

    • Implemented by thread / class cyphal/PublishMMBSyncPulse (Cyphal empty message). Instantiated in Firmware before main-Loop.
      Related Kconfig options:

      CONFIG_CYPHAL_MMB_SYNC_PULSE_STACK_SIZE [default=1024]
      CONFIG_CYPHAL_MMB_SYNC_PULSE_PORT [default=6076]
      CONFIG_PUBLISH_MMB_SYNC_PULSE_PERIOD_MS [default=1500]
      
  • Synchronization of BMS Engage

    • Implemented by class cyphal/SynchronizedHotSwapPublisher (Cyphal custom message). Used by Firmware in main-Loop (once after boot or when BMS not engaged).
      Related Kconfig options:

      CONFIG_CYPHAL_HOTSWAP_ACTIVATION_PULSE_PORT [default=6065]
      CONFIG_CYPHAL_HOTSWAP_ACTIVATION_PULSE_PERIOD_MS [default=1000]
      
  • Mavlink (via UART) message publish to Skynode.

    • Battery Information, implemented by analog_thread/AnalogToBatteryData, updated by Firmware in main-Loop.
    • possible TextMessages (e.g. Warnings/Errors): currently unused

Zephyr OS has threads for

  • Kernel Workqueue
    • Custom Tasks can be appended with specific timeouts
  • Logging
  • Drivers
    • custom LED driver updates LED states (e.g. for blinking effects)
  • Idle (lowest priority, default OS feature)

The firmware application adds threads for

  • Main application (sleeps for fixed time amount)
    • initialization of other threads and main components
  • Analog sampling (sleeps for sampling period)
  • Cyphal RX (using Zephyr MessageQueue + timeout)
  • Cyphal TX (waiting for a Semaphore to take + timeout)
  • Cyphal Heartbeat (sleeps for fixed interval)
  • Cyphal DFU (spawns dynamically, using local Zephyr MessageQueue)
  • PWM Capture (Loop to update PWM state)
  • MMB Sync publish (sleeps for fixed time amount)
  • Mavlink Publish for Heartbeat and BatteryStatus (sleeps for fixed time amount)

Interrupts are used by

  • Several Zephyr Drivers
  • Mavlink serial UART receive (creates Workqueue Tasks)

Workqueue tasks are generated by

  • Cyphal image verification after DFU (executed once, 10s delay)
  • Cyphal ExecuteCommand for system restart (allows return of ExecuteCommand response + logging)
  • Cyphal ExecuteCommand for LED control (delayed write of LED at specific timepoint)
  • Cyphal TimeSync (publish if this node is time master)
  • Cyphal Callback for registry change -> NodeID set (allows return of registry access response)
  • FileSystem Library for flash store operations
  • Mavlink serial receive / publish (queue processing)
  • MMB enable process (spawned in main upon boot)
  • ESC motor parameter copy (spawned in main upon boot)