diff --git a/Cards/.gitignore b/Cards/.gitignore index 0aa35ad..962b685 100644 --- a/Cards/.gitignore +++ b/Cards/.gitignore @@ -1 +1,2 @@ -T* +TEST* +Gerbers* diff --git a/Cards/EaserCAT-2000/Firmware/platformio.ini b/Cards/EaserCAT-2000/Firmware/platformio.ini index 4e185a2..570f170 100755 --- a/Cards/EaserCAT-2000/Firmware/platformio.ini +++ b/Cards/EaserCAT-2000/Firmware/platformio.ini @@ -15,7 +15,7 @@ board = genericSTM32F407VGT6 upload_protocol = stlink debug_tool = stlink debug_build_flags = -O0 -g -ggdb -monitor_port = COM7 +monitor_port = COM10 monitor_filters = send_on_enter, time, colorize, log2file monitor_speed = 115200 build_flags = -Wl,--no-warn-rwx-segment diff --git a/Cards/EaserCAT-3000-Digital-Stepper-Analog-Encoder-Frequency/Firmware/platformio.ini b/Cards/EaserCAT-3000-Digital-Stepper-Analog-Encoder-Frequency/Firmware/platformio.ini index ddabaed..99cf472 100755 --- a/Cards/EaserCAT-3000-Digital-Stepper-Analog-Encoder-Frequency/Firmware/platformio.ini +++ b/Cards/EaserCAT-3000-Digital-Stepper-Analog-Encoder-Frequency/Firmware/platformio.ini @@ -15,7 +15,7 @@ board = genericSTM32F407VGT6 upload_protocol = stlink debug_tool = stlink debug_build_flags = -O0 -g -ggdb -monitor_port = COM3 +monitor_port = COM10 monitor_filters = send_on_enter, time, colorize, log2file monitor_speed = 115200 build_flags = -Wl,--no-warn-rwx-segment -Ilib/soes/include/sys/gcc -DAX58100 diff --git a/Cards/EaserCAT-3000-Digital-Stepper-Analog-Encoder-Frequency/Firmware/src/main.cpp b/Cards/EaserCAT-3000-Digital-Stepper-Analog-Encoder-Frequency/Firmware/src/main.cpp index 248293c..403b789 100755 --- a/Cards/EaserCAT-3000-Digital-Stepper-Analog-Encoder-Frequency/Firmware/src/main.cpp +++ b/Cards/EaserCAT-3000-Digital-Stepper-Analog-Encoder-Frequency/Firmware/src/main.cpp @@ -38,7 +38,7 @@ void basePeriodCB(void); #include "MyEncoder.h" volatile uint16_t encCnt = 0; void indexPulseEncoderCB1(void); -MyEncoder Encoder1(TIM2, PA2, indexPulseEncoderCB1); +MyEncoder Encoder1(TIM2, PA3, indexPulseEncoderCB1); void indexPulseEncoderCB1(void) { encCnt++; @@ -76,7 +76,7 @@ void cb_set_outputs(void) // Get Master outputs, slave inputs, first operation for (int i = 0; i < min(sizeof(Obj.Outputs), sizeof(OUTPUTS)); i++) digitalWrite(OUTPUTS[i], Obj.Outputs[i] == 1 ? HIGH : LOW); // analogWrite(DAC1_pin, Obj.Voltage); - // Encoder1.setLatch(Obj.IndexLatchEnable); + //Encoder1.setLatch(Obj.IndexLatchEnable); // Encoder1.setScale(2000); Step->stepgen_array[0].pos_scale = -Obj.StepsPerMM1; // Scale perhaps changed @@ -199,6 +199,8 @@ void setup(void) // Compute this scale factor only once input_freq = FrequencyTimer->getTimerClkFreq() / FrequencyTimer->getPrescaleFactor(); + encoder_config(); // Needed by encoder, possibly breaks some timers. + ecat_slv_init(&config); attachInterrupt(digitalPinToInterrupt(PC0), globalInt, RISING); // For testing, should go into Enable_interrupt later on } diff --git a/Utils/EEPROM_store_valid/.gitignore b/Utils/EEPROM_store_valid/.gitignore new file mode 100755 index 0000000..89cc49c --- /dev/null +++ b/Utils/EEPROM_store_valid/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/Utils/EEPROM_store_valid/.vscode/extensions.json b/Utils/EEPROM_store_valid/.vscode/extensions.json new file mode 100755 index 0000000..080e70d --- /dev/null +++ b/Utils/EEPROM_store_valid/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/Utils/EEPROM_store_valid/include/README b/Utils/EEPROM_store_valid/include/README new file mode 100755 index 0000000..45496b1 --- /dev/null +++ b/Utils/EEPROM_store_valid/include/README @@ -0,0 +1,39 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the usual convention is to give header files names that end with `.h'. +It is most portable to use only letters, digits, dashes, and underscores in +header file names, and at most one dot. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/Utils/EEPROM_store_valid/lib/README b/Utils/EEPROM_store_valid/lib/README new file mode 100755 index 0000000..a10cade --- /dev/null +++ b/Utils/EEPROM_store_valid/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into executable file. + +The source code of each library should be placed in an own separate directory +("lib/your_library_name/[here are source files]"). + +For example, see a structure of the following two libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +and a contents of `src/main.c`: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +PlatformIO Library Dependency Finder will find automatically dependent +libraries scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/Utils/EEPROM_store_valid/platformio.ini b/Utils/EEPROM_store_valid/platformio.ini new file mode 100755 index 0000000..10e5f78 --- /dev/null +++ b/Utils/EEPROM_store_valid/platformio.ini @@ -0,0 +1,17 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:esp32doit-devkit-v1] +platform = espressif32 +board = esp32doit-devkit-v1 +framework = arduino +monitor_port = COM3 +monitor_speed = 115200 +lib_deps = robtillaart/I2C_EEPROM diff --git a/Utils/EEPROM_store_valid/src/EEPROM_store_valid.cpp b/Utils/EEPROM_store_valid/src/EEPROM_store_valid.cpp new file mode 100755 index 0000000..4b43372 --- /dev/null +++ b/Utils/EEPROM_store_valid/src/EEPROM_store_valid.cpp @@ -0,0 +1,163 @@ +// Write a valid eeprom for LAN9252. +// +#include +#include +// Define LAN9252 or AX58100 +// Output below from binary eeprom: xxd --include eeprom_data.bin +// #define LAN9252 +// #define AX58100 +#define LAN9252 +//#define PROGRAM_EEPROM +// Don't define PROGRAM_EEPROM if you only want to read out contents +#ifdef LAN9252 +#define ESC_STRING "LAN9252" +const uint8_t eeprom_data[] = { + 0x04, 0x0f, 0x00, 0x44, 0x10, 0x27, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xd4, 0x00, 0xd8, 0x04, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x1c, 0x00, + 0x02, 0x0d, 0x4c, 0x41, 0x4e, 0x39, 0x32, 0x35, 0x32, 0x2d, 0x44, 0x49, + 0x47, 0x49, 0x4f, 0x28, 0x39, 0x32, 0x35, 0x32, 0x20, 0x38, 0x20, 0x43, + 0x68, 0x2e, 0x20, 0x44, 0x69, 0x67, 0x2e, 0x20, 0x49, 0x6e, 0x2d, 0x2f, + 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x32, 0x78, 0x4d, 0x49, 0x49, + 0x20, 0x28, 0x4e, 0x6f, 0x20, 0x44, 0x43, 0x29, 0x1e, 0x00, 0x10, 0x00, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x01, 0x00, + 0x01, 0x02, 0x29, 0x00, 0x08, 0x00, 0x01, 0x0f, 0x00, 0x00, 0x44, 0x00, + 0x01, 0x03, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0xff, 0xff +}; + +#endif +#ifdef AX58100 +#define ESC_STRING "Ax58100" +// xxd --include eeprom_data.bin +unsigned char eeprom_data[] = { + 0x04, 0x0d, 0x00, 0x44, 0x10, 0x27, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc1, 0x00, 0x95, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x1b, 0x00, + 0x02, 0x0b, 0x41, 0x58, 0x35, 0x38, 0x31, 0x30, 0x30, 0x5f, 0x45, 0x56, + 0x42, 0x28, 0x41, 0x58, 0x35, 0x38, 0x31, 0x30, 0x30, 0x20, 0x45, 0x56, + 0x42, 0x20, 0x28, 0x44, 0x69, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x20, 0x31, + 0x36, 0x2d, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x2f, 0x31, 0x36, 0x2d, 0x4f, + 0x75, 0x74, 0x70, 0x75, 0x74, 0x29, 0x1e, 0x00, 0x10, 0x00, 0x01, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x01, 0x00, 0x01, 0x02, + 0x29, 0x00, 0x0c, 0x00, 0x02, 0x0f, 0x00, 0x00, 0x44, 0x00, 0x01, 0x03, + 0x03, 0x0f, 0x00, 0x00, 0x44, 0x00, 0x01, 0x03, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x04, 0xff, 0xff}; + +#endif + +// 32 kbit bytes +#define EEPROM_MAXBYTES 32 * 1024 / 8 + +// the address of your EEPROM +#define DEVICEADDRESS (0x50) + +I2C_eeprom eeprom(DEVICEADDRESS, EEPROM_MAXBYTES); +void dumpEEPROM(uint16_t memoryAddress, uint16_t length); +void printHex(byte b); + +void setup() +{ + Serial.begin(115200); + while (!Serial) + ; + Serial.println(); + Serial.println("IT IS BEGINNING"); + Serial.println("WAIT FOR IT"); + + Wire.begin(); + eeprom.begin(); +#ifdef PROGRAM_EEPROM + Serial.println("----------------------------------------------"); + Serial.print("Writing "); + Serial.print(sizeof(eeprom_data)); + Serial.print(" long data for "); + Serial.println(ESC_STRING); + uint8_t ok; + ok = eeprom.writeBlockVerify(0, eeprom_data, sizeof(eeprom_data)); + if (ok) + { + Serial.println("Success writeBlockVerify"); + Serial.println("\nThat's it. It worked\n"); + } + else + { + Serial.println("Failed writeBlockVerify"); + } + + Serial.println("----------------------------------------------"); +#endif + dumpEEPROM(0, sizeof(eeprom_data)); +} + +void loop() +{ + // Nothing to do during loop +} + +void dumpEEPROM(uint16_t memoryAddress, uint16_t length) +{ + const int BLOCK_TO_LENGTH = 12; + + Serial.print(" "); + for (int x = 0; x < 10; x++) + { + if (x != 0) + Serial.print(" "); + Serial.print(x, HEX); + } + Serial.println("\n--------------------------------------------------------"); + + // block to defined length + memoryAddress = memoryAddress / BLOCK_TO_LENGTH * BLOCK_TO_LENGTH; + // length = (length + BLOCK_TO_LENGTH - 1) / BLOCK_TO_LENGTH * BLOCK_TO_LENGTH; + + byte b = eeprom.readByte(memoryAddress); + for (unsigned int i = 0; i < length; i++) + { + char buf[16]; + if (memoryAddress % BLOCK_TO_LENGTH == 0) + { + if (i != 0) + Serial.println(); + if (memoryAddress == 0) + Serial.print(" "); + else if (memoryAddress < 100) + Serial.print(" "); + else if (memoryAddress < 1000) + Serial.print(" "); + + Serial.print(memoryAddress); + Serial.print(": "); + } + printHex(b); + b = eeprom.readByte(++memoryAddress); + } + Serial.println("\n-----------------------------------"); +} + +void printHex(byte b) +{ + char buf[20]; + sprintf(buf, "0x%02x ", b); + Serial.print(buf); +} diff --git a/Utils/EEPROM_store_valid/test/README b/Utils/EEPROM_store_valid/test/README new file mode 100755 index 0000000..b0416ad --- /dev/null +++ b/Utils/EEPROM_store_valid/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/Utils/LAN9252_eeprom_store_valid/LAN9252_eeprom_store_valid.ino b/Utils/LAN9252_eeprom_store_valid/LAN9252_eeprom_store_valid.ino deleted file mode 100755 index df079c0..0000000 --- a/Utils/LAN9252_eeprom_store_valid/LAN9252_eeprom_store_valid.ino +++ /dev/null @@ -1,233 +0,0 @@ -// Write a valid eeprom for LAN9252. -// Uses https://github.com/RobTillaart/I2C_EEPROM -// -// Wiring: -// 4 GND -// 5 SDA -// 6 SCL -// 8 Vcc -// (1,2,3,7) A0,A1,A2,WP unconnected => write-enabled at address 0x50 -// -#include -#include -const uint8_t eeprom_data[] = { - 0x80, 0x06, 0x03, 0x44, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x14, 0x00, 0xe1, 0x10, 0x00, 0x00, 0xd2, 0x04, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x80, 0x00, 0x80, 0x10, 0x80, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x21, 0x00, - 0x04, 0x0c, 0x45, 0x61, 0x73, 0x65, 0x72, 0x43, 0x41, 0x54, 0x32, 0x30, - 0x30, 0x30, 0x09, 0x6d, 0x79, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x72, - 0x06, 0x49, 0x4d, 0x47, 0x43, 0x42, 0x59, 0x22, 0x4d, 0x65, 0x74, 0x61, - 0x6c, 0x4d, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x45, 0x61, 0x73, - 0x65, 0x72, 0x43, 0x41, 0x54, 0x20, 0x32, 0x30, 0x30, 0x30, 0x20, 0x65, - 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x1e, 0x00, 0x10, 0x00, 0x02, 0x03, - 0x01, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x02, 0x00, 0x01, 0x02, - 0x03, 0x00, 0x29, 0x00, 0x10, 0x00, 0x00, 0x10, 0x80, 0x00, 0x26, 0x00, - 0x01, 0x01, 0x80, 0x10, 0x80, 0x00, 0x22, 0x00, 0x01, 0x02, 0x00, 0x16, - 0x00, 0x00, 0x24, 0x00, 0x01, 0x03, 0x00, 0x1a, 0x00, 0x00, 0x20, 0x00, - 0x01, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -}; - - -// 512 kbit bytes -#define EEPROM_MAXBYTES 32 * 1024 / 8 - -// the address of your EEPROM -// 0x50 when A0,A1,A2 are left unconnected -#define DEVICEADDRESS (0x50) - -I2C_eeprom eeprom(DEVICEADDRESS, EEPROM_MAXBYTES); - -void setup() { - Serial.begin(115200); - while (!Serial) - ; - Serial.println("WAIT FOR IT"); - delay(3000); - Serial.println("IT IS BEGINNING"); - - Wire.begin(); - eeprom.begin(); -#if 0 - Serial.println("----------------------------------------------"); - Serial.printf("Writing %d long data\n", sizeof(eeprom_data)); - uint8_t ok; - ok = eeprom.writeBlockVerify(0, eeprom_data, sizeof(eeprom_data)); - if (ok) { - Serial.printf("Success writeBlockVerify\n"); - } else { - Serial.printf("Failed writeBlockVerify\n"); - } -#endif - Serial.println("----------------------------------------------"); - Serial.printf("\n VERIFYING\n"); - for (uint16_t adr = 0; adr < sizeof(eeprom_data); adr++) { - uint8_t rB = eeprom.readByte(adr); - if (rB != eeprom_data[adr]) { - Serial.printf("Not same at addr=%u, read=%u should be %u\n", adr, rB, eeprom_data[adr]); - } - } - Serial.println("----------------------------------------------"); - Serial.printf("\n VERIFYING DONE\n"); -} - - -void loop() { - // Nothing to do during loop -}