Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Per Westermark
10/31/11 09:44
Read: 465 times
Sweden


 
#184486 - But how to combine that loop with a real program?
Responding to: Konstantinos L. Angelis's previous message
Konstantinos L. Angelis said:
If the soft Slave_SPI accept/respond loop is written in hand optimized assembly, a speed about 100Kbps is achivable, even with a 12MHz (x1) AT89S52. For the BASCOM SPI slave interface, response must be slower, maybe up to 10Kbps. For experimenting if the OP adds a validation routine to data/responses between Master and Slave devices then a secure channel to exchange data can be implemented.


You are ignoring two things.

1) Your hand-optimized assembly requiers zero (!) interrupts enabled.

2) The processor must be fast enough to detect the slave-select activation, to enter that hand-optimized assembly loop. This may often require that you run that loop inside the ISR, with slave-select as an external interrupt. Your main loop will probably not be fast enough to detect the slave select before you have already missed the first data bit.

The issue isn't how fast your assembly loops can operate. The issue is how to handle communication that you can't know when it starts (since we are talking about the slave) while still being able to have the processor do something else - at least while SPI isn't pushing data.

Remember also that SPI is two-way. Some protocols only sends simplex and then potentially switch direction for an answer. But SPI is always full duplex. Your hand-optimized assembly might have a big problem knowing what to do when it's time to send back an response, since it has been busy cheking bits and not spent any time analyzing the contents of already received words.

List of 20 messages in thread
TopicAuthorDate
SPI Slave in 89S52      Alexandre Marques      10/30/11 13:35      
   Get real processor      Per Westermark      10/30/11 14:29      
      Topic Author Date      Alexandre Marques      10/30/11 14:46      
         Big problem      Per Westermark      10/30/11 16:01      
         Look for a different model      David Prentice      10/30/11 18:31      
         Try 8051 BASCOM      KONSTANTINOS L. ANGELIS      10/31/11 05:37      
            at what speed      Erik Malund      10/31/11 07:06      
               Interpreters have an easier life.      Per Westermark      10/31/11 08:54      
               Soft SPI speed      KONSTANTINOS L. ANGELIS      10/31/11 09:31      
                  But how to combine that loop with a real program?      Per Westermark      10/31/11 09:44      
                     and more      Erik Malund      10/31/11 09:51      
                        Software master trivial - slave is not      Per Westermark      10/31/11 10:52      
                           SPI analysis is made, results?      KONSTANTINOS L. ANGELIS      10/31/11 14:43      
                              There _may_ be a solution - but maybe not acceptable      Per Westermark      10/31/11 16:05      
                  sure, and so what?      Erik Malund      10/31/11 09:47      
                     SPI at 100Kbps      KONSTANTINOS L. ANGELIS      10/31/11 16:51      
                        Still gives puny transfer rate with significant limitations      Per Westermark      11/01/11 01:05      
                           the answer is      Erik Malund      11/01/11 06:37      
   Fully Interlocked Handshaking.      Michael Karas      11/01/11 08:01      
      Quite common      Per Westermark      11/01/11 08:52      

Back to Subject List