Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Blocking read/write from internal EEPROM and Flash

  1. #1

    Blocking read/write from internal EEPROM and Flash

    Hello,

    I have a Teensy 3.1 and I would like to read immutable data from the uC Flash and read/write to the internal EEPROM.
    The performace, e.g. how fast/read operations execute, is not important for me, only if the operation is implemented using a blocking wait.

    I was looking through the source code, and only the only place where there are blocking waits is when writing to EEPROM.
    Reading from Flash or from EEPROM has no blocking wait, although it is probably slower than reading from RAM. Is this correct ?

    Also, to have a constant placed in flash is it enough to declare it "const" or do I need the PROGMEM macro:

    Code:
    static const uint8_t ConstantValue = 0x12;    // this is enough to place ConstantValue in the uC flash ? 
    
    static uint8_t ConstantValue PROGMEM = 0x12; // or should I use PROGMEM
    Thanks in advance,

    Nelson

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,083
    Not quite sure what you really want to ask, but I see 2 specific questions, so I'll try to answer those.


    Quote Originally Posted by nelsongoncalves View Post
    Reading from Flash or from EEPROM has no blocking wait, although it is probably slower than reading from RAM. Is this correct ?
    Reading from RAM takes 2 cycles, or only 1 cycle if the previous instruction is a "related" read.

    I believe flash reads are single cycle if the is already in the cache. But the cache is tiny, I believe only 256 bytes. The flash runs at 24 MHz, so if your CPU is at 96 MHz a cache miss could take a few extra cycles.

    I don't know how fast EEPROM reads are. I've never really worried about it. The FlexNVM does use a RAM buffer, so you're reading from RAM which is quick. But the read is done over a peripheral bridge, so there might be extra cycles there. But it's not anything like accessing a slow off-chip resource.


    Also, to have a constant placed in flash is it enough to declare it "const" or do I need the PROGMEM macro:
    Yes, on Teenst 3.x you only need const. On Teensy 4 we do use PROGMEM, and the speed differences are very different because the flash is a separate chip, but the CPU has 2 large caches.

    And FWIW, Teensy 3.1 was discontinued many years ago....

  3. #3
    Hello Paul,

    Thanks for the quick reply. I am working on developing a cooperative embedded OS, and so it was important for me that read/writes from/to EEPROM
    had no significant waiting times. The same for reading from Flash. Had they existed, I would have need to take them into account and force switching to another task.
    In this case, since I am not too much concerned with performance, I can treat read/write operations are being fast enough.

    Regarding the Teensy 3.x being discontinued, these are leftovers that had lying around. I want to compare the embedded OS across multiple small embedded platforms,
    and the Teensy was the easiest to start with.

  4. #4
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,345
    Only Teensy 3.0/3.1 are discontinued.

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,108
    Quote Originally Posted by Frank B View Post
    Only Teensy 3.0/3.1 are discontinued.
    and ... T_3.0 is gone long ago as it evolved to T_3.1 - and T_3.2 is a direct replacement for the T_3.1

    T_3.x's in production are : T_3.2, T_3.5 and T_3.6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •