How to use DueFlashStorage in Arduino Due (Middleware)




Hello World !!

      This topic we want to tell that the example of Arduino Mega2560 is not enough of EEPROM to applicable. So I find the other to resolve this problem. now we can use DueFlashStorage and Arduino Due to save binary code that download from EP iLogic.


  •  First you can Download DueFlashStorage  this link https://www.arduinolibraries.info/libraries/due-flash-storage  and unzip.  Copy that files to Arduino\Libraries directory.  That meaning your installed arduino can use third solution of library to DueFlashStorage.
  • Please modify and merge the file DueFlashStorage.h
        <<   from: >>
                 // 1Kb of data

                 #define DATA_LENGTH   ((IFLASH1_PAGE_SIZE/sizeof(byte))*4)

         <<  to: >> 

              // 250Kb of data
              #define DATA_LENGTH   ((IFLASH1_PAGE_SIZE/sizeof(byte))* 4 * 250)

             250 Kb you can set up with your decision.


  • Please New Project from Sample Template (you can select Due Balance Car)
           .<<   from: >>
            #include <EEPROM.h>
            byte iLogic_eeprom_read_byte(unsigned int addr)
              { return EEPROM.read(addr);
              }
            void iLogic_eeprom_write_byte( unsigned int addr , byte data )
             { EEPROM.write(addr, data);
             }

         << to: >>
       #include <DueFlashStorage.h>
           DueFlashStorage dueFlashStorage;
           byte iLogic_eeprom_read_byte(unsigned int addr)
          {    return dueFlashStorage.read(addr);
           }
         void iLogic_eeprom_write_byte( unsigned int addr , byte data )
         {   dueFlashStorage.write(addr,data);
         }


  • Complete the uppers,  you can use flash to storage,  please carefully  SetDValue , and SetDAValue do not be set too many times in FUNCs. It will write data to flash.














Comments

Popular posts from this blog

Blogger and Service On !!