Title: I2C Bus Drivers for Windows 2K, XP
1I2C Bus Driversfor Windows 2K, XP
- Pavel Novák
- Tomáš Matoušek
2I2C Basic Characteristics
- Inter-Integrated Circuts Bus
- originally to interact within small num. of devs
(radio/TV tuning, ) - max. speeds
- 100 kbps (standard mode)
- 400 kbps (fast mode)
- 3.4 Mbps (high-speed mode)
- data transfers serial, 8-bit oriented,
bi-directional - master/slave relationships with multi-master
option (arbitration) - master can operate as transmitter or receiver
- addressing 7bit or 10bit unique addresses
3Wires and Signals
- two-wired bus
- serial data line (SDA)
- serial clock line (SCL)
- bit transfer
- level triggered
- one clock pulse per data bit
- stable data during high clocks
- data change during low clocks
4Wired-AND Connection
- open collectors, pull-up resistors
- bus is free ? SDA and SCL are high
5Frame Formats
master-transmitter
master-receiver (since second byte)
6Addressing by 7 bits
- the first byte transmitted by master
- 7 bits address
- 1 bit direction (R/W)
- 0 master writes data (W) transmitter since
next byte - 1 master reads data (R) receiver since next
byte - during the first byte transfer
- master is transmitter
- addressed slave is receiver
- data transfer terminated by a stop condition
- master may generate repeated start and address
another device
7Microchip PIC16F628
- 8-bit 20MHz RISC microcontroller
- USART
- Rx, Tx, DTR, DSR for communication
- RTS resetting, low voltage programming
- memory
- FLASH program (2048 x 14bit)
- RAM data (224B)
- EEPROM data (128B)
- hardware stack (8 levels)
- interrupts, 3 timers, 16 I/O pins
- 35 instructions
- single-cycled except for 2-cycled branches
8Layered Drivers
TCP/IP drivers
TCP/IP drivers
NDIS.sys
NDIS.sys
I2CNET.sys
I2CNET.sys
Ethernet over I2C
I2C.sys
I2C.sys
link layer
Serial.sys
Serial.sys
PC UART
PC UART
PIC16F628
PIC16F628
physical layer
I2C bus
I2C bus
9Virtual Network Device Installation
10Virtual Network Device Installation
11Virtual Network Device Settings
12Virtual Network Device Settings
13Network Driver Interface Specification (NDIS)
- Common interface for network drivers
- specification not only for device drivers
- includes
- Miniport drivers
- Intermediate drivers
- Protocol drivers
14NDIS Miniport Implementation
- DriverEntry()
- driver initialization
- calls NdisMRegisterMiniport()
- informs NDIS about new Miniport driver
- MiniportInitialize()
- called by NDIS for each instance of network
controller device - MiniportHalt()
- MiniportReset()
- MiniportShutdown()
15Information Transmission To NDIS
- NDIS_STATUS MiniportQueryInformation(IN
NDIS_HANDLE MiniportAdapterContext,IN
NDIS_OID Oid,IN PVOID InformationBuffer,OUT
PULONG BytesWritten,) - OidsOID_GEN_MEDIA_SUPPORTED //
EthernetOID_GEN_LINK_SPEEDOID_GEN_MEDIA_CONNECT_
STATUSOID_PNP_CAPABILITIESOID_802_3_PERMANENT_AD
DRESSOID_GEN_XMIT_OK
16Information Transmission To Our Driver
- NDIS_STATUS MiniportSetInformation(IN
NDIS_HANDLE MiniportAdapterContext,IN
NDIS_OID Oid,IN PVOID InformationBuffer,OUT
PULONG BytesRead,) - OidsOID_GEN_NETWORK_LAYER_ADDRESSESOID_GEN_CURR
ENT_PACKET_FILTEROID_PNP_SET_POWER
17Data Transfer To Network
- NDIS_STATUS MiniportSend(IN NDIS_HANDLE MiniportA
dapterContext,IN PNDIS_PACKET Packet,) - NdisQueryPacket(Packet,,Buffer)
18Data Transfer From Network
- VOID NdisMEthIndicateReceive(IN
NDIS_HANDLE MiniportAdapterHandle,IN
NDIS_HANDLE MiniportReceiveContext,IN
PVOID HeaderBuffer,IN PVOID LookaheadBuffer,
IN UINT PacketSize) - NDIS_STATUS MiniportTransferData(OUT
PNDIS_PACKET Packet,IN NDIS_HANDLE MiniportAdap
terContext,IN NDIS_HANDLE MiniportReceiveContext,
)
19Further Information
- The I2C Bus Specification, version 2.1, January
2000 - www.semiconductors.philips.com/buses/i2c
- Microchip PIC16F627/8 Data Sheet
- ww1.microchip.com/downloads/en/DeviceDoc/40300c.p
df - WinPic - A PIC Programmer for Windows
- www.qsl.net/dl4yhf/winpicpr.html
- PIC C compiler
- www.ccsinfo.com/picc.shtml