Question: What is the maximum distance of the I2C bus?
This depends on the load of the bus and the speed you run at. In typical applications, the length is a few meters (9-12ft). The maximum capacitive load has been specified (see also the electrical Spec’s in the I2C FAQ). Another thing to be taken into account is the amount of noise picked up by long cabling. This noise can disturb the signal transmitted over the bus so badly that it becomes unreadable.
The length can be increased significantly by running at a lower clock frequency. One particular application – clocked at about 500Hz – had a bus length of about 100m (300ft). If you are careful in routing your PCB’s and use proper cabling (twisted pair and/or shielded cable), you can also gain some length.
If you need to go far at high speed, you can use an active current source instead of a simple pull-up resistor. Philips has a standalone product for this purpose. Using a charge pump also reduces “ghost signals” caused by reflections at the end of the bus lines.
Question:In protocols (I2c,SPI,CAN) which one is best?
Depends on your requirement
we can separate them based on Clock in the following way.
1) I2C & SPI are Synchronous Interfaces & used on PCB
2) CAN is Asyncronus Interface & uses wires for long
Diff B/W I2C & SPI:
1) a)I2C is invented by Philips
b)Invented by Mototola
2) a) Used to interface with Audio/Video Devices as the
philips is expertise.
b) Access High Data trnsmission deives like EEPROMS
3) a) I2C Supports Speed is :100Kbps(Standard)
b) SPI Supports : 3Mbps to 10Mbps
4) a) I2C is multi-master, Address based Communication
b) SPI is Master Slave, With Slave select(SS) based
5) a) I2C needs 2 pins
b) SPI needs 3+n pins (n is no.of devices)
6) a) I2C supports 127 devices
b) limited by avilable Chip slects
Coming To CAN:
invented by Robert Bosh
supports 127 devices , multimaster , Message based
comminications, Reliable, supports 40kbps to 1Mbps
Question: how many Number of devices an I2C can support?
I2C supports 127(2pow7 – 1) devices in which 16 address are
reserved(8 with 1 and other 8 with 0 mbs).
Question:Is really main required in C programming
It depends on the entry point must be determined if the function/ it is library its not required. If the program is for only one application the main function is necessary.
Question:While writing interrupt handlers (ISR), which are points needed to be considered ?
never use a semaphore or mutex or sleep functions as ISR is just to handle the event for interrupt
Questions:DMA deals with which address (physical/virtual addresses) ?
DMA deals with Physical addresses.
Only when CPU accesses addresses it refers to MMU(Memory Management Unit) and MMU converts the Physical address to Virtual address.
But, DMA controller is a device which directly drives the data and address bus during data transfer. So, it is purely Physical address. (It never needs to go through MMU & Virtual addresses).
That is why when writing the device drivers, the physical address of the data buffer has to be assigned to the DMA.