sd card does not work no 1.0.2

I use arduino due + ramps for due with eeprom + FELIXPrinters Display. when I upgraded firmware from version 1.0.1 to 1.0.2 sd card stoppend working. On lcd I only see "Mount sd card" which does not work. On older firmware everything was fine.
regards miruniec
«1

Comments

  • I am also having trouble with SD cards. I am using a Due + Smart RAMPS + AZSMZ 12864 LCD/SD board and it was working fine on my old 0.92 setup. It detects that an SD card has been inserted/removed, but it doesn't show anything on the file list.
  • I readed somewhere on forum that repetier had changed  SdFat library to "a new modified version". The post was in German, which I do not understand (google translator) so I can be mistaken. The only hope I see is Repetier answer.
  • Yes, that is the major change in 1.0.2 that I now use a new version of SdFat that natively supports long filenames up to 26 chars by default. Had tested it on 2 boards and it worked there, so I commited the change.

    It might be a speed thing. Look into SDCard.cpp line 82

        if (!fat.begin(SDSS, SD_SCK_MHZ(50))) {

    it sets speed to 50 MHz maximum if SPI supports it. Please try 4MHz as a first test to test if communication is just too fast in your case.
  • Repetier said:
    Yes, that is the major change in 1.0.2 that I now use a new version of SdFat that natively supports long filenames up to 26 chars by default. Had tested it on 2 boards and it worked there, so I commited the change.

    It might be a speed thing. Look into SDCard.cpp line 82

        if (!fat.begin(SDSS, SD_SCK_MHZ(50))) {

    it sets speed to 50 MHz maximum if SPI supports it. Please try 4MHz as a first test to test if communication is just too fast in your case.
    I am sorry, but it does not work. I checked sd card signals with an osciloscope. During mounting sd card the only changes are on CS pin . Nothing on sck/mosi/miso. Where are those pins defined  and what are their names ? Do you use hardware spi ( in my case it has to be software spi ). 

  • Yes, sd fat is initialized as hardware spi. Why do you need software spi? 

    https://github.com/greiman/SdFat/blob/master/examples/SoftwareSpi/SoftwareSpi.ino

    shows how to initialize sdfat it for software SPI.

    I think You need to set SdFatConfig.h
    #define ENABLE_SOFTWARE_SPI_CLASS 1

    In repetier.h
    #if ENABLE_SOFTWARE_SPI_CLASS
    SdFatSoftSpi<SD_SOFT_MISO_PIN, SD_SOFT_MOSI_PIN, SD_SOFT_SCK_PIN> fat;
    SdFat fat;

    instead of SdFat fat;

    In SDCard.h

    #if ENABLE_SOFTWARE_SPI_CLASS
    fat.begin(SDSS)
    fat.begin(SDSS, SD_SCK_MHZ(50)); // dummy init of SD_CARD

    And in configuration of course define SD_SOFT_MISO_PIN, SD_SOFT_MOSI_PIN, SD_SOFT_SCK_PIN

    Then it should run in software spi mode.
  • I was using software spi due to pins used to conect sd card. My sd is outside board so I decided to connect it directly to arduino spi port. Now everything works. The problem still remains: upgrade fw to 1.0.2 changed in my configuration spi pins so it can happen to others
  • Yes, I'm aware of that which is why I posted the possible fix for testing, so in case it works I could add it to the sources. All my boards/sd cards are hard wired to hardware spi making testing the solution a bit hard.
  • I'm getting the same issue with my SD card. I have a Tronxy X1 with Melzi 2.0 board.  Do you think it could be the software SPI issue too?
  • I'm getting the same issue with my SD card. I have a Tronxy X1 with Melzi 2.0 board.  Do you think it could be the software SPI issue too?
    Ok, turns out if I re-format the SD card it works again.  Strange it stopped working just as I upgraded the firmware.
  • edited May 2018
    Hi,
    So I faced the same issue - SD card not mounting after 1.0.1->1.0.2.
    I use RADDS+DUE+RepRapDiscount FGSC.
    It's wired to the original RADDS headers (DIY adapter cable) and then described in uiconfig.h.
    Mount was set to manual.

    In this case lowering the speed from 50Mhz to 4Mhz as suggested above fixed the problem with mounting and now it mounts and lists files fine again.

    HOWEVER, there is now a problem with files named longer then 26 chars. They are displayed fine, but a print can't be started for such file.
    For example if a file is named "H_xyzCalibration_cube.gcode" (27 symb.) when I click on it, there is a short click sound, but nothing happens - print doesn't start!
    Renaming the file to "H_xyzCalibration_cub.gcode" (so it is now 26 symbols) and clicking then starts the print fine.
    I am pretty sure before the change I never experienced something like this and never ever have had any FAT related problems..
    What was wrong with your previous implementation of SdFAT ? I mean it was working good, actually was invisible .. you know better of course, just saying ..

    Thanks.





  • Haven't tried yet but in theory you can change max filename length in Repetier.h

    #define MAX_VFAT_ENTRIES (2)
    /** Total size of the buffer used to store the long filenames */
    #define LONG_FILENAME_LENGTH (13 * MAX_VFAT_ENTRIES + 1)
    #define SD_MAX_FOLDER_DEPTH 2

    Set MAX_VFAT_ENTRIES 3 and limit is 39 chars instead. Only point I'm not sure is if the display then gets problems as it does not fit in a row. I still have to test this, then I can make it at least default for due boards having enough memory for the extra memory.
  • edited August 2018
    Hi, i have same problem with Arduino due +Smartramps+ AZSMZ 12864. In 1.0.2 version SD doesn't works. I reduced speed to 4 MHz without result. Have you any ideas...

    Tnks In advance.
  • Did it work before? Not sure if SPI pins for that board are at same position for smartramps.
  • Yes until 1.0.0. dev...worked perfectly.
  • Ok, then try 2MHz. But make sure to find both calls setting frequency. Not sure how fast the old library version did set speed but everything is more or less the same. The library in general seems to work well if the speed works. Some boards seem to support longer cables or speeds then others without making problems.
  • I changed both lines, without result.  SD card regularly detected, but seems empty, it's not true offcourse.
  • Hi, i found this note on SMART RAMPS page...

    Note:SMART RAMPS + DUE only support SW SPI, SMART RAMPS + MEGA2560 support HW SPI.

    It means, i presume, that i can forget update of your firmware after 1.0.0.
    What can i do? throw it in the trash?


  • Sounds like the pins at same spot are then no hardware spi pins. The sdfat library still allows software spi. SdFatConfig.h says that
    #define ENABLE_SOFTWARE_SPI_CLASS 1
    is required so it also compiles the software spi class.

    SD_SOFT_MISO_PIN, SD_SOFT_MOSI_PIN, SD_SOFT_SCK_PIN

    are then the used pins for communication. So in theory it should be possible.
  • edited September 2018
    I confirm, that there is a problem with reading the SD card at 50 MHz from DUE+RADDS boards. On 4MHz it works correctly. (firmware 1.02)
  • Ok, well for you, radds offcourse support HW SPI. i'm not so lucky.
  • Did you try the software spi solution I posted?
  • Partially, I modified how  you suggest..

    I think You need to set SdFatConfig.h
    #define ENABLE_SOFTWARE_SPI_CLASS 1

    In repetier.h
    #if ENABLE_SOFTWARE_SPI_CLASS
    SdFatSoftSpi<SD_SOFT_MISO_PIN, SD_SOFT_MOSI_PIN, SD_SOFT_SCK_PIN> fat;
    SdFat fat;

    instead of SdFat fat;
    ------------------------------------------------------------------------------------------------
    In SDCard.h

    #if ENABLE_SOFTWARE_SPI_CLASS
    fat.begin(SDSS)
    fat.begin(SDSS, SD_SCK_MHZ(50)); // dummy init of SD_CARD


    I didn't find "SDCArd.h" so i presumed you means " SDCard.cpp", i modified with same code...was it right?


    "And in configuration of course define SD_SOFT_MISO_PIN, SD_SOFT_MOSI_PIN, SD_SOFT_SCK_PIN"

    Onestly i don't know where and how define this pin yet. Can you be more specific? It would be a great help




  • #define ENABLE_SOFTWARE_SPI_CLASS 1
    should simply be in Configuration.h along with SD_SOFT_MISO_PIN, SD_SOFT_MOSI_PIN, SD_SOFT_SCK_PIN.

    Apart from this I think everything is correct.
    Values for SD_SOFT_MISO_PIN, SD_SOFT_MOSI_PIN, SD_SOFT_SCK_PIN would be the same a sin old version where it worked. For hardware spi it is clear as these are defined by the processor. For software it can be any pin so it must be the one where you connect it. You should be able to compare position on RAMPS to know which pins on a socket are used as MISO/MOSI/SCK and then use the pin numbers from board pinout for that connector.
  • edited September 2018
    Yes !! it works!  I added in configuration. h as you said...


    #define ENABLE_SOFTWARE_SPI_CLASS 1

    #define SD_SOFT_MISO_PIN 50
    #define SD_SOFT_MOSI_PIN 51
    #define SD_SOFT_SCK_PIN 52

    but at first time compilation failed, it didn't like the added code on SDcard.cpp...

    #if ENABLE_SOFTWARE_SPI_CLASS
    fat.begin(SDSS)
    #else
    fat.begin(SDSS, SD_SCK_MHZ(50)); // dummy init of SD_CARD

    Exit with this error...


    SDCard.cpp:26:1: error: 'fat' does not name a type
     fat.begin(SDSS)
     ^
    exit status 1
    'fat' does not name a type


    Without this part of code, compilation is good and SD apparently( at first look)works. I saw files inside SD card, finally!

    What i am doing wrong on SDcard.cpp ?






  • Not sure what you did wrong, could not reproduce this. But I have now updated the dev version so that I can compile with
    #define ENABLE_SOFTWARE_SPI_CLASS 1

    #define SD_SOFT_MISO_PIN 50
    #define SD_SOFT_MOSI_PIN 51
    #define SD_SOFT_SCK_PIN 52

    and get no errors. Of course untested as I have no smart ramps, but that should make things easier.
  • edited September 2018
    I found the problem on SDcard.cpp . 
    A semicolon missing at the end of..."fat.begin(SDSS)"   
     I added everything on SDCard.cpp with success!  No compiling error and Sd card accessible.

    As always thanks a lot for your support.


  • edited September 2018
    Hi! I tested version 1.0.3 on my arduino due+RADDS - SD card works correctly. Thanks you! 

  • edited September 2018
    also confirmed
  • Hi. I also tested 1.0.3 fw. Sd card works. But printing (from sdcard, also pc) is too slow with occasional pause (like slow reading commands). Buffer is still on 16. Not react to change speed multiplier.
    I tried change eeprom usage, also disable eeprom. With no change.
    When i downgrade to 1.0.0 all is correct as before.
    Someone has met with this problem?
    Thx.

    Arduino Due with RADDS and Full graphic display defined in uiconfig.h
  • Hi
    Due + SmartRAMPS + AZSMZ LCD with encoder, reset button and buzzer, Repetier 1.0.3 firmware, SW_SPI speed reduced up to 0.5 Mhz...
    similar problem; all connections verified, SD card insertion and extraction recognised but Arduino serial monitor reports:

    start
    Info:PowerUp
    Detected EEPROM version:19
    Free RAM:79556
    SD init fail

    " SD initialization failed.
    Do not reformat the card!
    Is the card correctly inserted?
    Is chipSelect set to the correct value?
    Does another SPI device need to be disabled?
    Is there a wiring/soldering problem?
    errorCode: 32
    Autoretract:0
    X:0.00 Y:0.00 Z:0.000 E:0.0000
    SelectExtruder:0
    FlowMultiply:100 "

    Anyone has made some progress ?
Sign In or Register to comment.