STM32 EEPROM Testing

Dependencies:   mbed

Committer:
chromaticdeth87
Date:
Wed Apr 04 15:16:19 2018 +0000
Revision:
0:77080c9376de
This is the Test for the Flash to EEPROM operations on STM32F334C8T6

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chromaticdeth87 0:77080c9376de 1 #include "mbed.h"
chromaticdeth87 0:77080c9376de 2 #include "globals.h"
chromaticdeth87 0:77080c9376de 3 #include "cal.h"
chromaticdeth87 0:77080c9376de 4
chromaticdeth87 0:77080c9376de 5 #define ENABLE_DEBUG_PRINTING 1 // turn on diagnostic printing
chromaticdeth87 0:77080c9376de 6 #define ENABLE_TEST_CODE 1 // turn on self-test code (disable for release)
chromaticdeth87 0:77080c9376de 7
chromaticdeth87 0:77080c9376de 8
chromaticdeth87 0:77080c9376de 9 // Must customize which page of flash is used for calibration data
chromaticdeth87 0:77080c9376de 10 // The STM32F334C8 has 32 pages (0..31) so use the last one
chromaticdeth87 0:77080c9376de 11 // Note that on the initial prototype boards, a STM32F334C6 was used
chromaticdeth87 0:77080c9376de 12 #define CAL_PAGE 31
chromaticdeth87 0:77080c9376de 13
chromaticdeth87 0:77080c9376de 14 static uint32_t CalPageAddress = FLASH_BASE + (CAL_PAGE * FLASH_PAGE_SIZE);
chromaticdeth87 0:77080c9376de 15
chromaticdeth87 0:77080c9376de 16
chromaticdeth87 0:77080c9376de 17 #define CAL_HALFWORD_COUNT (sizeof(CALIBRATION_DATA)/sizeof(uint16_t))
chromaticdeth87 0:77080c9376de 18 #define CAL_WORD_COUNT (sizeof(CALIBRATION_DATA)/sizeof(uint32_t))
chromaticdeth87 0:77080c9376de 19 #define CAL_DOUBLEWORD_COUNT (sizeof(CALIBRATION_DATA)/sizeof(uint64_t))
chromaticdeth87 0:77080c9376de 20
chromaticdeth87 0:77080c9376de 21
chromaticdeth87 0:77080c9376de 22
chromaticdeth87 0:77080c9376de 23 CALIBRATION_DATA g_cal;
chromaticdeth87 0:77080c9376de 24
chromaticdeth87 0:77080c9376de 25 static uint32_t DataAddress; // address of last saved data
chromaticdeth87 0:77080c9376de 26
chromaticdeth87 0:77080c9376de 27 static HAL_StatusTypeDef erase_page(uint32_t PageAddress)
chromaticdeth87 0:77080c9376de 28 {
chromaticdeth87 0:77080c9376de 29 HAL_StatusTypeDef Status;
chromaticdeth87 0:77080c9376de 30 FLASH_EraseInitTypeDef EraseInit;
chromaticdeth87 0:77080c9376de 31 uint32_t PageError;
chromaticdeth87 0:77080c9376de 32
chromaticdeth87 0:77080c9376de 33 EraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
chromaticdeth87 0:77080c9376de 34 EraseInit.PageAddress = PageAddress;
chromaticdeth87 0:77080c9376de 35 //EraseInit.PageAddress = FLASH_BASE + (page_number * FLASH_PAGE_SIZE);
chromaticdeth87 0:77080c9376de 36 EraseInit.NbPages = 1;
chromaticdeth87 0:77080c9376de 37
chromaticdeth87 0:77080c9376de 38 HAL_FLASH_Unlock();
chromaticdeth87 0:77080c9376de 39 Status = HAL_FLASHEx_Erase(&EraseInit, &PageError);
chromaticdeth87 0:77080c9376de 40 HAL_FLASH_Lock();
chromaticdeth87 0:77080c9376de 41 return Status;
chromaticdeth87 0:77080c9376de 42 }
chromaticdeth87 0:77080c9376de 43
chromaticdeth87 0:77080c9376de 44 static uint16_t calc_checksum()
chromaticdeth87 0:77080c9376de 45 {
chromaticdeth87 0:77080c9376de 46 int i;
chromaticdeth87 0:77080c9376de 47 uint16_t *p;
chromaticdeth87 0:77080c9376de 48 uint16_t checksum;
chromaticdeth87 0:77080c9376de 49
chromaticdeth87 0:77080c9376de 50 // read cal data from flash in 16 bit chunks
chromaticdeth87 0:77080c9376de 51 p = (uint16_t *)&g_cal;
chromaticdeth87 0:77080c9376de 52
chromaticdeth87 0:77080c9376de 53 checksum = 0;
chromaticdeth87 0:77080c9376de 54
chromaticdeth87 0:77080c9376de 55 for (i=0; i < (CAL_HALFWORD_COUNT - 1); i++) { // don't sum checksum field
chromaticdeth87 0:77080c9376de 56
chromaticdeth87 0:77080c9376de 57 checksum += *p;
chromaticdeth87 0:77080c9376de 58
chromaticdeth87 0:77080c9376de 59 p++;
chromaticdeth87 0:77080c9376de 60 }
chromaticdeth87 0:77080c9376de 61 return checksum;
chromaticdeth87 0:77080c9376de 62 }
chromaticdeth87 0:77080c9376de 63
chromaticdeth87 0:77080c9376de 64 static void factory_defaults()
chromaticdeth87 0:77080c9376de 65 {
chromaticdeth87 0:77080c9376de 66 //ppb_per_mv = 100.0f / 871.0f; // From Pyxis with factory cal
chromaticdeth87 0:77080c9376de 67 //ppb_per_mv = 95.3f / (418.0f - 80.0f); // From Megatron and protoboard (reading-dark current) and scope
chromaticdeth87 0:77080c9376de 68 //ppb_per_mv = 95.3f / (418.0f); // From Megatron and protoboard and scope
chromaticdeth87 0:77080c9376de 69 //ppb_per_mv = 0.3225f; // manual 300/930
chromaticdeth87 0:77080c9376de 70 //ppb_per_mv = 0.305f; // manual 300/981
chromaticdeth87 0:77080c9376de 71
chromaticdeth87 0:77080c9376de 72 g_cal.uv_zero_mV = 81; // uv adc mV reading at 0 ppb (might try dark current scaled up a bit here as a guess)
chromaticdeth87 0:77080c9376de 73 g_cal.uv_cal_mV = 981; // uv adc mV reading at calibration point
chromaticdeth87 0:77080c9376de 74 g_cal.uv_cal_ppb = 300; // uv user ppb value at calibration point
chromaticdeth87 0:77080c9376de 75
chromaticdeth87 0:77080c9376de 76 g_cal.vis_zero_mV = 81;
chromaticdeth87 0:77080c9376de 77 g_cal.vis_cal_mV = 981;
chromaticdeth87 0:77080c9376de 78 g_cal.vis_cal_ppb = 300;
chromaticdeth87 0:77080c9376de 79
chromaticdeth87 0:77080c9376de 80 g_cal.trim_4mA = 816; // dac value to use for 4 mA (see mA.cpp)
chromaticdeth87 0:77080c9376de 81 g_cal.trim_20mA = 4080; // dac value to use for 20 mA (see mA.cpp)
chromaticdeth87 0:77080c9376de 82 g_cal.ppb_at_20mA = 300; // factory default 4-20 mA range is 0-300 ppb
chromaticdeth87 0:77080c9376de 83
chromaticdeth87 0:77080c9376de 84 g_cal.padding = 0;
chromaticdeth87 0:77080c9376de 85
chromaticdeth87 0:77080c9376de 86 //g_cal.mAOffsetValue = 0.0;
chromaticdeth87 0:77080c9376de 87
chromaticdeth87 0:77080c9376de 88 g_cal.checksum = calc_checksum();
chromaticdeth87 0:77080c9376de 89 }
chromaticdeth87 0:77080c9376de 90
chromaticdeth87 0:77080c9376de 91
chromaticdeth87 0:77080c9376de 92
chromaticdeth87 0:77080c9376de 93 void cal_print()
chromaticdeth87 0:77080c9376de 94 {
chromaticdeth87 0:77080c9376de 95 printf("cal data = %.0f, %.0f, %.0f, %.0f, %.0f, %.0f, %u, %u, %.0f, %u, %u\n",
chromaticdeth87 0:77080c9376de 96 g_cal.uv_zero_mV,
chromaticdeth87 0:77080c9376de 97 g_cal.uv_cal_mV,
chromaticdeth87 0:77080c9376de 98 g_cal.uv_cal_ppb,
chromaticdeth87 0:77080c9376de 99 g_cal.vis_zero_mV,
chromaticdeth87 0:77080c9376de 100 g_cal.vis_cal_mV,
chromaticdeth87 0:77080c9376de 101 g_cal.vis_cal_ppb,
chromaticdeth87 0:77080c9376de 102 g_cal.trim_4mA,
chromaticdeth87 0:77080c9376de 103 g_cal.trim_20mA,
chromaticdeth87 0:77080c9376de 104 g_cal.ppb_at_20mA,
chromaticdeth87 0:77080c9376de 105 g_cal.padding,
chromaticdeth87 0:77080c9376de 106 g_cal.checksum);
chromaticdeth87 0:77080c9376de 107
chromaticdeth87 0:77080c9376de 108 }
chromaticdeth87 0:77080c9376de 109
chromaticdeth87 0:77080c9376de 110
chromaticdeth87 0:77080c9376de 111 static void read_cal_data(uint32_t address)
chromaticdeth87 0:77080c9376de 112 {
chromaticdeth87 0:77080c9376de 113
chromaticdeth87 0:77080c9376de 114 int i;
chromaticdeth87 0:77080c9376de 115 uint16_t *p;
chromaticdeth87 0:77080c9376de 116
chromaticdeth87 0:77080c9376de 117 // read cal data from flash address in 16 bit chunks
chromaticdeth87 0:77080c9376de 118 p = (uint16_t *)&g_cal;
chromaticdeth87 0:77080c9376de 119
chromaticdeth87 0:77080c9376de 120 for (i=0; i < CAL_HALFWORD_COUNT; i++) {
chromaticdeth87 0:77080c9376de 121
chromaticdeth87 0:77080c9376de 122 *p = *(__IO uint16_t *)address; // read cal data
chromaticdeth87 0:77080c9376de 123
chromaticdeth87 0:77080c9376de 124 address += sizeof(uint16_t);
chromaticdeth87 0:77080c9376de 125 p++;
chromaticdeth87 0:77080c9376de 126 }
chromaticdeth87 0:77080c9376de 127 #ifdef ENABLE_DEBUG_PRINTING
chromaticdeth87 0:77080c9376de 128 cal_print();
chromaticdeth87 0:77080c9376de 129 #endif
chromaticdeth87 0:77080c9376de 130 }
chromaticdeth87 0:77080c9376de 131
chromaticdeth87 0:77080c9376de 132 void cal_init()
chromaticdeth87 0:77080c9376de 133 {
chromaticdeth87 0:77080c9376de 134 uint32_t address;
chromaticdeth87 0:77080c9376de 135
chromaticdeth87 0:77080c9376de 136 // Assign factory defaults
chromaticdeth87 0:77080c9376de 137 factory_defaults();
chromaticdeth87 0:77080c9376de 138
chromaticdeth87 0:77080c9376de 139 // Start at beginning
chromaticdeth87 0:77080c9376de 140 DataAddress = CalPageAddress;
chromaticdeth87 0:77080c9376de 141 address = CalPageAddress;
chromaticdeth87 0:77080c9376de 142
chromaticdeth87 0:77080c9376de 143 while (IS_FLASH_PROGRAM_ADDRESS(address)) {
chromaticdeth87 0:77080c9376de 144 uint32_t val;
chromaticdeth87 0:77080c9376de 145 uint8_t *p;
chromaticdeth87 0:77080c9376de 146
chromaticdeth87 0:77080c9376de 147 p = (uint8_t *)&val;
chromaticdeth87 0:77080c9376de 148
chromaticdeth87 0:77080c9376de 149 val = *(__IO uint32_t*)address; // read 32 bits (4 bytes)
chromaticdeth87 0:77080c9376de 150
chromaticdeth87 0:77080c9376de 151 pc.printf("%hhX %hhX %hhX %hhX\n", p[0], p[1], p[2],p[3]);
chromaticdeth87 0:77080c9376de 152
chromaticdeth87 0:77080c9376de 153 // If the first 4 bytes are all 0xFF, the end of data has been reached
chromaticdeth87 0:77080c9376de 154 if ( (p[0] == 0xFF) && (p[1] == 0xFF) && (p[2] == 0xFF) && (p[3] == 0xFF)) break;
chromaticdeth87 0:77080c9376de 155 #ifdef ENABLE_DEBUG_PRINTING
chromaticdeth87 0:77080c9376de 156 pc.printf("Saved data found at %lX\n", address);
chromaticdeth87 0:77080c9376de 157 #endif
chromaticdeth87 0:77080c9376de 158
chromaticdeth87 0:77080c9376de 159 // Read cal data (this might not be the last one yet)
chromaticdeth87 0:77080c9376de 160 read_cal_data(address);
chromaticdeth87 0:77080c9376de 161
chromaticdeth87 0:77080c9376de 162 DataAddress = address; // save last used data address
chromaticdeth87 0:77080c9376de 163 address += sizeof(CALIBRATION_DATA); // Keep looking
chromaticdeth87 0:77080c9376de 164 }
chromaticdeth87 0:77080c9376de 165
chromaticdeth87 0:77080c9376de 166 // Verify checksum
chromaticdeth87 0:77080c9376de 167 if (g_cal.checksum != calc_checksum()) {
chromaticdeth87 0:77080c9376de 168 #ifdef ENABLE_DEBUG_PRINTING
chromaticdeth87 0:77080c9376de 169 pc.printf("Checksum mismatch, using factory defaults, flash = %u, calc = %u\n", g_cal.checksum, calc_checksum());
chromaticdeth87 0:77080c9376de 170 #endif
chromaticdeth87 0:77080c9376de 171 factory_defaults();
chromaticdeth87 0:77080c9376de 172 }
chromaticdeth87 0:77080c9376de 173 #ifdef ENABLE_DEBUG_PRINTING
chromaticdeth87 0:77080c9376de 174 else {
chromaticdeth87 0:77080c9376de 175 pc.printf("Checksum OK\n");
chromaticdeth87 0:77080c9376de 176 }
chromaticdeth87 0:77080c9376de 177 #endif
chromaticdeth87 0:77080c9376de 178
chromaticdeth87 0:77080c9376de 179
chromaticdeth87 0:77080c9376de 180 // Either valid data was found, or factory defaults are set
chromaticdeth87 0:77080c9376de 181
chromaticdeth87 0:77080c9376de 182 }
chromaticdeth87 0:77080c9376de 183
chromaticdeth87 0:77080c9376de 184
chromaticdeth87 0:77080c9376de 185 void cal_save()
chromaticdeth87 0:77080c9376de 186 {
chromaticdeth87 0:77080c9376de 187 int i;
chromaticdeth87 0:77080c9376de 188 uint16_t *p;
chromaticdeth87 0:77080c9376de 189
chromaticdeth87 0:77080c9376de 190 /*
chromaticdeth87 0:77080c9376de 191 * FLASH_TYPEPROGRAM_HALFWORD is 16 bits
chromaticdeth87 0:77080c9376de 192 * FLASH_TYPEPROGRAM_WORD is 32 bits = sizeof(float)
chromaticdeth87 0:77080c9376de 193 * FLASH_TYPEPROGRAM_DOUBLEWORD is 64 bits
chromaticdeth87 0:77080c9376de 194 * HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
chromaticdeth87 0:77080c9376de 195 */
chromaticdeth87 0:77080c9376de 196
chromaticdeth87 0:77080c9376de 197 //HAL_StatusTypeDef Status;
chromaticdeth87 0:77080c9376de 198 uint32_t NextDataAddress; // address to use for next saved data
chromaticdeth87 0:77080c9376de 199 uint32_t LastByteAddress; // address of last byte when new data is added
chromaticdeth87 0:77080c9376de 200 NextDataAddress = DataAddress + sizeof(CALIBRATION_DATA);
chromaticdeth87 0:77080c9376de 201 LastByteAddress = NextDataAddress + sizeof(CALIBRATION_DATA) - 1;
chromaticdeth87 0:77080c9376de 202
chromaticdeth87 0:77080c9376de 203 // First, decide if there is room at the end of the page for new data
chromaticdeth87 0:77080c9376de 204 if (!IS_FLASH_PROGRAM_ADDRESS(LastByteAddress)) {
chromaticdeth87 0:77080c9376de 205 // Erase the entire cal page
chromaticdeth87 0:77080c9376de 206 erase_page(CalPageAddress);
chromaticdeth87 0:77080c9376de 207 // Point to new location
chromaticdeth87 0:77080c9376de 208 NextDataAddress = CalPageAddress;
chromaticdeth87 0:77080c9376de 209 }
chromaticdeth87 0:77080c9376de 210 // Remember the location of the start of the new data
chromaticdeth87 0:77080c9376de 211 DataAddress = NextDataAddress;
chromaticdeth87 0:77080c9376de 212
chromaticdeth87 0:77080c9376de 213 // Update the checksum
chromaticdeth87 0:77080c9376de 214 g_cal.checksum = calc_checksum();
chromaticdeth87 0:77080c9376de 215
chromaticdeth87 0:77080c9376de 216 p = (uint16_t *) &g_cal;
chromaticdeth87 0:77080c9376de 217
chromaticdeth87 0:77080c9376de 218 HAL_FLASH_Unlock();
chromaticdeth87 0:77080c9376de 219
chromaticdeth87 0:77080c9376de 220 for (i=0; i < CAL_HALFWORD_COUNT; i++) {
chromaticdeth87 0:77080c9376de 221 HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, NextDataAddress, (uint64_t )(*p));
chromaticdeth87 0:77080c9376de 222 NextDataAddress += sizeof(uint16_t);
chromaticdeth87 0:77080c9376de 223 p++;
chromaticdeth87 0:77080c9376de 224 }
chromaticdeth87 0:77080c9376de 225
chromaticdeth87 0:77080c9376de 226 HAL_FLASH_Lock();
chromaticdeth87 0:77080c9376de 227 }
chromaticdeth87 0:77080c9376de 228
chromaticdeth87 0:77080c9376de 229
chromaticdeth87 0:77080c9376de 230 void cal_factory()
chromaticdeth87 0:77080c9376de 231 {
chromaticdeth87 0:77080c9376de 232 // Set device to factory defaults
chromaticdeth87 0:77080c9376de 233 erase_page(CalPageAddress);
chromaticdeth87 0:77080c9376de 234 cal_init();
chromaticdeth87 0:77080c9376de 235 cal_save();
chromaticdeth87 0:77080c9376de 236 }
chromaticdeth87 0:77080c9376de 237
chromaticdeth87 0:77080c9376de 238
chromaticdeth87 0:77080c9376de 239
chromaticdeth87 0:77080c9376de 240
chromaticdeth87 0:77080c9376de 241 #ifdef ENABLE_TEST_CODE
chromaticdeth87 0:77080c9376de 242
chromaticdeth87 0:77080c9376de 243 void direct()
chromaticdeth87 0:77080c9376de 244 {
chromaticdeth87 0:77080c9376de 245 int i;
chromaticdeth87 0:77080c9376de 246
chromaticdeth87 0:77080c9376de 247 //HAL_StatusTypeDef Status;
chromaticdeth87 0:77080c9376de 248 FLASH_EraseInitTypeDef EraseInit;
chromaticdeth87 0:77080c9376de 249 uint32_t PageError;
chromaticdeth87 0:77080c9376de 250
chromaticdeth87 0:77080c9376de 251 EraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
chromaticdeth87 0:77080c9376de 252 EraseInit.PageAddress = FLASH_BASE + (18 * FLASH_PAGE_SIZE);
chromaticdeth87 0:77080c9376de 253 EraseInit.NbPages = 1;
chromaticdeth87 0:77080c9376de 254
chromaticdeth87 0:77080c9376de 255 HAL_FLASH_Unlock();
chromaticdeth87 0:77080c9376de 256 HAL_FLASHEx_Erase(&EraseInit, &PageError);
chromaticdeth87 0:77080c9376de 257 HAL_FLASH_Lock();
chromaticdeth87 0:77080c9376de 258
chromaticdeth87 0:77080c9376de 259
chromaticdeth87 0:77080c9376de 260 printf("\nFlash memory values at start of each page:\n");
chromaticdeth87 0:77080c9376de 261 for (i=0; i<32; i++) {
chromaticdeth87 0:77080c9376de 262 uint32_t address;
chromaticdeth87 0:77080c9376de 263 uint32_t val;
chromaticdeth87 0:77080c9376de 264 uint8_t *p;
chromaticdeth87 0:77080c9376de 265
chromaticdeth87 0:77080c9376de 266 p = (uint8_t *)&val;
chromaticdeth87 0:77080c9376de 267 address = FLASH_BASE + (i * FLASH_PAGE_SIZE);
chromaticdeth87 0:77080c9376de 268
chromaticdeth87 0:77080c9376de 269 val = *(__IO uint32_t*)address; // read 32 bits (4 bytes)
chromaticdeth87 0:77080c9376de 270
chromaticdeth87 0:77080c9376de 271 printf("%i %hhX %hhX %hhX %hhX\n", i, p[0], p[1], p[2],p[3]);
chromaticdeth87 0:77080c9376de 272 }
chromaticdeth87 0:77080c9376de 273 }
chromaticdeth87 0:77080c9376de 274
chromaticdeth87 0:77080c9376de 275
chromaticdeth87 0:77080c9376de 276 static void increment_data()
chromaticdeth87 0:77080c9376de 277 {
chromaticdeth87 0:77080c9376de 278 g_cal.uv_zero_mV += 1; // uv adc mV reading at 0 ppb
chromaticdeth87 0:77080c9376de 279 g_cal.uv_cal_mV += 1; // uv adc mV reading at calibration point
chromaticdeth87 0:77080c9376de 280 g_cal.uv_cal_ppb += 0; // uv user ppb value at calibration point
chromaticdeth87 0:77080c9376de 281
chromaticdeth87 0:77080c9376de 282 g_cal.vis_zero_mV += 1;
chromaticdeth87 0:77080c9376de 283 g_cal.vis_cal_mV += 1;
chromaticdeth87 0:77080c9376de 284 g_cal.vis_cal_ppb += 1;
chromaticdeth87 0:77080c9376de 285
chromaticdeth87 0:77080c9376de 286 g_cal.trim_4mA += 1; // dac value to use for 4 mA
chromaticdeth87 0:77080c9376de 287 g_cal.trim_20mA += 1; // dac value to use for 20 mA
chromaticdeth87 0:77080c9376de 288
chromaticdeth87 0:77080c9376de 289 g_cal.checksum = calc_checksum();
chromaticdeth87 0:77080c9376de 290 }
chromaticdeth87 0:77080c9376de 291
chromaticdeth87 0:77080c9376de 292 void cal_test()
chromaticdeth87 0:77080c9376de 293 {
chromaticdeth87 0:77080c9376de 294
chromaticdeth87 0:77080c9376de 295 pc.printf("\b\nSTM32 Test Flash Memory\n");
chromaticdeth87 0:77080c9376de 296 pc.printf("Flash page size = %d bytes\n", FLASH_PAGE_SIZE);
chromaticdeth87 0:77080c9376de 297 pc.printf("CALIBRATION_DATA size = %d bytes\n", sizeof(CALIBRATION_DATA));
chromaticdeth87 0:77080c9376de 298 pc.printf("Max saves per page = %d\n", FLASH_PAGE_SIZE / sizeof(CALIBRATION_DATA));
chromaticdeth87 0:77080c9376de 299 pc.printf("Number of half-words = %d\n", CAL_HALFWORD_COUNT);
chromaticdeth87 0:77080c9376de 300 pc.printf("Number of words = %d\n", CAL_WORD_COUNT);
chromaticdeth87 0:77080c9376de 301 pc.printf("Number of double-words = %d\n", CAL_DOUBLEWORD_COUNT);
chromaticdeth87 0:77080c9376de 302 pc.printf("g_cal.vis_cal_ppb = %2.2f\n", g_cal.vis_cal_ppb);
chromaticdeth87 0:77080c9376de 303 pc.printf("Page Address: %lX \n", CalPageAddress);
chromaticdeth87 0:77080c9376de 304 // pc.printf("g_cal.mAOffsetValue = %f\n", g_cal.mAOffsetValue);
chromaticdeth87 0:77080c9376de 305
chromaticdeth87 0:77080c9376de 306
chromaticdeth87 0:77080c9376de 307
chromaticdeth87 0:77080c9376de 308 //cal_init();
chromaticdeth87 0:77080c9376de 309 //increment_data();
chromaticdeth87 0:77080c9376de 310 //cal_save();
chromaticdeth87 0:77080c9376de 311
chromaticdeth87 0:77080c9376de 312 //direct();
chromaticdeth87 0:77080c9376de 313
chromaticdeth87 0:77080c9376de 314 // Test 1: empty flash
chromaticdeth87 0:77080c9376de 315 // Test 2: junk in flash
chromaticdeth87 0:77080c9376de 316 // Test 3: valid stuff in flash
chromaticdeth87 0:77080c9376de 317 // Test 4: invalid checksum in flash
chromaticdeth87 0:77080c9376de 318 // Test 5: Repeated saves - does it loop back correctly ?
chromaticdeth87 0:77080c9376de 319
chromaticdeth87 0:77080c9376de 320
chromaticdeth87 0:77080c9376de 321 }
chromaticdeth87 0:77080c9376de 322 #endif