MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.11k stars 19.2k forks source link

[BUG] SD card support for teensy 4.1 does not compile in Arduino IDE with Marlin 2.0.7 from 2.x.x #19562

Closed nanotuxi closed 3 years ago

nanotuxi commented 3 years ago

Bug Description

Compiling Marlin 2.0.7 from the default branch for teensy 4.1 with MOTHERBOARD BOARD_TEENSY41 and #define SDSUPPORT enabled does not work in Arduino IDE 1.8.13/Teensyduino 1.53 error is Compiler says In file included from /tmp/arduino_build_871308/sketch/src/HAL/STM32F1/onboard_sd.cpp:19:0: /tmp/arduino_build_871308/sketch/src/HAL/STM32F1/SPI.h:28:37: fatal error: libmaple/libmaple_types.h: No such file or directory compilation terminated. Fehler beim Kompilieren für das Board Teensy 4.1.

My Configurations

Everything else but the two changes in the config mentioned above are left to default.

Steps to Reproduce

  1. Download fresh sources from https://github.com/MarlinFirmware/Marlin.git 2.x.x branch
  2. set #define MOTHERBOARD BOARD_RAMPS_14_EFB to #define MOTHERBOARD BOARD_TEENSY41
  3. change //#define SDSUPPORT to #define SDSUPPORT
  4. compile the sources in Arduino IDE as shown above.

Expected behavior: Compilation should not show any errors and sd card support for the teensy 4.1 onboard sd-card reader should be enabled.

Actual behavior: Compilation fails with file not found error mentioned above.

Additional Information

Compilation with //#define SDSUPPORT (sd card support disabled) works fine and the board can be connected without any error with serial connection. In Arduino IDE keybord layout for teensy board is set to German. The board is not connected to anything else (bare). Some examples from the SDfat library from https://github.com/greiman/SdFat-beta.git compiled fine and worked as expected.

boelle commented 3 years ago

Configurations, please Please ZIP up your Configuration.h and Configuration_adv.h files (as requested in the Issue template) and drop them into your next reply. We'll check them over and see if anything is amiss.

Please test the bugfix-2.0.x branch to see where it stands. 2.0.7 is just a frozen copy of that anyway

boelle commented 3 years ago

Arduino IDE 1.8.13/Teensyduino 1.53

please use vs code + platform.io extension

boelle commented 3 years ago

fatal error: libmaple/libmaple_types.h: No such file or directory

there is a small clue

nanotuxi commented 3 years ago

Marlin 2.0.7 @thinkyhead thinkyhead released this yesterday , so there are no updates in the bugfix branch. Tried with platform.io and compilation is fine now. Connection over serial is fine. But sending a M20 says No media. Do I have to configure the PINS for the onboard sd card somewhere else to use it?

sjasonsmith commented 3 years ago

Does M20 work if you first send M21?

Teensy 4.1 was only added a few days ago. I expect there are some issues, but SD seems like core functionality that hopefully works.

ellensp commented 3 years ago

In Marlin/Marlin/src/HAL/STM32F1/onboard_sd.cpp add #ifdef __STM32F1__ after the end of comment */ (line 12) And close it with adding a #endifto the very end of the file.

ellensp commented 3 years ago

Issue is arduino ide trying to compile STM32F1 code. Platformio is smart enough to not compile it, but arduino ide you have to explicitly tell it just skip this when not compiling for a STM32F1.

This compiles, let 'us' know if sd card actually works.

nanotuxi commented 3 years ago

@ellensp Compilation works now with Arduino IDE. But for some unknown reason the board doesn't work anymore as it should. There is something wrong with the serial connection/driver on my linux machine. Trying to connect to the board results sometimes in a kernel oops and I have to hard reset the whole machine. Have to investigate this later, so I can't tell you now, if the sd card works. Will give you a feedback when I found the reason for that. Thank you.

nanotuxi commented 3 years ago

Forgot to set the dummie values for the thermistors.

Switched to bugfix-2.0.x Good news: Compilation works (also with 2.0.7 branch). Board can be connected to e.g. RepetierHost. Tested with both Marlin 2.0.7 and bugfix-branch. Tested with both Arduino IDE 1.8.13/Teensyduino1.53 and updated platformio. Bad news: The sd card does't init . It says after M21

11:36:04.675 : echo:No SD card 11:36:04.675 : echo:No media Triggering the M21 command lets the red led on the teensy board light up for about a second. nt_marlin_teensy4_1.zip Got an ethernet adapter for teensy 4.1 yesterday and will try to get it running.

Should I open another bug report with this issue and close this one?

nanotuxi commented 3 years ago

@ellensp Thanks for the solution

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.