1.4. bms

The bms tool provides a shell that enables communication with the foxBMS 2 through a CAN bus. This makes low-level debugging possible through only a terminal.

1.4.1. Usage

Usage: fox.py bms [OPTIONS]

  Run the 'bms' command

Options:
  -b, --bitrate [500000]         CAN Baudrate.
  -c, --channel TEXT             CAN channel (must be appropiate for the
                                 selected interface; defaults are {'pcan':
                                 'PCAN_USBBUS1', 'kvaser': 0}).

                                 Usable are:

                                   pcan: PCAN_USBBUS1, PCAN_USBBUS2,
                                   PCAN_USBBUS3, PCAN_USBBUS4, PCAN_USBBUS5,
                                   PCAN_USBBUS6, PCAN_USBBUS7, PCAN_USBBUS8,
                                   PCAN_USBBUS9, PCAN_USBBUS10, PCAN_USBBUS11,
                                   PCAN_USBBUS12, PCAN_USBBUS13,
                                   PCAN_USBBUS14, PCAN_USBBUS15, PCAN_USBBUS16

                                   kvaser: 0, 1, 2, 3, 4, 5, 6, 7
  -i, --interface [pcan|kvaser]  CAN interface.
  -v, --verbose                  Verbose information.
  -h, --help                     Show this message and exit.

The bms command opens the bms-shell in which commands are implemented for communicating with the foxBMS 2.

There are the following commands:

  • help: Prints all commands and gives further information on the commands when typing help <command>.

  • init: Initializes the CAN bus. All other commands can only be executed after passing this command.

  • exit: Exits the bms-shell and shuts the CAN bus down if necessary.

  • boottimestamp: Requests the Boot Timestamp of the foxBMS 2.

  • buildconfig: Requests the Build Configuration of the foxBMS 2.

  • commithash: Requests the commit hash the software version was built with.

  • fram: Instructs the foxBMS 2 to initialize the FRAM.

  • getrtc: Requests the current time of the foxBMS 2.

  • log [ID] [optional: #] [optional: FILE]: Logs the specified amount of received messages with ID to the terminal or to build/logs/foxBMS_CAN_bms_log.txt if FILE has been passed. If the size of the file reaches 200000 bytes a new file is created with the timestamp added to the name. ID can be given in decimal format or in hexadecimal format (e.g. 0x300, 300h). If no amount has been specified, only one message will be logged.

  • mcuid: Requests the unique ID of the MCU.

  • mculotnumber: Requests the lot number of the MCU.

  • mcuwaferinfo: Requests the wafer information the MCU was made of.

  • rtc: Sets the time of the foxBMS 2 to the current time.

  • softwarereset: Instructs the foxBMS 2 to perform a software reset.

  • softwareversion: Requests the software version of the foxBMS 2.

  • uptime: Requests the uptime of the foxBMS 2.

1.4.2. Structure

bms tool overview

Fig. 1.2 Overview of the bms tool

bms tool processes

Fig. 1.3 Processes of the bms tool