Buses
From OmegaV-wiki
This article lists some commonly used electrical buses. You can used them to connect your micro-controller to many external units like:
- external-RAM
- ADC (Analog to Digital -Converter)
- DAC (Digital to Analog -Converter)
- SSD-card
- LC-Display
An electrical bus is a series of wires,
grouped together to one as a means of abstraction.
Contents |
External Memory Interface
External Memory Interface means that you can get accesses to some of addresses in your main memory, on the external PINs on your micro-controller.
This means that you can map those addresses into the devices of you liking.
Uart
Universal (synchronous) asynchronous receiver/transmitter is a very simple bus protocol. It uses two wires Rx and Tx (and ground). Rx receives data and Tx sends data. This means that you have to cross them, and for this reason it is an one-to-one communication bus.
To use uart you need to specify the bit-rate (speed). And how your basic byte package looks:
- How many data bits to send in a it (typical 5, 7 or 8).
- Whether or not you are using a parity-bit, and if you do, whether it is even or odd.
- How many stop bits you are using (1 or 2).
RS-232
Recommended Standard 232 is like uart, the only difference is that it is level shiftet. That is, Logical high is +12V and logical low is -12V ish.
Many old computers have RS-232 «COM-ports» To connect your AVR to one of these You only need a level shifter like MAX232
SPI
Serial Peripheral Interface Bus uses four wires, and is for this reason sometimes referred to as «four-wire». It is fully duplex, that means that you can both send and receive concurrently.
Wires:
- SCK - Serial ClocK
- MISO - Master In / Slave Out
- MOSI - Master Out / Slave In
- SS - Slave Select
SPI is Single-master. The master selects the slave using SS, and drives the serial clock.
ISP
ISP is a common way to flash microcontrollers. It sometimes uses SPI as the carrier.
Other times it uses the more modern JTAG (Joint Test Action Group), which also features amazing debugging features.
I2C
Inter-Integrated Circuit is a two wire, multi-master bus. Atmel calls this bus TWI, due to some patent stuff.
Wires:
- SDA - Serial DAta
- SCL - Serial CLock
Both SDA and SCL is pulled high by an external resistor. IC's on the bus can only pull the bus low. If two devices tries to talk at the same time, one of them will win the bus, without any package collisions.
CAN
Controller Area Network is an robust bus, used in automation and cars. It is multi-master and very noise tolerant. You need both an CAN-transceiver and CAN-controller to connect to a CAN-bus.
CAN packages have no destination address. When a device wants to send something it just spams the bus, and it is then up to the receivers to filter out what they want to know. The filter is often implemented in hardware.
Wires:
- CAN_L
- CAN_H
Ethernet
Ethernet is mostly used for Pc to Pc connection.
USB
Universal Serial Bus is a big protocol. Maybe the easiest thing you can use it for, is to tunnel a serial uart communication into a computer.
Firewire
IEEE 1394 interface Is more advanced than USB. For instance it has built in DMA (Direct Media Access).
