I2C Error Marlin 2


I2C Compile Error in Marlin 2 with the LPC176X chipsets. Follow this guide to temporarily fix the issue with SKR V1.3, V1.4 and other printers.

Moreover if you get an error similar to that shown below, try the fix in this guide to temporary solve the issue.

.pio/build/LPC1768/libFrameworkArduino.a(arduino.cpp.o): In function eeprom_write_byte(unsigned char, unsigned char)’: .platformio/packages/framework-arduino-lpc176x/cores/arduino/arduino.cpp:111: multiple definition of eeprom_write_byte(unsigned char, unsigned char)’

In the file arduino.cpp (See path below) there is a section that is currently being duplicated in the HAL/shared/eeprom_i2c.cpp file. However we can’t remove the reference in the HAL version. Instead we need to get to the core of the Arduino framework.

platformio/packages/framework-arduino-lpc176x/cores/arduino/arduino.cpp

Without a doubt the problem is actually trying to find the file as it is deeply hidden.

Furthermore the full path for the file on a Mac is:

/Users/YourLoginName/.platformio/packages/framework-arduino-lpc176x/cores/arduino/arduino.cpp 

Additionally the full path for the file on a PC is:

C:\Users/YourUserName\.platformio\packages\framework-arduino-lpc176x\cores\arduino\arduino.cpp 

For PC users skip to the Editing on PC section.

Editing on Mac

On the Mac launch Finder then at the top of the screen in the Go section click on Computer.

  • Double click on Macintosh HD
  • Double click on Users
  • Double click on your login name

However at this point the folder we are after is hidden. So we need to unhide them.

At the same time press the CMD and the LEFT SHIFT BUTTON and the FULL STOP BUTTON. Furthermore this will reveal the hidden files and folders on your Mac. Additionally to hide the files again press the same keys as before.

While you will see a lot more folders suddenly reappear, the folder we are after is .platformio.

  • Double click on .platformio
  • Double click on packages
  • Double click on framework-arduino-lpc176x
  • Double click on cores
  • Double click on arduino

Furthermore scroll down and look for the file called arduino.cpp, right click on the file and select open with and then select TextEdit.

Editing the arduino.cpp on Mac

Once loaded scroll down until you find the Persistent Config Storage you cant miss it it looks like below.

// *********************
// Persistent Config Storage
// *********************

Without a doubt we need to disable this section. Use the below code as an example of what to disable by using double forward slashes // before each eeprom line (See below).

//
// Persistent Config Storage
//
// MAKE N VAPE SKR V1.4 I2C EEPROM FIX
// void eeprom_write_byte(uint8_t *pos, unsigned char value) { }
//uint8_t eeprom_read_byte(uint8_t * pos) { return ‘\0’; }
//void eeprom_read_block(void *__dst, const void *__src, size_t __n) { }
//void eeprom_update_block(const void *__src, void *__dst, size_t __n) { }
//

Now goto File and Save in Text Edit – Leave Text Edit open in case of a mistake.

Finally close Visual Studio Code and in-turn PlatformIO. Relaunch so that it can read the amended file. Before recompiling click on the clean option first, once completed the click build.

Furthermore the I2C Compile Error in Marlin 2 on the Mac should now be resolved.

While I have been using this method for a good few months I have not found an issues arising from its use.

If you found this guide useful please consider a donation to help keep the Make ‘N’ Vape website running. It would be amazing.

Thank You

Donate to Make N Vape

Editing on PC

On the PC launch file explorer.

Additionally scroll down on the left column and click on Local Disk for many this is C:

  • Double click on Local Disk (for many this is C:)
  • Double click on Users
  • Double click on your login name

However at this point the folder we are after is hidden. So we need to unhide them.

Goto to the search Web and Windows search bar type Control Panel.

Click on the Control Panel Icon
Click on Appearance and Personalisation

Furthermore on the File Explorer Options click on Show hidden files and folders.

Additionally a new options window will open, look for and tick the option for show hidden files, folders, and drives. Then Click on Apply towards the bottom right of the option window.

Finally return to File Explorer and you should now see the .platformio folder.

  • Double click on .platformio
  • Double click on packages
  • Double click on framework-arduino-lpc176x
  • Double click on cores
  • Double click on arduino

Furthermore look for the file called arduino.cpp, right click on the file and select the open with and option. Next select search through Windows, when icons appear click on Word Pad and click OK.

Editing the arduino.cpp on PC

Once loaded scroll down until you find the Persistent Config Storage you cant miss it it looks like below.

// *********************
// Persistent Config Storage
// *********************

Without a doubt we need to disable this section. Use the below code as an example of what to disable by using double forward slashes // before each eeprom line (See below).

//
// Persistent Config Storage
//
// MAKE N VAPE SKR V1.4 I2C EEPROM FIX
// void eeprom_write_byte(uint8_t *pos, unsigned char value) { }
//uint8_t eeprom_read_byte(uint8_t * pos) { return ‘\0’; }
//void eeprom_read_block(void *__dst, const void *__src, size_t __n) { }
//void eeprom_update_block(const void *__src, void *__dst, size_t __n) { }
//

Now goto File and Save in Word Pad – Leave Word Padt open in case of a mistake.

Finally close Visual Studio Code and in-turn PlatformIO. Relaunch so that it can read the amended file. Before recompiling click on the clean option first, once completed the click build.

Furthermore the I2C Compile Error in Marlin 2 on the PC should now be resolved.

If you found this guide useful please consider a donation to help keep the Make ‘N’ Vape website running. It would be amazing.

Thank You

Donate to Make N Vape

© 2019-2020 Copyright - All Rights Reserved.