Factory Mode

Factory mode is an interactive serial console for configuring, testing, and diagnosing the CPF. It provides direct access to the file system on the SD card, hardware power channels, buoyancy engine controls, and mission control variables.

Entering Factory Mode

Factory mode is accessed over the Bluetooth serial interface (COM4, 115200 baud, 8N1, no flow control).

After power-on you will see:

Press $$$<CR> to enter factory mode. You have 5 seconds...

Type $$$ followed by Enter. You can type it multiple times within the 5-second window. On success:

Coastal Profiling Float Console
Assembly: <assembly name>

CPF>

To exit factory mode, type:

CPF> exit

Command Reference

Commands are case-insensitive. Arguments are separated by spaces or commas.

help

Prints a summary of available commands.

CPF> help

pwd

Prints the current working directory on the SD card.

CPF> pwd

dir [path]

Lists files and directories. Without an argument, lists the current working directory.

CPF> dir
CPF> dir \SD\missions

Output shows filenames with sizes in bytes (B) or kilobytes (KB), followed by subdirectories.


cd <path>

Changes the current working directory.

CPF> cd \SD\missions

mkdir <path>

Creates a new directory on the SD card.

CPF> mkdir \SD\testdir

cp [-f] <src> <dest>

Copies a file. Use the -f flag to overwrite an existing destination file.

CPF> cp \SD\config.xml \SD\config.xml.bak
CPF> cp -f \SD\newconfig.xml \SD\config.xml

mv <src> <dest>

Moves (renames) a file.

CPF> mv \SD\old.txt \SD\new.txt

rm [-f] <file|dir>

Deletes a file or directory. Use -f to delete a directory. Use * to delete all files in the current working directory.

CPF> rm \SD\oldfile.eng
CPF> rm -f \SD\olddir
CPF> rm *

touch <filename>

Creates an empty test file at the specified path.

CPF> touch \SD\testfile.txt

sz <file>

Sends a file from the SD card to the connected PC using the ZMODEM protocol. Your terminal emulator must be configured to receive ZMODEM transfers.

CPF> sz \SD\missions\2024001\data.sci

rz

Receives a file from the connected PC using ZMODEM and saves it to \SD\. Your terminal emulator must initiate the ZMODEM send.

CPF> rz

com <port> [baud] [databits] [parity] [stopbits] [closeOnEtx]

Opens a pass-through serial connection to another serial port on the CPF, bridging it to the Bluetooth console. Useful for talking directly to sensors or other peripherals.

CPF> com 5 9600 8 N 1 1
Argument Default Options
port COM port number 2–12 (must not be the BT console port itself)
baud 19200 Any valid baud rate
databits 8 5, 6, 7, 8
parity N N (none), E (even), O (odd), M (mark), S (space)
stopbits 1 0, 1, 1.5, 2
closeOnEtx 1 1 = exit on CTRL-C, 0 = reboot to exit

Ports 2–6 are standard UART ports. Ports 7–12 are I²C-bridged serial ports (expansion slots). You must power up the target peripheral first using pow.

Press CTRL-C to exit the com session (if closeOnEtx = 1).


pow [channel] [on|off]

Controls power to individual hardware channels. Without arguments, prints the current power state of all 19 channels.

CPF> pow
CPF> pow 4 on
CPF> pow 4 off

Channel assignments:

Ch Device Ch Device
1 CTD (SBE41) 11 Open
2 Elmo motor ctrl 12 Open
3 Bluetooth 13 N/A
4 Iridium modem 14 Bellows position sensor
5 MSC 15 GPS
6 Optode 16 Motorized valve
7 Slot 3 (J2) 17 I²C ISB-J4
8 OCR504 18 I²C ISB-J5
9 FLBB 19 SPI ISB-J6
10 Open 20 Pump motor

Channel 20 (pow 20 on/off) controls pump motor power via the LHE board.


pump <jv>

Commands the buoyancy pump at a given jog velocity. Positive values increase buoyancy (extend bellows), negative values decrease buoyancy (retract bellows). A value of 0 stops the motor.

CPF> pump 50000
CPF> pump -50000
CPF> pump 0

Units are Elmo jog velocity counts. Typical operational range is ±200000. This command automatically enables the necessary power channels before running.


valve <open|close>

Opens or closes the buoyancy engine motorized valve.

CPF> valve open
CPF> valve close

This command enables the motorized valve power channel automatically.


readstringpot

Reads and prints the current bellows position from the string potentiometer ADC. Reports position as a percentage (0–100% full) and the raw ADC voltage.

CPF> readstringpot

readpth

Reads a single sample from the internal Bosch PTH (pressure/temperature/humidity) sensor and prints it as a tab-separated line.

CPF> readpth

Output format: $ <date> <time> PRESSURE (mBar): <val> TEMPERATURE (C): <val> HUMIDITY (%RH): <val>


chargemon

Enters a continuous battery monitoring loop, printing the voltage and current of the battery bank every 5 seconds. Press CTRL-C to exit.

CPF> chargemon

pumpmon

Reads and prints the voltage and current from the pump energy monitor (LTC2946).

CPF> pumpmon

status

Prints the current voltage and current reading from the hotel energy monitor.

CPF> status

date [year month day hour minute second]

Without arguments, prints the current system date and time. With arguments, sets the RTC and system clock. Also opens a new engineering log file after setting the time.

CPF> date
CPF> date 2024 3 15 10 30 0

Arguments are space-separated integers (year, month, day, hour, minute, second).


sleep <n>

Puts the system to sleep for 2^(n-1) minutes (i.e., 1, 2, 4, 8, 16, 32, or 64 minutes). Valid values of n are 1–7.

CPF> sleep 3    # sleeps for 4 minutes (2^(3-1))

usb

Enters USB Mass Storage mode, exposing the SD card as a USB drive to a connected PC. The SD card must not have been initialized (i.e., no file system commands run yet in this session). The Mode pin on the bulkhead connector must also be set.

CPF> usb

The system blocks indefinitely in this mode. Reboot to exit.


reboot

Performs a hard reboot of the processor.

CPF> reboot

cpf <action>

Controls CPF mission state and runtime behavior.

CPF> cpf

Without an argument, prints usage. Available actions:

Action Effect
go Sets SurfaceOpsGo = true, triggering departure from the surface ops state
recoverytrue Enables manual/recovery profile mode (SV.ManualProfileMode = true)
recoveryfalse Disables manual/recovery profile mode
startdog Starts the hardware watchdog timer
fakemtsbd Injects a fake Iridium MT-SBD message for testing
exit Forces the state machine to the exit state, halting operations

resetprofile

Loads default configuration values, resets sleep variables, resets the mission start time, and writes the result to the SD card config.xml. Use this to restore a clean mission state before deployment.

CPF> resetprofile

fakeanchorwakeup

Sets up a simulated anchor wakeup scenario for testing: sets park time to 30 minutes, sets last state to anchor, sets LastProfileNum to 1, and configures timestamps to simulate 24 minutes of park time and 2 hours of mission time elapsed. Saves to SD card.

CPF> fakeanchorwakeup

store

Prints the current contents of the configuration memory store (both before and after a save to profile -1 / SMNotRunning). Used for diagnostics.

CPF> store

Notes

  • File paths on the SD card use backslash separators and start with \SD\, e.g. \SD\config.xml.
  • Relative paths are resolved against the current working directory set by cd.
  • The config command described in the Configuration Guide operates on the XML config file via the SystemConfigManager; changes there take effect after a reboot.
  • Commands that access the SD card will initialize the file system on first use. Once initialized, the usb command cannot be used until the next reboot.