<font color=red>MIPSel LinkStation | Some of these commands have not yet been tested on the mipsel-hdhlan LinkStation. Please report any differences.</font>

+

{{Template:Articles}}

+

''<font color=red><small>

+

This article

+

Based on work by naxalite, wth, frontalot, and noName.

+

Originally by frontalot.

+

at Linkstationwiki.org

+

</small></font>''<br>

+

{{Warning| Some of these commands have not yet been tested on the mipsel-hdhlan LinkStation. Please report any differences}}

−

The AVR controls much of the LinkStation hardware, including the power button and LED indicator. It is controlled by the commands sent to <tt>/dev/ttyS0</tt>. To send commands to the AVR:

+

The MIPSel [[LS2]] actually does not contain an [[AVR]] (other LS versions do). AVRs are microcontrollers from Atmel and an Atmel brand, while the LS2 contains a Freescale (Motorola) microcontroller [http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC68HC908JL8.pdf MC68HC908JL8], which is based upon the Motorola 6808 microprocessor, which is a decendant of the classic Motorola 6800 microprocessor, first released in 1975 at the dawn of microprocessors.

+

The microcontroller serves the same purpose as the AVRs in other LinkStation models. It controls much of the LinkStation hardware, including the power button and LED indicator. It is controlled by the commands sent to <tt>/dev/ttyS0</tt>.

+

+

To send commands to the microcontroller use e.g.:

echo -n "commands" > /dev/ttyS0

echo -n "commands" > /dev/ttyS0

−

{| style="width:75%; background:#E0FFFF" border="1" align=center

+

{| style="background:#DDDDDD; color:black"

−

||'''Command''' ||'''Action/Code'''

+

|style="background:#CCCCCC; color:green" |'''Command'''

+

|style="background:#CCCCCC; color:green" |'''Action/Code'''

|-

|-

| \30\30\30\30 || Stops smbd and atalkd if /dev/hda3 is not mounted to /mnt. Sent by /www/script/melsub_diskcheck.sh.

| \30\30\30\30 || Stops smbd and atalkd if /dev/hda3 is not mounted to /mnt. Sent by /www/script/melsub_diskcheck.sh.

Line 15:

Line 26:

| \\\\ || Low-speed cooling fan rotation.

| \\\\ || Low-speed cooling fan rotation.

|-

|-

−

| >>>> || Unknown. Sent by mc_ctld on boot.

+

| >>>> || Unknown. Sent by [[#mc_ctld|mc_ctld]] on boot.

|-

|-

−

| AAAA || Unknown. Sent by mc_ctld on boot.

+

| AAAA || Unknown. Sent by [[#mc_ctld|mc_ctld]] on boot.

|-

|-

| CCCC || Sent by shutdown -r now (reboot).

| CCCC || Sent by shutdown -r now (reboot).

Line 23:

Line 34:

| EEEE || Sent by shutdown -h now (halt).

| EEEE || Sent by shutdown -h now (halt).

|-

|-

−

| FFFF || Unknown. Sent by mc_ctld on boot.

+

| FFFF || Unknown. Sent by [[#mc_ctld|mc_ctld]] on boot.

|-

|-

−

| JJJJ || Unknown. Sent by mc_ctld on boot.

+

| JJJJ || Unknown. Sent by [[#mc_ctld|mc_ctld]] on boot.

|-

|-

−

| KKKK || Unknown. Sent by mc_ctld on boot.

+

| KKKK || Unknown. Sent by [[#mc_ctld|mc_ctld]] on boot.

|-

|-

−

| QQQQ || Unknown. Sent by mc_ctld on set timer.

+

| QQQQ || Unknown. Sent by [[#mc_ctld|mc_ctld]] on set timer.

|-

|-

| RRRR || End of clear flash memory.

| RRRR || End of clear flash memory.

Line 62:

Line 73:

|}

|}

Most of this information courtesy of http://www.yamasita.jp/linkstation.en/index.html.

Most of this information courtesy of http://www.yamasita.jp/linkstation.en/index.html.

+

+

== Pin Functions ==

+

For an in depth description of the pin functions of the microcontroller see [[Hardware_Hacks_for_the_LS2#The_AVR|Kuroguy's analysis of the pin functions]]

+

+

+

<!-- Do not change the next header, other pages link to the section by that header name -->

+

== mc_ctld ==

+

+

'''mc_ctld''' is the ''microcontroller control [[w:Daemon (computer software)|daemon]]''. It is a piece of software running on the [[LS2]] under Linux, which communicates with the LS2's Freescale housekeeping microcontroller. It is proprietary [[w:Melco|Buffalo]] software, and Buffalo refuses to release the source code. Therefore, the exact inner working of the software is not known. However, its general function is known, due to extensive analysis which has been done on the [[LS1]] equivalent of that software ([[ppc_uartd]]), and a free replacement has been written [[avr_evtd]].

+

+

The daemon is started during system boot in run-level 2, and stopped in run-level 0 (system halt) and 6 (system reboot). The startup script is ''/etc/init.d/mc_ctld'', while the daemon binary itself is ''/usr/sbin/mc_ctld''.

+

+

The daemon's primary task it to reset the [[w:Watchdog timer|watchdog timer]] in the microcontroller in regular intervals. So that timer doesn't trigger and doesn't initiate a reboot. '''mc_ctld''' monitors some system health indicators, like the [[Samba]] process (via using the process ID stored in ''/var/run/smbd.pid''). If these fail, it initiates a reboot (or stops resetting the timer).

+

+

It also observes ''/etc/melco/timer_status'' to adhere to "sleep / wakeup" settings - an LS feature configurable via the web admin interface at [http://linkstation/cgi-bin/setup-sleep.cgi http://linkstation/cgi-bin/setup-sleep.cgi]. The web admin interface stores the configured values in ''/etc/melco/timer_status'' and '''mc_ctld''' reads them and forwards them to the housekeeping microcontroller.

+

+

The communication with the microcontroller is done via ''/dev/ttyS0'', using the commands listed at the beginning of this article or similar, currently not reverse-engineered commands.

+

+

'''mc_ctld''''s relatively late position in the LinkStation's boot procedure can sometimes be the cause of [[brick]]ing a LinkStation. If the preceding startup scripts take too long, the watchdog timer can trigger before '''mc_ctld''' was started and had a chance to reset the timer. The LS will then repeatedly reboot while still in the boot procedure. Usually this is not a problem with the standard system configuration, but it is known to become a problem if the startup of additional services had been added before the '''mc_ctld''' startup. Therefore it is highly recommended to add own rc startup scripts after start sequence S95 only.

+

+

[[Category:LS2]]

+

[[Category:Hardware]]

Latest revision as of 06:29, 2 August 2007

This article
Based on work by naxalite, wth, frontalot, and noName.
Originally by frontalot.
at Linkstationwiki.org

WARNING!

Some of these commands have not yet been tested on the mipsel-hdhlan LinkStation. Please report any differences

The MIPSel LS2 actually does not contain an AVR (other LS versions do). AVRs are microcontrollers from Atmel and an Atmel brand, while the LS2 contains a Freescale (Motorola) microcontroller MC68HC908JL8, which is based upon the Motorola 6808 microprocessor, which is a decendant of the classic Motorola 6800 microprocessor, first released in 1975 at the dawn of microprocessors.

The microcontroller serves the same purpose as the AVRs in other LinkStation models. It controls much of the LinkStation hardware, including the power button and LED indicator. It is controlled by the commands sent to /dev/ttyS0.

To send commands to the microcontroller use e.g.:

echo -n "commands" > /dev/ttyS0

Command

Action/Code

\30\30\30\30

Stops smbd and atalkd if /dev/hda3 is not mounted to /mnt. Sent by /www/script/melsub_diskcheck.sh.

Pin Functions

mc_ctld

mc_ctld is the microcontroller control daemon. It is a piece of software running on the LS2 under Linux, which communicates with the LS2's Freescale housekeeping microcontroller. It is proprietary Buffalo software, and Buffalo refuses to release the source code. Therefore, the exact inner working of the software is not known. However, its general function is known, due to extensive analysis which has been done on the LS1 equivalent of that software (ppc_uartd), and a free replacement has been written avr_evtd.

The daemon is started during system boot in run-level 2, and stopped in run-level 0 (system halt) and 6 (system reboot). The startup script is /etc/init.d/mc_ctld, while the daemon binary itself is /usr/sbin/mc_ctld.

The daemon's primary task it to reset the watchdog timer in the microcontroller in regular intervals. So that timer doesn't trigger and doesn't initiate a reboot. mc_ctld monitors some system health indicators, like the Samba process (via using the process ID stored in /var/run/smbd.pid). If these fail, it initiates a reboot (or stops resetting the timer).

It also observes /etc/melco/timer_status to adhere to "sleep / wakeup" settings - an LS feature configurable via the web admin interface at http://linkstation/cgi-bin/setup-sleep.cgi. The web admin interface stores the configured values in /etc/melco/timer_status and mc_ctld reads them and forwards them to the housekeeping microcontroller.

The communication with the microcontroller is done via /dev/ttyS0, using the commands listed at the beginning of this article or similar, currently not reverse-engineered commands.

mc_ctld's relatively late position in the LinkStation's boot procedure can sometimes be the cause of bricking a LinkStation. If the preceding startup scripts take too long, the watchdog timer can trigger before mc_ctld was started and had a chance to reset the timer. The LS will then repeatedly reboot while still in the boot procedure. Usually this is not a problem with the standard system configuration, but it is known to become a problem if the startup of additional services had been added before the mc_ctld startup. Therefore it is highly recommended to add own rc startup scripts after start sequence S95 only.