Special Configuration Section of the EEPROM

Top  Previous  Next

All Tibbo devices have an EEPROM memory (accessible through the stor. object).

Bottom 28 bytes of the EEPROM form a so-called "special configuration section". This section includes:

8 bytes for storing the MAC address of the device;
20 bytes for storing the password of the device.


By default, the special configuration area is not accessible to your application- the stor.base property takes care of that. Unless you change it, this property specifies that your application's storage area starts at address 29. To see the MAC or password data,  set the stor.base to 1. Reminder: EEPROM addresses are counted from 1.


MAC address

Bytes 1-8 of the EEPROM store the MAC address of the device. On power-up, the MAC address is read out from the EEPROM and programmed into the Ethernet controller. You can always check the current MAC through the net.mac read-only property of the net. object but there is no direct way to change it. Instead, you can change the MAC address data in the EEPROM itself. Next time the device boots up, it will start using this new address.

MAC address data in the EEPROM has a special format — you have to follow it if you want the MAC to be recognized by the firmware (TiOS). Here is this format:



















The byte at address 1 must be set to 6- this means that 6 bytes of data follow (MAC address consists of 6 bytes). Addresses from 2 to 7 carry the MAC address itself. Address 8 stores the checksum, which is calculated like this:


Here is a sample code that stores new MAC address into the EEPROM and then reboots the device:


dim s as string

dim x as byte


s= ""        'supposing, we want to set this MAC



s=chr(6)+ddval(s)                'added first byte (always 6) and converted readable MAC into bytes

x=255-strsum(s)                'calculated checksum and assigned the result to a BYTE variable ("modulo 8" checksum)

s=s+chr(x)                        'now our string is ready


stor.base(1)                        'will access the EEPROM from the bottom

x=stor.set(s,1)                'save the data

if x<>len(s) then                'it is a good programming practive to check the result



 sys.reboot                'new MAC set, reboot!

end if





There are limitations on what MAC address you can set. When loading the MAC into the Ethernet controller, the device always resets the first byte of this address to 0. For example, if you set the MAC to then the actual MAC used by the device will be



If you write incorrect MAC data (wrong "length" byte or erroneous checksum), the device will ignore the stored MAC and boot up with the default MAC, which is



Bytes 9-28 store device password. The password is stored in the following format:



up to 16 bytes

3 bytes



MD5 check data


The byte at address 9 indicates the length of the password (16 bytes max). This is followed by the password itself, followed by 3 check bytes. These bytes are first 3 bytes of the md5 hash calculated over the combined length and password data bytes.

TiOS itself can accept any binary password with 0-16 bytes length (zero means "no password protection"). TIDE software, however, always sets 16-byte passwords. These are MD5 hashes of the actual passwords you type into Enter Device Password and Change Device Password dialogs.

Here is a code snippet that verifies if the password set for the device is really DEVICE_PASSWORD ("Tibbo" in the example below). If the EEPROM data is incorrect, the code sets the right data and reboots the device. By using this sort of code in your project you can make your devices self-protect themselves. This will spare you from manually setting the password for each device through TIDE.







Sub On_sys_init()

 Dim s As String(16)

 Dim s2 As String(20)

 Dim check As String(3)

 Dim x As Byte


 'take the hash of password (this is what is supposed to be stored)




 'see if this password is already set

 x=stor.base        'will restore the original value later

 stor.base=9        'this is where password data recides


 If asc(mid(s2,1,1))<>16 Or mid(s2,2,16)<>s Or mid(s2,18,3)<>check Then

         'password data in the EEPROM is incorrect! -- set the password again



 End If