Documentos de Académico
Documentos de Profesional
Documentos de Cultura
SEPTEMBER 2011
INTERCOMPONENT BUSSES
NAVN NAVNESEN TITLE
UNI VERSITy
SUBJECTS
SPI I2C I2C example: LM75 temperature sensor. 1-wire 1-wire example: DS1820 temperature sensor. I2S CodeVision setup
SPI SLAVE
SS SCLK MOSI MISO
SPI PRODUCTS
I2C (IIC)
Inter IC bus (Introduced by Philips). Suited for medium data rates. Limited range (often locally at PCB). Inbuild addressing (minor HW demands). Simple protocol inbuild. Real time qualified (respons times can be calculated). Speed 100kbit/s (many devices support up to 400kbit/s)
I2C TOPOLOGY
Each node has its own unique address (or ID). By sending a START command, each node is able to become the bus master.
Then the master sends the address of the slave, it wants to communicate with:
The address is 7 bits. The last bit (R/W) informs the slave, whether the master wants to read or to write.
MDL ETIADE 2012 9. OCTOBER 2012
- Subsequently the master regains bus control MDL ETIADE 2012 9. OCTOBER 2012
During reception (2) the slave controls SDA, but the master controls SCL. The slave is only allowed to change SDA while SCL is high.
MDL ETIADE 2012 9. OCTOBER 2012
SDA SCL
Following the last received byte, the master sends the STOP command (freeing the bus again).
MDL ETIADE 2012 9. OCTOBER 2012
MASTER: STOP
Sent by the master, when it has finished sending /receiving data. Received by all slaves, now knowing the bus is again free. STOP can be sent at any time (even in the middle of a data transmission). In all cases STOP means END of transmission.
MDL ETIADE 2012 9. OCTOBER 2012
RESERVED ADDRESSES
10-bit addressering is possible (new standard). In this case 2 bytes are sent as address: 11110AAx + AAAAAAAA. (8-bit nodes ignores 10-bit addressing).
MDL ETIADE 2012 9. OCTOBER 2012
If a master is unable to set an output high (it always test for this), it looses the bus control. If 2 masters start transmission simultaneously, the following happens:
Until the yellow marking, both masters think, they own the bus. Then CPU2 surrenders (until STOP).
MDL ETIADE 2012 9. OCTOBER 2012
LM75 ADDRESS
LM75 is always a slave (not capable of being a master). The address (7 bit) is composed of 4 constant bits and the external pin settings (A2-A0).
1-WIRE
Introduced by Dallas Semiconductor corp. Only 1 wire (+ground + optionally power). Cheaper than I2C. Only suited for low data rates. Limited range (often locally at the PCB). Inbuild addressing (all devices have a unique address). See good presentation at: http://www.maximintegrated.com/products/1wire/flash/overview/index.cfm
MDL ETIADE 2012 9. OCTOBER 2012
1 WIRE TOPOLOGY
Master sends the RESET pulse. All slaves responds by sending a Presence Pulse. This tells the master, that at least one slave is present and ready to communicate. But the master will not know if several slaves are connected MDL ETIADE 2012
9. OCTOBER 2012
1-WIRE: WRITE
To write a 1, the master pulls the line low and releases it again. After 15s the slave will read the bus and see that it is high. To Write a 0, the master keeps the line low for 60s
1-WIRE: READ
To read a bit, the master pulls the line low and releases it. If the slave keeps it low after 15s it means 0, if the slave releases it, it means 1
1-WIRE: IN GENERAL
Normal sequence: 1. Master sends RESET and awaits Presence Pulse. 2. Master sends an 8-bit read command. 3. Master reads one or more bytes from the slave. 4. Often, the last byte will be CRC, only to be used if desirable.
Each slave has its own unique 64 bit address. This can be searched by the master (complex algorithm).
DS1820: POWER
DS1820: COMMANDS
ROM Commands:
The bus master uses a ROM command to address the DS18S20 with which it wishes to communicate,
Function Commands:
I2S
Inter-IC Sound Only used for digital audio streaming (as far as I know) Streaming from master to slave No feedback from slave to master at all
The master dont know if someone is actually listening
Multiple slaves can be connected in parallel and listen to the stream Supported by almost all audio ADC/DACs and most digital signal processors
I2S
I2S consists of three wires: - Word clock -Bit clock -Data Standard Word clock (=sample frquency) is 48kHz or 44.1kHz The bit clock is 64 times word clock Normally there are 24 or 32 bits per. channel and two channels per word.
MDL ETIADE 2012 9. OCTOBER 2012 56
I2S TIMING
From the ADMP441 datasheet
CODEVISION SETUP
Create a new project. Select No to the question about using the wizard and save the project
CODEVISION SETUP
Add your *.c files. If you have not written them yet, they can be created using file>new>source After you have closed this dialog
CODEVISION SETUP
Go to C compiler. Select your microcontroller (Mega16) and your clock (3,6864MHz for STK500)
CODEVISION SETUP
Go to After Build Select Program the Chip Press OK
CODEVISION SETUP
Press programmer settings and select your COM-port