Terastation Microcontroller Interface

From Buffalo NAS Wiki
Jump to navigation Jump to search

Most of the Terastation Models use an on-board microcontroller to handle extra functionality including but not limited to:

  • The LCD Display
  • The Fan Speed
  • LEDs
  • The Buzzer
  • Power management

I've created a Python library with lots of examples which can be found at:

https://github.com/1000001101000/Python_buffalo_libmicon


Serial Port Configuration

The serial device used to communicate with the microcontroller is usually /dev/ttyS1. If you install Debian on the TS3X00 it will be /dev/ttyS3.

Setting Value
Speed 38400
Parity Even
Data Bits 8
Stop Bits 1

Message Requirements

  • The sum of all bytes in a message must = 0 (including check byte)
  • The length of the data portion of a message must match the size reported in the first byte.

Message Examples

message type Operation + Length Command data checksum
Read: 0x80 (Length always 0) 0x58 0x28
Read Response: 0x82 (0x80 + Length) 0x58 (matches request) 0x00FF 0x27
Write: 0x02 (0x00 + Length) 0x58 0xFF00 0xA7
Write Response: 0x01 (0x00 + Length) 0x58 (matches request) 0x00 (OK) 0xA7

Response Codes

Code Description
0x00 OK
0xF4 Attempt to read something write-only
0xF5 Invalid Length
0xF7 Invalid Checksum

Commands/Settings

Address R/W Size Name Notes
0x00 W 0
0x01 W 0 lcd_init
0x02 W 0 boot_start
0x03 W 0 boot_end
0x04 W 0 boot_dramdt_ng
0x05 W 0 boot_dramad_ng
0x06 W 0 power_off
0x07 W 0 boot_flash_ok
0x08 W 0 boot_dram_ok
0x09 W 0 lcd_disp_animation
0x0a W 0
0x0b W 0 boot_error_del
0x0c W 0 shutdown_wait
0x0d W 0 shutdown_cancel
0x0e W 0 reboot
0x0f W 0 serialmode_console
0x10 W 0 serialmode_ups
0x11 W 0 ups_linefail_off
0x12 W 0 ups_linefail_on
0x13 W 0 ups_vender_apc
0x14 W 0 ups_vender_omron
0x15 W 0 lcd_disp_temp_on
0x16 W 0 lcd_disp_temp_off
0x17 W 0 lcd_changemode_button
0x18 W 0 lcd_changemode_auto
0x19 W 0 ups_shutdown_off
0x1a W 0 ups_shutdown_on
0x1b W 0 lcd_disp_fanspeed_on
0x1c W 0 lcd_disp_fanspeed_off
0x1d W 0 bz_disp_on
0x1e W 0 bz_disp_off
0x1f W 0
0x20 R/W 0 lcd_disp_linkspeed
0x21 R/W 0 lcd_disp_hostname
0x22 R/W 0 lcd_disp_ipaddress
0x23 R/W 0 lcd_disp_raidmode
0x24 R/W 0 lcd_disp_date
0x25 R/W 0 lcd_disp_buffer0
0x26 R/W 0 lcd_disp_buffer1
0x27 R/W 0 lcd_disp_buffer2
0x28 R/W 0 shutdown_ups_recover
0x29 R/W 0 wol_ready_on
0x2a R/W 0 wol_ready_off
0x2b R/W 0 lcd_disp_buffer3
0x2c R/W 0 lcd_disp_buffer4
0x2d R/W 0 lcd_disp_buffer5
0x2e R/W 0 lcd_disp_buffer6
0x2f R/W 0 lcd_disp_buffer7
0x30 R/W 1 Byte bz_on
0x31 R/W 1 Byte lcd_set_linkspeed 0x00 = nolink, 0x01 = 10h, 0x02 = 10f, 0x03 = 100h, 0x04 = 100f, 0x05 = 1000
0x32 R/W 1 Byte lcd_set_dispitem
0x33 R/W 1 Byte fan_set_speed
0x34 R 1 Byte system_get_mode ups_vender=apc ups_linefail=off ups_shutdown=off lcd_change=5s lcd_fanspeed=off lcd_temp=off bz_dispbutton=on
0x35 R/W 1 Byte system_set_watchdog
0x36 R/W 1 Byte int_get_switch_status
0x37 temp_get
0x38* R/W 1 Byte fan_get_speed
0x39 R 1 Byte lcd_get_dispplane
0x3a R/W 1 Byte lcd_set_bright 013AFA = bz_imhere
0x3b hdd_set_power
0x3c mcon_get_status
0x3d ups_test_port
0x3e R/W 1 Byte usb_set_power
0x3f R 1 Byte
0x40 R/W 1 Byte lcd_set_dispitem wol_ready_uboot_passed
0x41 R 1 Byte
0x42 R/W 1 Byte
0x43
0x44
0x45
0x46 R/W 1 Byte power_state
0x47
0x48
0x49
0x4a R/W 1 Byte
...
0x50 R/W 2 Bytes led_set_cpu_mcon
0x51 R/W 2 Bytes led_set_on_off
0x52 R/W 2 Bytes led_set_blink
0x53 R/W 2 Bytes bz_set_freq, bz_melody
0x54
0x55 R/W 2 Bytes
0x56
0x57 R/W 2 Bytes fan_get_speed_ex
0x58 R/W 2 Bytes sata_led_set_on_off
0x59 R/W 2 Bytes sata_led_set_blink
0x5A R/W 2 Bytes
...
0x60 R/W 4 Bytes lcd_set_disk_capacity
...
0x70 R/W 6 Bytes lcd_set_date one-byte each for year,month,day,hour,minute,second. Auto increments every second.
0x71* R/W 6 Bytes
...
0x80 R/W 16 Bytes lcd_set_hostname ASCII, sets top row
0x81 R/W 16 Bytes lcd_set_ipaddress ASCII, sets bottom row
0x82 R/W 16 Bytes lcd_set_raidmode ASCII, sets top row of lcd raidmode
0x83 R 16 Bytes mcon_get_version model/version, example "TSQVL Ver1.5"
0x84 R 16 Bytes mcon_get_taskdump
...
0x90 R/W 32 Bytes ??? sets lcd_buffer0
0x91 R/W 32 Bytes ??? sets lcd_buffer1
0x92 R/W 32 Bytes ??? sets lcd_buffer2
0x93 R/W 32 Bytes boot_device_error sets lcd_buffer0
0x94 R/W 32 Bytes lcd_set_raidmode32 ASCII, 16 Characters per row
...
0xa0 R/W 32 Bytes lcd_set_buffer0 ASCII, 16 Characters per row
0xa1 R/W 32 Bytes lcd_set_buffer1 ASCII, 16 Characters per row
0xa2 R/W 32 Bytes lcd_set_buffer2 ASCII, 16 Characters per row
0xa3 R/W 32 Bytes lcd_set_buffer3 ASCII, 16 Characters per row
0xa4 R/W 32 Bytes lcd_set_buffer4 ASCII, 16 Characters per row
0xa5 R/W 32 Bytes lcd_set_buffer5 ASCII, 16 Characters per row
0xa6 R/W 32 Bytes lcd_set_buffer6 ASCII, 16 Characters per row
0xa7 R/W 32 Bytes lcd_set_buffer7 ASCII, 16 Characters per row
...