Hello!
My PIC runs at 32MHz. How much us would it take to read a block? What block size?
It depends on the SPI flash and also how you program your µP.
If you use a 80 MHz flash in SPI, then you can read 10 MBytes per second (in regular SPI).
As many chips have blocks of 256 bytes (some are 264), then you can calculate
how many µs you need to transmit 256 bytes at 10M/s.
Now your processor runs at 32MHz, therefore the max SPI rate will be 16. Therefore you will
be at 2MBytes / second only.
Next problem: If you program like this:
Code:
uint16 i;
uint8 buf[BUF_LEN];
for(i = 0 ; i < BLOCK_LEN ; ++i) {
buf[i] = read_byte();
}
then you will never be even close to 10 MBytes/second because the loop takes time.
If the loop eats, say, 10 cycles, then you have to add 0.3µs per byte because the
read_byte function will wait for completion.
What you have to do is using the DMA (if you have one).
That's about it.
Dora.