xC0000005 / Marlin

Optimized firmware for RepRap 3D printers based on the Arduino platform.
http://www.marlinfw.org/
GNU General Public License v3.0
22 stars 5 forks source link

LERDGE K - Pin mappings in platform IO. (Using LergePlusLcd as starting point) #13

Open cgapeart opened 3 years ago

cgapeart commented 3 years ago

Description

Lergde K build i2c EEProm not working

I think I found the source of the Lerdge K eeprom issue, but my attempt at fixing it didn't work. According to the Lerdge K pdf published on the Facebook group, SDA should be PG12 and PG13 The variant.h available for a lerdge board (Lerdge X) puts them at

Steps to Reproduce

  1. Build Lerdge K build based on the LerdgePlusLCD branch
  2. Monitor the serial port on boot
  3. Watch for EEPROM read/write errors

Expected behavior: On the first run, the I2C EEPROM should be initialized, and defaults stored. Following runs should be able to load/save the EEPROM settings

Actual behavior:

echo:start External Reset Marlin bugfix-2.0.x

echo: Last Updated: 2020-07-03 | Author: (Colin Peart, H0tstuff Core XY.) echo:Compiled: Aug 15 2020 echo: Free Memory: 9211 PlannerBufferBytes: 1408 echo:EEPROM version mismatch (EEPROM=? Marlin=V81) echo:Hardcoded Default Settings Loaded echo:Error writing to EEPROM! echo:Error writing to EEPROM! ... echo:Error writing to EEPROM! echo:Settings Stored (2 bytes; crc 0) Error:EEPROM datasize error. echo:EEPROM Initialized echo:Error writing to EEPROM! echo:Error writing to EEPROM!

Additional Information

Marlin-cgap-config-BR.zip

Assuming the lerdge K schematic is correct, then part one of the problem is setting up a seperate variant file with the correct pin mapping. As best I can tell, the variant.h file must be pulled in with platform io.

I notice that on the lerdge K schematic, there are pin numbers as well - Are those supposed to map to the same pin numbers in the variant.h? If so, PG12 and PG13 don't match. My best guess is that is not the case -- the pin numbers in the platform io variant.h are likely offsets used to find which bit(s) in the various GPIO control and access registers to use.

cgapeart commented 3 years ago

I pulled up the processor pin mapping from https://www.st.com/resource/en/datasheet/stm32f407zg.pdf and note that PG12 and PG13 do not have an i2c bus AF mapping -- Assuming for the moment that there is an error on the schematic. I will probe the board with my multimeter (as soon as I can find it) to confirm the pin mapping. The original PB9 and PB8 do match with I2C1_SDA and I2C1_SCL respectively. I am probably on a wild goose chase.

cgapeart commented 3 years ago

Using the PCB layer image from https://www.lerdge.com/public/upload/image/6747bcfffad56665cb940e0cefd63aa6.jpg It really does look like the EEPROM is on PG13 and PG14, which is not a hardware I2C port on this board. That would explain why I could never get it to work. I believe the i2c on the Lerdge K must be bit-banged. Hopefully Marlin has a bitbang driver for I2c - I will look into that and see what I can do.