Skip to content

Add JetFleet JFBMS slave hardware target - #97

Draft
Fajdiga wants to merge 6 commits into
vedderb:mainfrom
Fajdiga:pr/jfbms-slave-hardware-target
Draft

Add JetFleet JFBMS slave hardware target#97
Fajdiga wants to merge 6 commits into
vedderb:mainfrom
Fajdiga:pr/jfbms-slave-hardware-target

Conversation

@Fajdiga

@Fajdiga Fajdiga commented May 14, 2026

Copy link
Copy Markdown

Draft while the dependency PR is reviewed.

Depends on:

This PR adds the JetFleet JFBMS slave hardware target and documents the private master/slave BMS CAN protocol.

Changes:

  • Adds the JFBMS_SLAVE hardware target.
  • Adds BQ769x2 definitions for the slave board.
  • Adds config defaults, parser, XML metadata, and VESC Tool settings.
  • Documents the standard 11-bit CAN protocol used between JFBMS32 master and slave boards.

Scope note:
Hosted Lisp application scripts are intentionally not included here because those are kept in a separate repository.

Protocol summary:

  • Slaves broadcast cell voltages, temperatures, status, and balancing state.
  • The master sends balance commands.
  • Status frames include per-IC cell counts and fault flags.
  • A watchdog disables slave balancing if commands stop.

Motivation:
This target supports pack expansion beyond the cells directly handled by the master BMS controller while keeping the protocol documented and reviewable.

Testing:

  • Split from the tested cleanup/upstream-ready branch.
  • Runtime-tested on slave BMS hardware with JFBMS32/JF Link master-side receivers.
  • Current refresh verified that no .lisp files or private local artifacts are included.

Jerne Fajdiga and others added 5 commits May 25, 2026 13:48
Adds an optional hwconf macro that lets a board opt out of the
COMM_PING_CAN broadcast scan. The default in main/hwconf/hw.h is 1
to preserve the existing behavior; a hwconf header can override it
to 0 to skip the scan loop in commands.c.

Useful for headless variants that share a CAN bus with a master and
should never participate in VESC ping discovery.
Adds an optional hwconf macro that switches the TWAI driver into
TWAI_MODE_NO_ACK at init. The default in main/hwconf/hw.h is 0, so
the existing TWAI_MODE_NORMAL behavior is preserved unless a hwconf
header opts in.

Useful for bench / diagnostic builds that need to observe a live CAN
bus without generating ACKs.
Adds HW_CAN_FILTER_CONFIG in main/hwconf/hw.h so a hwconf header can override the default TWAI acceptance filter. The default expands to false, so behavior remains TWAI_FILTER_CONFIG_ACCEPT_ALL() when no hardware provides an override.

The filter is re-applied on both initial CAN bring-up and after comm_can_update_baudrate() so a hwconf override survives baud changes. f_config is made non-const so update_filter() can replace it.

Also dispatches an optional weak hw_can_rx_hook() from the CAN process task after Lisp CAN processing and before the normal VESC/BMS decoder path. Hardware variants such as JFBMS_SLAVE can use this to consume custom 11-bit protocol frames without changing generic CAN decoding.

Matches the existing HW_INIT_HOOK() / HW_POST_LISPIF_HOOK() pattern: a hwconf header declares its hardware-specific function and wires it through a small macro or weak-symbol implementation.
Adds a hwconf-defined HW_IS_SLAVE flag that suppresses two pieces of
boot-time behavior in main.c:

- BLE and WiFi initialization. A slave variant has no user-facing radios;
  running these only wastes RAM and adds attack surface.
- main_store_backup_data() copying controller_id and can_baud_rate from
  the live config into the persisted backup. Headless slave builds use
  their own slave-specific config and should not mirror these shared
  VESC Express compatibility fields back into backup storage.

When HW_IS_SLAVE is not defined, behavior is unchanged. The flag is
expected to be set in a hwconf header alongside HW_NAME and the other
HW_* macros.
@Fajdiga
Fajdiga force-pushed the pr/jfbms-slave-hardware-target branch from e7ef960 to 3d09ac8 Compare May 25, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant