OwenDuffy.net 


PllLdr - EEPROM data structure

The MCU to load PLL configuration registers (PllLdr) architecture is that algorithms are in flash memory, and to the greatest extent possible configuration data is held in EEPROM. This makes it easy to make configuration changes and does not require access to a C compiler.

In use

EEPROM images in Intel hex format suitable for a device programmer are created for download by an online transaction embedded in the project page at MCU to load PLL configuration registers.

Fig 1:

Fig 1 shows the data entry form for the EEPROM image generator using the example in the project page at MCU to load PLL configuration registers.

The bits and bytes

The EEPROM data structure is designed to be flexible, and as a result includes a variable number of variable length data items.

eeprom:

Offset Variable Type Length Description
0 ver uint8 1 EEPROM version
1 options uint16 1 option bits
3 toc_len uint8 1 length of toc
4 toc toc_entry[n] n list of toc_entry

toc_entry[n]:

Offset Variable Type Length Description
4+2n offset uint16 1 offset of reg_set[n]

reg_set[n]:

Offset Variable Type Length Description
var reg_set_count uint8 1 count of reg_set
var reg_set_len uint8 1 length of reg_set
+1 reg[] byte reg_set_len list of reg

reg[n]:

Offset Variable Type Length Description
var reg_len uint8 1 length of reg
+1 reg[reglen] byte reg_len list of bytes

Example

Fig 2:
:100000000101000208001E000514030300A0030004
:1000100000010300002203006783030000A605140B
:10002000030300A0030000010300002203006A8311
:04003000030000A623
:00000001FF

Fig 2 shows the Intel hex format file generated by the example shown in Fig 1. The Intel hex format includes address prefixes on each line and a checksum at end of line, so it isn't so easy to interpret.

Fig 3:
C:\src\PllLdr\144Beacon>dump eeprom.pllldr
eeprom.pllldr:
00000000 0101 0002 0800 1e00 0514 0303 00a0 0300 ............. ..
00000010 0001 0300 0022 0300 6783 0300 00a6 0514 ....."..g....&..
00000020 0303 00a0 0300 0001 0300 0022 0300 6a83 ... ......."..j.
00000030 0300 00a6                               ...&

Fig 3 shows a dump of the hex file after it is converted to a simple binary file. This is better, you can start picking your way through the fields and following pointers.

Fig 4:
 

Fig 4 shows the Intel hex file imported into Hex Editor Neo. Hex Editor Neo Professional contains a really useful facility to bind a structure definition to the binary file contents, allowing exploration of the structure using the structure element types, sizes, labels etc. The cursor hint in Fig 4 shows that the byte containing 0x03 is a the first byte of a three byte register.

Fig 3:
#include <stddefs.h>

typedef struct{
uint8 reg_len;
uint8 byte[reg_len];
} reg_t;

typedef struct{
uint8 nregs;
uint8 regset_len;
reg_t reg[nregs];
} regset_t;

typedef struct{
uint16 regsetp as regset_t*;
} regsetptr_t;

public struct pllldr_eeprom{
int8 ver;
uint16 options;
uint8 nregsets;
regsetptr_t regsetptr[nregsets];
};

The structure definition used by Hex Editor Neo Professional is shown above in Fig 5. There may be better ways to implement this, but this is simple and I am but a beginner with Hex Editor Neo Professional!

So, there you go... all you need to know if you wished to implement your own client program to generate the EEPROM image.

Links

Changes

Version Date Description
1.01 07/11/2012 Initial.
1.02    
1.03    
1.04    
1.05    

 


© Copyright: Owen Duffy 1995, 2021. All rights reserved. Disclaimer.