file: wndflash.html
09 Apr 2002

FLASH CARD INTERNAL FORMAT - WND

The following describes the data storage format of the 8MB Intel-Compatible FLASH memory card used in ASIMET instrumentation.

Major Divisions by card address:

Address Range      Description

000000h - 0000FFh reserved system area (256 bytes) 000100h - 0004FFh EEPROM image backup (1024 bytes) (see EEPROM data structure below) 000500h - 01FFFFh reserved (129792 bytes) 020000h - 3FFFFFh data records (8257536 bytes) total capacity: 5490 records (1 hour each) (see WND_record data structure below)

Description of WND data storage area beginning at 20000h

The WND data storage area consumes most of the 4 or 8MB FLASH card.

Each record is 740 bytes long, containing the date and time written, 60 minutes of Wind Velocity East data, 60 minutes of Wind Velocity North data, 60 minutes of Wind Speed data, 60 minutes of Wind Speed Max data, 60 minutes of Last Vane direction data, 60 minutes of Last Compass direction data, 60 minutes of Tilt X data, 60 minutes of Tilt Y datat, 8 unused spare bytes, a flag which is set to 0xA5A5 when the record is written, and a 2 byte CRC of the previous 738 bytes (currently not used, set to 0 always). The actual C language struct is reproduced here to show the format of the stored image. Most values are packed.

   
   /* this is the WND data record structure, 740 bytes */
   struct WND_record
     {
     struct time_type time1;         /* 8 bytes of time */
     short Ve[60];                   /* 60 minutes of Vel East data */
     short Vn[60];                   /* 60 minutes of Vel North data */
     unsigned char WSpeed[60];       /* 60 minutes of WS data */
     unsigned char WSMax[60];        /* 60 minutes of Max WS data */
     unsigned short LastVane[60];    /* 60 minutes of Last Vane data */
     unsigned short LastCompass[60]; /* 60 minutes of Last Compass data */
     char TiltX[60];                 /* 60 minutes of Tilt X data */
     char TiltY[60];                 /* 60 minutes of Tilt Y data */
     unsigned char spare[8];
     unsigned short used;            /* set to 0xA5A5 upon record write */
     unsigned short wnd_CRC;         /* CRC of previous 738 bytes */
     };

    
   struct time_type
     {
     unsigned char hour;
     unsigned char min;
     unsigned char sec;
     unsigned char day;
     unsigned char dow;   /* day of week - NOT USED */
     unsigned char mon;
     unsigned short year;
     };


Note that time structure is NOT ANSI-compatible.


Data packing - this is the packing code from the WND instrument

     /* every minute, from 0 to 59, pack and store the record */
     
     /* Vel data 0 to +/- 49.99 m/s packs to 0 to +/- 4999 */ 
     WND_data.Ve[t_time.min] = (short)(vel_east * 100);
     WND_data.Vn[t_time.min] = (short)(vel_north * 100);
     
     /* speed data from 0 to 50.0 m/s packs to 0 to 250 (.2 resolution ) */
     WND_data.WSpeed[t_time.min] = (unsigned char)(speed_avg * 5);
     WND_data.WSMax[t_time.min] = (unsigned char)(speed_max * 5);
     
     /* vane data from 0 to 359.9 packs to 0 to 3599 */
     WND_data.LastVane[t_time.min] = (unsigned short)(vane_deg * 10);
     
     /* compass data from 0 to 359.9 packs to 0 to 3599 */
     WND_data.LastCompass[t_time.min] = (unsigned short)(comp_deg * 10);
     
     /* tilt data from 0 to 25.0 packs to +127/-128 (.2 resolution) */
     WND_data.TiltX[t_time.min] = (char)(tilt_x_avg * 5);
     WND_data.TiltY[t_time.min] = (char)(tilt_y_avg * 5);

Data is written to the FLASH card immediately following the acquisition of all data at the rollover to the 59th minute of each hour. This is reflected in the time stamp on each record, typically 1 second into minute 59. The "Last" values of compass and vane are taken from the last 5 second vector averaging period of the minute, just prior to writing the record.


*** IMPORTANT NOTE ***

The byte order of the all numeric values stored by the VOSWND53 firmware is reversed relative to Intel-based PC's. That is, a long integer (4 bytes) or short integer (2 bytes) stored by a PC will be LS byte first in memory. The VOSWND53 firmware stores MS byte first in memory. This must be accounted for when processing the data.


The "used" flag value is used to simplify finding the end of valid records in the FLASH card on module startup. The FLASH card is cleared to all FFh before deploying the module; as each record is written, the "used" flag is set to A5A5h to provide a distinct pattern to search on for good records.

The CRC is NOT IMPLEMENTED.


Description of EEPROM image storage area

The EEPROM image area contains miscellaneous text information about the VOS module, as well as any calibration constants required by the module, if any. The actual C language struct is reproduced here to show the format of the stored image.

   struct ee_page0_type
      {
      char spare[8];       /* */
      char modmfg[16];     /* module manufacturer */
      char modmod[16];     /* model number */
      char modser[8];      /* serial number */
      char moddat[8];      /* manufacture date */
      char senmfg[16];     /* sensor manufacturer */
      char senmod[16];     /* model number */
      char senser[8];      /* serial number */
      char sendat[8];      /* manufacture date */
      char sftmfg[16];     /* program origin */
      char sftnam[16];     /* program name */
      char sftrev[8];      /* serial number */
      char sftdat[8];      /* revision date */
      char sftpce[8];      /* not used */
      char calfac[16];     /* calibration facility */
      char calper[16];     /* calibration technician */
      char caldat[8];      /* calibration date */
      char modadr[8];      /* module address (bytes 200-207) */
      char mode[8];        /* comms mode: 232 or 485 */
      char spare2[40];
      char datfrm[64];     /* cal data format */
      char datdes[64];     /* cal data description */
      char datuni[64];     /* cal data units */
      char spare3[64];
      char rawfrm[64];     /* raw data format */
      char rawdes[64];     /* raw data description */
      char rawuni[64];     /* raw data units */
      char spare4[64];
      float calset[8][5];  /* array of 8 sets of 5 cal terms */
      };