Project Blacksphere Intro Hardware 331x/3330 ARM DSP Phone models Peripherals CCont LCD MBUS Nokia OS Software Glossary of Terms Todo Credits Forum Guestbook

Introduction

MBUS is uni-directional asynchronous serial communication circuitry. The protocol is compatible with RS232D to some degree.

It turns out to be quite easy to drive, and useful, the only inherent problems it has it that it's slow and single duplex. But can be interrupt driven and no big synchronisation and realtime issues on either side. Good enough for debugging and simple tty-like remote interfaces.

Implementation

An example implementation can be found in the MADos CVS repository in hw/mbus.c.

The numbers

Maximum baudrate 9600 (probably)
Data 8 bit
Parity Odd
Flow control None
Stopbits 1
Fifo 1 byte

You can even use a terminal program like Minicom to connect, use the settings '9600 8O1'.

I/O

MBUS is driven through four memory mapped I/O ports of 8 bits:

PUPControl
Baudrate(?), initialisation
MBUSControl
Initialisation, status
MBUSStatus
Status
MBUSData
Send/receive bytes
See the Blacksphere I/O map for more thorough description of the registers.

Interrupts

MBUS is controlled by two interrupts:

FIQ3
MBUS timer
FIQ2
MBUS receive/transmit

Initialisation sequence

Make sure both MBUS IRQs are disabled while doing the initialisation.

Initial values:

Register Value
PUPControl 00001000 (0x08)
MBUSControl 00000000 (0x00)
MBUSStatus 11010000 (0xD0)

  1. Clear bit 6(0x40) of PUPControl
  2. MBUSControl := 0x80
  3. Wait until MBUSControl bit 7 is clear.
  4. Clear bit 3 (0x08) of PUPControl
  5. Clear bit 0-2 of PUPControl (set baudrate to 9600)
  6. Set bit 3 (0x08) of PUPControl again
  7. When interrupts are used: Enable FIQ 2 and disable FIQ 3
  8. Set bit 2 and 3 of MBUSControl
  9. Read MBUSData (clears read status)
  10. Set bit 0-2 of MBUSStatus
  11. Set bit 6 of MBUSControl (enable receive mode)

Receiving a byte

Read from MBUSData.

Transmission

Starting transmission

Test bit 6 (0x40) of MBUSStatus, if not set, we cannot start transmission (?)

This:

  1. Disable FIQ3
  2. Wait
  3. Enable FIQ3
Or this:

  1. MBUSData := First Byte
  2. Set bit 5 (0x20) of MBUSControl (Enable send mode)

Writing a byte

Write to MBUSData.

After first byte, set bit 5 (0x20) of MBUSControl

Ending transmission

When finished sending data, clear bit 5 (0x20) of MBUSControl

Error a byte(Resync/reset)

Read from MBUSData

If state is send -> clear bit 5 of MBUSControl

clear bit 6 of MBUSControl

set bits 0,1,2 of MBUSStatus

Interrupt handler

FIQ2

Disable FIQ3

Receive

If MBUSControl bit 6 (0x40) is set (receive mode enabled):

  1. if MBUSStatus bit 0-2 are != 0
    -> Error this and resynchronize?
  2. else if MBUSStatus bit 5(0x20)
    -> receive byte

Send

if bit 4 of MBUSStatus(send ready) and bit 5 (0x20) of MBUSControl (send mode)

-> 'send byte'

Cleanup

Enable FIQ3

Timer(FIQ3)

Signifies timeout and restarts receiver? This is still a mystery.

  1. Read MBUS Byte to clear read status.
  2. MBUSStatus := MBUSStatus | 0x07
  3. Set bit 6 (0x40) of MBUSControl (start receive)
  4. Clear bit 5 (0x20) of MBUSControl (stop transmit)
  5. If desired, start transmission.

Test plan

Make program that

Phone side:

  1. Waits
  2. Initializes MBUS
  3. Transmits a sequence of bytes
  4. DONE
PC side:

  1. Initializes serial (9600, 8n1)
  2. Waits and dumps data (detects pattern)
* Phone->PC test was completed succesfully.

PC->phone also seems to work, although no speed test and interrupts have not been tested.

Last updated: 2005-02-21 14:19

This site is the result of a great deal of assembly code reading, research, countless (mostly futile) searches for data sheets, cross-referencing and analysing. If you use this information in any way please mention wumpus <blacksphere@goliath.darktech.org> (and others in the credits section) in the credits of your program/document. And tell me :) If you have more information please contribute. If you just copy this, stick your name on it and call it yours I hope you get your genitals bitten off by a three headed monkey. Have a nice day.

No mobile phones were harmed in the production of this site.