Expand description

Neotron-BMC-Commands

Command codes for communication with the Neotron Board Management Controller (NBMC).

System Registers

AddressNameTypeContainsLength
0x00Protocol VersionROThe NBMC protocol version, [1, 0, 0]3
0x01Firmware VersionROThe NBMC firmware version, as a null-padded UTF-8 string32
0x10Interrupt StatusR/W1CWhich interrupts are currently active, as a bitmask.2
0x11Interrupt ControlR/WWhich interrupts are currently enabled, as a bitmask.2
0x20Button StatusROThe current state of the buttons1
0x21System TemperatureROTemperature in °C, as an i81
0x22System Voltage (Standby 3.3V rail)ROVoltage in Volts/32, as a u81
0x23System Voltage (Main 3.3V rail)ROVoltage in Volts/32, as a u81
0x24System Voltage (5.0V rail)ROVoltage in Volts/32, as a u81
0x25Power ControlR/WEnable/disable the power supply1
0x30UART Receive/Transmit BufferFIFOData received/to be sent over the UARTup to 64
0x31UART FIFO ControlR/WSettings for the UART FIFO1
0x32UART ControlR/WSettings for the UART1
0x33UART StatusR/W1CThe current state of the UART1
0x34UART Baud RateR/WThe UART baud rate in bps, as a u32le4
0x40PS/2 Keyboard Receive/Transmit BufferFIFOData received/to be sent over the PS/2 keyboard portup to 16
0x41PS/2 Keyboard ControlR/WSettings for the PS/2 Keyboard port1
0x42PS/2 Keyboard StatusR/W1CCurrent state of the PS/2 Keyboard port1
0x50PS/2 Mouse Receive/Transmit BufferFIFOData received/to be sent over the PS/2 Mouse portup to 16
0x51PS/2 Mouse ControlR/WSettings for the PS/2 Mouse port1
0x52PS/2 Mouse StatusR/W1CCurrent state of the PS/2 Mouse port1
0x60I²C Receive/Transmit BufferFIFOData received/to be sent over the I²C Busup to 16
0x61I²C FIFO ControlR/WSettings for the I²C FIFO1
0x62I²C ControlR/WSettings for the I²C Bus1
0x63I²C StatusR/W1CCurrent state of the I²C Bus1
0x64I²C Baud RateR/WThe I²C clock rate in Hz, as a u32le4
0x70Speaker Tone DurationR/WDuration of the note, in units of 10ms (0 = stop playing)1
0x71Speaker Tone Period (high)R/WPeriod of note (in 48kHz ticks), MSB1
0x72Speaker Tone Period (low)R/WPeriod of note (in 48kHz ticks), LSB1
0x73Speaker Tone Duty CycleR/WDuty cycle of speaker PWM square wave (127 = 50%)1

The register types are:

  • RO - read only register, where writes will return an error
  • R/W - read/write register
  • R/W1C - reads as usual, but when writing a 1 bit clears that bit position and a 0 bit is ignored
  • FIFO - a first-in, first-out buffer

Address 0x00 - Protocol Version

This read-only register returns the protocol version supported. The protocol version includes the set of registers, and the meaning of the fields within those registers. A Host should first verify that the NBMC it is talking to is semantically compatible before reading any other registers.

The three bytes are major, minor and patch. This document corresponds to [1, 0, 0] (or v1.0.0).

Address 0x01 - Firmware Version

This read-only register returns the firmware version of the NBMC, as a UTF-8 string. The register length is always 32 bytes, and the string is null-padded. We also guarantee that the firmware version will always be less than or equal to 31 bytes, so you can also treat this string as null-terminated.

An official release will have a version string of the form tags/v1.2.3. An unofficial release might be heads/develop-dirty. It is not recommended that you rely on these formats or attempt to parse the version string. It is however useful if you can quote this string when reporting issues with the firmware.

Address 0x10 - Interrupt Status

This eight bit register indicates which Interrupts are currently ‘active’. An Interrupt will remain ‘active’ until a word is written to this register with a 1 bit in the relevant position.

BitInterrupt
7Voltage Alarm
6Button State Change
5UART TX Empty
4UART RX Not Empty
3I²C TX Empty
2I²C RX Not Empty
1PS/2 Mouse RX Not Empty
0PS/2 Keyboard RX Not Empty

Address 0x11 - Interrupt Control

This eight bit register indicates which Interrupts are currently ‘enabled’. The IRQ_nHOST signal is a level interrupt and it will be active (LOW) whenever the value in the Interrupt Control register ANDed with the Interrupt Status register is non-zero.

The bits have the same ordering as the Interrupt Status register.

Address 0x20 - Button Status

This eight-bit register indicates the state of the power button.

Note that if the power button is held down for three seconds, the system will power-off instantly, regardless of what the host does.

Note also that is it not possible to sample the reset button - pressing the reset button will instantly assert the system reset line, rebooting the Host.

BitsMeaning
7-1Reserved for future use
0Power Button: 0 = normal, 1 = pressed

Address 0x21 - System Temperature

This eight-bit register provides the current system temperature in °C, as measured on the STM32’s internal temperature sensor. It is updated around once a second.

Address 0x22 - System Voltage (Standby 3.3V rail)

This eight-bit register provides the current 3.3V rail voltage in units of 1/32 of a Volt. It is updated around once a second. A value of 105 (3.28V) to 106 (3.31V) is nominal. An interrupt is raised when the value exceeds 3.63V (116) or is lower than 2.97V (95).

Address 0x23 - System Voltage (Main 3.3V rail)

This eight-bit register provides the current 3.3V rail voltage in units of 1/32 of a Volt. It is updated around once a second. A value of 105 (3.28V) to 106 (3.31V) is nominal. An interrupt is raised when the value exceeds 3.63V (116) or is lower than 2.97V (95).

Address 0x24 - System Voltage (5.0V rail)

This eight-bit register provides the current 3.3V rail voltage in units of 1/32 of a Volt. It is updated around once a second. A value of 160 (5.00V) is nominal. An interrupt is raised when the value exceeds 5.5V (176) or is lower than 4.5V (144).

Address 0x25 - Power Control

This eight-bit register controls the main DC/DC power supply unit. The Host should disable the DC/DC supply (by writing zero here) if it wishes to power down.

BitsMeaning
7-1Reserved for future use
0DC/DC control: 0 = off, 1 = on

Address 0x30 - UART Receive/Transmit Buffer

TODO

Address 0x31 - UART FIFO Control

TODO

Address 0x32 - UART Control

TODO

Address 0x33 - UART Status

TODO

Address 0x34 - UART Baud Rate

TODO

Address 0x40 - PS/2 Keyboard Receive/Transmit Buffer

TODO

Address 0x41 - PS/2 Keyboard Control

TODO

Address 0x42 - PS/2 Keyboard Status

TODO

Address 0x50 - PS/2 Mouse Receive/Transmit Buffer

TODO

Address 0x51 - PS/2 Mouse Control

TODO

Address 0x52 - PS/2 Mouse Status

TODO

Address 0x60 - I²C Receive/Transmit Buffer

TODO

Address 0x61 - I²C FIFO Control

TODO

Address 0x62 - I²C Control

TODO

Address 0x63 - I²C Status

TODO

Address 0x64 - I²C Baud Rate

TODO

Address 0x70 - Speaker Tone Duration

Sets the duration of the tone to be played, and starts the tone playing. You should set the other three registers (if required) before setting this register.

There is no way to know when the tone is ended; the host should keep track of the duration it set and wait the appropriate period of time.

Address 0x71 - Speaker Tone Period (High)

Sets the upper 8 bits of the tone period. This is the inverse of frequency, in 48 kHz units. A value of 48000 / 440 = 109 = 0x006D will give you a Concert-pitch A (440 Hz). Write that value as 0x00 in the high register and 0x6D in the low register.

Address 0x72 - Speaker Tone Period (Low)

Sets the lower 8 bits of the tone period. See Speaker Tone Period (High) for details.

Address 0x73 - Speaker Tone Duty Cycle

Sets the duty-cycle of the speaker tone. A value of 127 is 50:50 (a square wave).

Licence

This code is licenced under the Blue Oak Model License 1.0.0. See:

Our intent behind picking this licence is to allow this code to be freely reused, both in open-source and commercially licensed products.

Enums