SPLat Logo

MMi203: NVEM0

NOTICE: SPLat Controls has moved. We are now at 1/85 Brunel Rd, Seaford, 3198. map

MMi203: NVEM0

NVEM0 (page 0 NVEM) in the MMi203 is part of the same memory where your application program is stored. In fact, your program and NVEM0 share the same contiguous block of memory, called User Flash. The bigger your program, the less is available for NVEM0, and visa versa. In the MMi203 there is approximately 21K of user flash. The exact amount is reported in the SPLat/PC Module window when you connect to a board. The amount may reduce in future Firmware versions as we use more of the total flash memory to implement new features.

In the following description for the MMi203, the block size is 512 bytes and the endurance is 10,000 writes (this varies from product to product). For the MMi201, the block size is 128 bytes and the endurance is 10,000 writes (this varies from product to product).

The endurance figures given above are the chip maker's worst case ratings over all legal temperatures and supply voltages. They are very conservative but no guarantee is given that the chips can survive more writes. Exceeding the FLASH memory write endurance will be construed as mis-use and void our product warranty.

Boards with language dialect 15 or later implement NVEM0. This page provide details specific to the implementation in the SL99/100, MMi2xx, MS12x, CC16/18, RFD18, and HD8. General NVEM0 documentation is located elsewhere.

NVEM0 in these controllers is implemented using the processor's main FLASH memory. This memory can only be written in fixed size blocks. The block size differs between products.

What we have done, therefore is to create some "smoke and mirrors" to simulate byte-writable memory. That means your program can write to individual bytes, and they will be updated correctly. However, there are downsides:

Whenever you change you program, and hence its size, the absolute addresses of all your NVEM0 data will change. That means a particular multibyte write operation could suddenly wind up straddling a block boundary and take twice as long. Be very cautious when evaluating the effect of write times on your program.

Examples:

;Example 1: Padding with unused space, because I have no read-only tables:
NV0BlockSize   EQU      XXXXX ;<<<<<<<< Fill in the block size for your controller
             ...
           Return                  ;The last program instruction

           NVEM0                   ;Start of NVEM page 0 memory
           NV0Space     XXXXX      ;Force new XXXXX byte block
NVData     ;Start defining any writable NVEM0 areas here

********* ********* ********* ********* ********* ********* ********* ********* 
;Example 2: Place read-only lookup tables first, then force a new byte block.
NV0BlockSize   EQU      XXXXX ;<<<<<<<< Fill in the block size for your controller
             ...
           Return                  ;The last program instruction

           NVEM0                   ;Start of NVEM
;Table of sines 0-90', 10' increments (takes 40 bytes)
SineTable  NV0fNum      0          ; sin(0)
           NV0fNum      1.74E-1    ; sin(10)
           NV0fNum      3.42E-1    ; sin(20)
           NV0fNum      5E-1       ; sin(30)
           NV0fNum      6.43E-1    ; sin(40)
           NV0fNum      7.66E-1    ; sin(50)
           NV0fNum      8.66E-1    ; sin(60)
           NV0fNum      9.40E-1    ; sin(70)
           NV0fNum      9.85E-1    ; sin(80)
           NV0fNum      1          ; sin(90)

Padding    NV0Space     XXXXX      ;Force new block

;Any NVEM that gets written during program execution gets placed below this point.
;That would typically be large parameter tables that can be changed by an end-user.