Hi, I want to establish communication between two micro controllers,which are not having internal I2C arrangement.How to set device adders for micro controllers? I want to transfer data from one controller to other.Please help me in this regard. thanking you, With regards, Bhaskar
The standard SPI protocol lets the master send out data and a clock signal. Everything the slave does is based on the clock signal flanks.
But if the clock runs too fast while the slave is busy doing some task that takes a bit of time (maybe handling an interrupt) then the slave will miss bits.
This can be solved by using SPI but have the master freeze the clock after each bit, until it sees an acknowledge signal toggle from the slave. So you still have a synchronous communication, but with self-adjusting baudrate depending on how fast the slave can react to every single bit transfer.
If you read up on the SPI protocol, you really shouldn't need any more help to figure out how to get a bit-banged SPI master to "insert wait states" as needed to make sure the bit-banged slave can keep up.
whatever you do, besides using micros with hardware interfaces, you are VERY likely to get in timing trouble or "holdup trouble"
one scheme that could work if you have a free port and a few bits on both would be: sender (S) set a byte on px toggle a bit that is connected to an interrupt on the receiver(R) the (R) ISR read the byte and toogle a bit that is conneted to an interrupt on (S) the (S) ISR then know the transfer is completed and can continue.
anyhow, save yourself some trouble and get some micros with a hardware interface (I²C, SPI, second UART, CAN, ...)
Erik
"holdup trouble": something does not get taken care of because some wait loop 'hangs' the micro