Skip to content

Firmware Specifications

Complete technical specifications for the Multiflexmeter 3.7.0 firmware platform.

SpecificationValue
Version0.0.0 (Development, set via build flags)
Build SystemPlatformIO
FrameworkArduino Core
LanguageC++ (C++11)
CompilerAVR-GCC
Flash Usage~50-60 KB (application + LMIC)
RAM Usage~4-6 KB (LMIC buffers + application)
EEPROM Usage41 bytes (configuration)
LibraryVersionPurposeSize Impact
MCCI Arduino LoRaWAN (LMIC)Git (mcci-catena/arduino-lmic)LoRaWAN protocol stack~30KB flash
MedianFilterLocal (lib/)Sensor data filtering (available but unused)0KB
Adafruit SleepyDog^1.4.0Declared dependency (unused in current code)0KB
ParameterValue
RegionEU868
ClassClass A
ActivationOTAA (Over-The-Air)
Data RateDR0-DR7 (SF12-SF7)
TX Power14 dBm default
Duty CycleEU regulations compliant
Port1 (application data)
ParameterValue
ProtocolSMBus/I²C
Clock Speed80 kHz (F_SMBUS = 80000L in smbus.cpp)
Slave Address0x36 (SENSOR_BOARD_ADDR)
CommandsCMD_PERFORM (0x10), CMD_READ (0x11)
Data FormatVariable length block read
OffsetSizeFieldDescription
0x004 bytesMAGICMagic header “MFM\0” (validation)
0x042 bytesHW_VERSIONHardware version (MSB, LSB)
0x068 bytesAPP_EUIApplication EUI (LSB-first for LMIC)
0x0E8 bytesDEV_EUIDevice EUI (LSB-first for LMIC)
0x1616 bytesAPP_KEYApplication Key (MSB-first, 128-bit)
0x262 bytesMEASUREMENT_INTERVALInterval in seconds (little-endian uint16_t)
0x281 byteUSE_TTN_FAIR_USE_POLICYFair use flag (0=disabled, 1=enabled)

Versions are encoded as 16-bit values with the following bit layout:

// Version encoding: [proto:1][major:5][minor:5][patch:5]
// Bit 15: Proto (0=dev, 1=release)
// Bits 14-10: Major version (0-31)
// Bits 9-5: Minor version (0-31)
// Bits 4-0: Patch version (0-31)
// Example: v3.7.0 (release) = 0b1 00011 00111 00000 = 0x8E00
version conf_getHardwareVersion(); // From EEPROM HW_VERSION
version conf_getFirmwareVersion(); // From build flags
uint16_t versionToUint16(version v); // Convert to uint16 for transmission
Board IDMCUFlashRAMClockCore
mfm_v3_m1284pATmega1284P128KB16KB8MHzMightyCore
mfm_v3ATmega328P32KB2KB8MHzMiniCore
build_flags =
-DCFG_eu868=1
-DCFG_sx1276_radio=1
-DARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS
-DSERIAL_BAUD=115200
ModeCurrent DrawDurationNotes
Active~50-100mA<1 secondDuring transmission
Sleep~5-10µA95%+ of timeLMIC power management
Sensor Read~20-30mA<100msI²C communication
EventIntervalVariationNotes
Sensor Perform → Read10 secondsFixedMEASUREMENT_SEND_DELAY_AFTER_PERFORM_S
Join → Version Ping45 secondsFixedMEASUREMENT_DELAY_AFTER_PING_S
Measurement Interval20-4270 secondsConfigurableFrom EEPROM, bounds checked
Reset Delay5 secondsFixedAfter 0xDEAD command
LoRaWAN TXDuty cycle limitedEU868 regulationsMax 1% duty cycle
Watchdog Reset8 secondsHardware timerSafety mechanism
SectionSizeDescription
Application~58KBMain firmware code
LMIC Library~30KBLoRaWAN protocol stack
Arduino Core~20KBHardware abstraction (MightyCore)
Free Space~20KBAvailable for expansion
Total Available128KBATmega1284P Flash
SectionSizeDescription
LMIC Buffers~4KBLoRaWAN TX/RX buffers and state
Application~2KBGlobal variables and buffers
Stack~2KBFunction call stack
Heap~8KBDynamic allocation (if used)
Total Available16KBATmega1284P SRAM
SectionSizeDescription
Configuration41 bytesDevice configuration at address 0x00
Free Space4055 bytesAvailable for extensions
Total Available4KBATmega1284P EEPROM
FunctionPurposeCall Frequency
setup()Board, sensor, LMIC initializationOnce at boot
loop()LMIC job scheduler onlyContinuous (os_runloop_once())
onEvent()LMIC event handlerOn LoRaWAN events
job_performMeasurements()Trigger sensor measurementLMIC scheduled
job_fetchAndSend()Read and transmit sensor dataAfter 10s delay
job_pingVersion()Send version after joinAfter join completion
scheduleNextMeasurement()Calculate next measurement timeAfter transmission
processDownlink()Handle downlink commandsOn RX data
// Actual job functions used in firmware
void job_pingVersion(osjob_t *job); // Send version info after join
void job_performMeasurements(osjob_t *job); // Start sensor measurement
void job_fetchAndSend(osjob_t *job); // Read sensor and transmit
void job_reset(osjob_t *job); // Device reset via watchdog
void job_error(osjob_t *job); // Error state (infinite loop)
IDE VersionSupportNotes
Arduino IDE 1.8.xYesRecommended
Arduino IDE 2.xYesModern interface
PlatformIOYesPrimary development
CoreBoardCompatibility
MightyCoreATmega1284PRequired for mfm_v3_m1284p
MiniCoreATmega328PRequired for mfm_v3

MFM v2.0 Firmware Specification (Reference)

Section titled “MFM v2.0 Firmware Specification (Reference)”

📄 Download Firmware Specification (PDF)