+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Full Member level 1
    Points: 907, Level: 6

    Join Date
    Apr 2016
    Posts
    116
    Helped
    0 / 0
    Points
    907
    Level
    6

    Fastest external memory for PIC18F?

    Hey
    How fast can be SPI or I2C RAM for PIC18F?
    I would like to read data in blocks, will 10us be enough for such read? Maybe 20us?
    Any ideas?

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 5
    Points: 8,573, Level: 22
    Easyrider83's Avatar
    Join Date
    Oct 2011
    Location
    Tallinn, Estonia
    Posts
    1,525
    Helped
    348 / 348
    Points
    8,573
    Level
    22

    Re: Fastest external memory for PIC18F?

    SPI Flash. 80MHz in Fast Read mode. Fast enough?
    Love me or hate me. All infractions will be ignored.



    •   AltAdvertisment

        
       

  3. #3
    Full Member level 1
    Points: 907, Level: 6

    Join Date
    Apr 2016
    Posts
    116
    Helped
    0 / 0
    Points
    907
    Level
    6

    Re: Fastest external memory for PIC18F?

    My PIC runs at 32MHz. How much us would it take to read a block? What block size?



    •   AltAdvertisment

        
       

  4. #4
    Super Moderator
    Points: 8,275, Level: 21

    Join Date
    Jun 2009
    Location
    Japan
    Posts
    1,058
    Helped
    280 / 280
    Points
    8,275
    Level
    21

    Re: Fastest external memory for PIC18F?

    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.



  5. #5
    Advanced Member level 1
    Points: 3,273, Level: 13

    Join Date
    May 2012
    Posts
    459
    Helped
    101 / 101
    Points
    3,273
    Level
    13

    Re: Fastest external memory for PIC18F?

    The fastest speed you can get to transfer a block of data using a PIC18F in SPI mode, is the clock speed divided by 4 then divided by 9 (using DMA mode) so 32Mhz is 0.88MB/s so a 512 bytes block will take 576uS



--[[ ]]--