Skip to content

Programming & Connectors

This guide provides detailed information about programming the Multiflexmeter 3.7.0 board and explains all external connectors.

To program the Multiflexmeter 3.7.0, you need:

  • Atmel-ICE (or compatible AVR ISP programmer)
    • USBasp
    • AVR Dragon
    • Arduino as ISP
  • 6-pin ISP cable (2x3 connector, 2.54mm pitch)
  • Power source (battery or external 3.3V supply)

Connect your programmer to the J5 - ICSP Header on the board.

Location: Main board
Type: 2x3 pin header (male, 2.54mm pitch)
Purpose: In-System Programming for firmware upload

┌─────────────┐
│ 1 MISO VCC 2 │
│ 3 SCK GND 4 │
│ 5 RST MOSI 6 │
└─────────────┘
PinSignalDirectionDescription
1MISOMaster In Slave Out (data from MCU to programmer)
2VCC+3.3V power (can power board from programmer)
3SCKSerial Clock (programming clock signal)
4GND-Ground reference
5RESETMCU Reset (active low, pulled high on board)
6MOSIMaster Out Slave In (data from programmer to MCU)

The Atmel-ICE uses a standard 6-pin AVR ISP cable. Connect as follows:

Atmel-ICE J5 Header
========= =========
Pin 1 (MISO) ───── Pin 1 (MISO)
Pin 2 (VCC) ───── Pin 2 (VCC)
Pin 3 (SCK) ───── Pin 3 (SCK)
Pin 4 (MOSI) ───── Pin 6 (MOSI)
Pin 5 (RST) ───── Pin 5 (RST)
Pin 6 (GND) ───── Pin 4 (GND)

Location: Main board
Type: 1x6 pin header (female socket, 2.54mm pitch)
Purpose: Serial UART debugging and monitoring

PinSignalDescription
1NCNo connection
2TXDUART Transmit from MCU (AVR_TX0)
3RXDUART Receive to MCU (AVR_RX0)
4NCNo connection
5NCNo connection
6GNDGround

Connect a standard FTDI USB-to-Serial adapter:

FTDI Adapter J4 Header
============ =========
GND ────────────── Pin 6 (GND)
TXD ────────────── Pin 3 (RXD) ← Cross connection
RXD ────────────── Pin 2 (TXD) ← Cross connection
VCC ────────────── Leave disconnected

Serial Settings:

  • Baud Rate: 115200
  • Data Bits: 8
  • Parity: None
  • Stop Bits: 1
  • Flow Control: None

Location: Main board
Type: 2x3 pin header (male, 2.54mm pitch)
Purpose: External I²C/SMBus device connection

┌─────────────┐
│ 1 SCL VCC 2 │
│ 3 SDA VCC 4 │
│ 5 ALERT SCL 6 │
└─────────────┘
PinSignalDescription
1SCLI²C Clock line
2VCC+3.3V Power output
3SDAI²C Data line
4VCC+3.3V Power output (duplicate)
5SMBALERTSMBus Alert signal (optional)
6SCLI²C Clock line (duplicate)

I²C Specifications:

  • Bus Speed: 80kHz (configured in firmware)
  • Pull-up Resistors: Onboard 4.7kΩ
  • Default Sensor Address: 0x36

Location: Main board
Purpose: Sensor module expansion slots

PinSignalDescription
1SCLI²C Clock
2SDAI²C Data
3SMBALERTSMBus Alert
PinSignalDescription
1VCC+3.3V Power
2SDAI²C Data
3SCLI²C Clock
  1. Connect Atmel-ICE to your computer via USB
  2. Connect the 6-pin ISP cable from Atmel-ICE to J5 on the board
  3. Verify cable orientation (Pin 1 to Pin 1)
  4. Power the board if not powering from programmer

Set your programmer to 3.3V target voltage:

Terminal window
# Atmel-ICE automatically detects voltage from target board
# Verify with:
pio run -t upload --verbose

Using PlatformIO:

Terminal window
# Build and upload
pio run -t upload
# Upload only (if already built)
pio run -t upload --target nobuild

Using AVRdude directly:

Terminal window
avrdude -p m1284p -c atmelice_isp -P usb -B 0.25 \
-U flash:w:.pio/build/mfm_v3_m1284p/firmware.hex:i
Terminal window
avrdude -p m1284p -c atmelice_isp -P usb \
-U lfuse:w:0xFF:m \
-U hfuse:w:0xD1:m \
-U efuse:w:0xFF:m

Fuse Settings Explained:

  • LFUSE (0xFF): External crystal oscillator, no clock divide
  • HFUSE (0xD1): EEPROM preserved on chip erase, 2.7V brownout
  • EFUSE (0xFF): Brown-out detection enabled

Connect FTDI adapter to J4 and open serial monitor:

Terminal window
pio device monitor

You should see:

Build at: Oct 25 2025 00:13:00
Initializing...
EV_JOINING

Problem: avrdude: initialization failed, rc=-1

Solution:

  • Check cable connections at J5
  • Verify programmer voltage is set to 3.3V
  • Ensure board is powered
  • Try slower programming speed: -B 2.0

Problem: avrdude: Expected signature for ATmega1284P is XX XX XX

Solution:

  • Wrong chip selected - verify -p m1284p in command
  • Check if board uses ATmega1284P (not 328P)
  • Verify oscillator is running (fuse settings)

Problem: Device not responding after fuse programming

Solution:

  • Fuses may have disabled external oscillator
  • Requires high-voltage parallel programmer to recover
  • Contact board manufacturer for recovery service

Problem: No output on serial monitor

Solution:

  • Verify FTDI connections (TX ↔ RX are crossed)
  • Check baud rate is set to 115200
  • Confirm firmware was compiled with debug output enabled
  • Verify GND connection between FTDI and board

Problem: Garbage characters on serial monitor

Solution:

  • Wrong baud rate - set to 115200
  • Check that board crystal is 16MHz as expected
  • Verify FTDI adapter is 3.3V compatible