Mindstorms NXT Architecture

The NXT brick is based on a board build by Atmel, the AT91SAM7256. That board is based around an arm7 32 bit CPU, a little RAM and Flash memory, and various peripherals, mostly clocks and interfaces to standardized busses. Lego modified this basic design, basically by plugging peripherals into the busses, and adding some security features.

The board's main peripherals are:

  • An Atmel AVR coprocessor on the I2C bus
  • An USB controller
  • A BlueCore 4 Bluetooth controller
  • An UltraChip 1601-based LCD display
  • An I2S sound chip and mono speaker

Coprocesseur

The Atmel AVR coprocessor is in charge of handling a few of the additional components added by Lego:

  • The motor outputs
  • The board's main power supply
  • The buttons beneath the display
  • The battery charge sensor

The AVR coprocessor is linked with the main CPU over the I2C bus. The two processors periodically exchange data structures over the bus: The AVR receives motor and power supply commands, and sends back the state of the buttons and the battery charge level.

For each motor, the output command sets the output power (-100 to 100) and the braking profile (coast or brake). In addition, the power supply control function can be accessed by transmitting certain "magic" motor power values. These commands allow powering down the brick, or switching it to reset mode to flash a new firmware.

One of the AVR's stranger functions is a protection system, which prevents stock Atmel AT91SAM7S firmwares from running correctly on the NXT: unless a special unlock code is transmitted to the AVR within 5 minutes of bootup, the AVR will power down the entire board. This magic code also serves as the initial handshake between the core and the AVR; until the AVR is unlocked, none of the AVR's functions can be accessed. Fortunately, Lego is awesome and provides the unlock code in the Hardware Developer Kit.

USB controller

The USB controller enables the brick to communicate with an USB host. Unfortunately, the controller on the board is a peripheral only controller, meaning that the brick cannot itself function as a host (which would be desirable, for instance, to connect a USB key to expand the NXT's memory capacity).

Bluetooth controller

Bluetooth communication is handled by an independent BlueCore daughter board, connected to the main CPU over a serial line. The daughter board has its own processor, memory and firmware, and exposes a simplified commandset to the main cpu, enabling it to do things at a fairly high level: scanning, associating, transmitting packets...

In the Lego firmware, the Bluetooth controller can either function in master mode, in which it can communicate with up to 3 bluetooth slaves, or in slave mode, where it is locked to a single master. It is not yet clear to us whether this is an arbitrary limitation imposed by the Lego firmware, or a limitation set by the BlueCore firmware.

LCD display

The LCD screen is managed by a specialized chipset made by UltraChip, the UC1601. This chip is connected to the CPU over the SPI bus, and exposes both a simple commandset for calibrating the screen, and a simple "data shovelling" mode, where the raw screen data is shoveled over the bus to the UC1601's internal memory.

Documentation on the UC1601 is surprisingly hard to find on the internet, since UltraChip no longer makes the specification available on their website. However, the people at UltraChip do apparently provide the datasheet on request, if you mail their support address.

I2S and Speaker

The board's sound comes from a sound chip that conforms to the I2S specification, which is connected to the core over the SCI bus. The basic mode of operation is to configure a transmit frequency, and then to stream digital data to the I2S chip, which in turn drives the brick's loudspeaker. The sound chip has no support for generating sound: if you want to eg. generate a simple sine wave, the sine wave needs to be generated to a PCM buffer, and the PCM buffer streamed to the sound chip.

Note that the sound chip is powered by the circuit controlled by the AVR coprocessor. Until the AVR is unlocked, no sound can be output.