Viki LCD will not select SD card file

1,350 views
Skip to first unread message

TJ

unread,
Jul 6, 2013, 11:42:36 AM7/6/13
to make...@googlegroups.com
Hi All, 

I finally decided to get my Viki LCD setup which went pretty well except I cannot select a print from the SD card using the Viki. 

If I go to print from Sd card, then when I click the center button to select a file, nothing happens it just sits there. I can exit the menu using the left button, but not select a subfolder or file Also what is odd is that if I change the SD card when it is on, it will not refresh to the new one or give me the option to refresh. I have to power it on and off to get it to show what is on the SD card. 

Yet, when I connect via Pointerface and select and SD print it works fine. So since the SD reader seems to be working ok I am at a total loss. 

I used the firmware from http://makergear.wikidot.com/m2-lcd-panel and followed the connection instructions there. 

Any suggestions or ideas would be greatly appreciated. 

Thank you for your time.

Cal Braun

unread,
Jul 6, 2013, 12:46:13 PM7/6/13
to make...@googlegroups.com
What was the name of the file? Try renaming the file to something simple and that is only a few characters like test.gcode (no numbers or special characters) and make sure it's in the root directory of the SD card. Then let me know if you can start the print from the LCD with that file. 

79be...@googlemail.com

unread,
Jul 6, 2013, 1:31:04 PM7/6/13
to make...@googlegroups.com
Hi All,

I have the exact same problem as TJ. The Viki controller will read the card but will not let me select any file to print. I tried as Cal suggested but made no difference.

This is a new build for me so I have yet to experience my first 3D print so I'm full of excitement and any help is very much appreciated

Dale Reed

unread,
Jul 6, 2013, 2:09:39 PM7/6/13
to make...@googlegroups.com
I used Chan's FATfs file system when I made a little MP3 player project.  It works great with SDHC cards (4GB and up), but you have to compile in the option for FAT-32.  By default it works with FAT-12 and FAT-16 only.

I know the M2 works with 4GB and 16GB cards, so FAT-32 support is definitely there.  And it works with 1G and 2G cards, so FAT-16 support is there.  I tried an old 32 MB (yes, 32 meg) SD card on my M2, and it wouldn't work.  Probably FAT-12, which might not be supported.....  

I haven't checked into this, but I saw a 64 GB SD Card on sale labeled "SDXC" -- and it said "use only with ....." --- so the Marlin firmware might not support those.

Finally, the FAT file system used in the firmware probably doesn't understand Microsoft's long file name method.  And the extension probably needs to be  ".G".  (".GCODE" would require long name support.)  So be sure the file has an 8x3 filename, and try all caps --- something like  "TEST.G" --- and put it in the root folder/directory of the card.

If that doesn't work, try another brand of card.  The firmware is using the "SPI" interface to the card, which uses a total of 6 wires --- +3.3v, ground, data to card, data from card, card select and data clock.  The "SPI" interface is OPTIONAL for SD Card manufacturers.  All the SanDisk, Patriot and Kensington cards (full size and microSD with adapter) I've used support SPI.  Very few DON'T support it, but yours may be one of the few.

Good luck!
Dale

TJ Johnson

unread,
Jul 6, 2013, 4:21:36 PM7/6/13
to make...@googlegroups.com
Cal, 
I tried test.gcode, test.g, plate.gcode, and p.g with no difference in result. I can still print the file from the SD card using pointer face, but when selecting using Viki I get nothing. Also an interesting note, I get a beep every time I click a menu using the Viki, yet when I push the center button in the SD Card menu to select a file I get nothing. Its like the select is not going through. 

Dale, 
Thank you for the advice, I may be wrong here but I am feeling since it can read the file using pointerface to select the Sd print the problem is in the Viki LCD selecting the file and not the ability of marlin to read it. Is this a mistaken assumption? 

Thank you for your help, 
TJ


--
You received this message because you are subscribed to a topic in the Google Groups "MakerGear - Make Today, Change Tomorrow" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/makergear/G23y21KWTmI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to makergear+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dale Reed

unread,
Jul 6, 2013, 9:18:46 PM7/6/13
to make...@googlegroups.com
TJ,

Right.  If you can print from SD using Pronterface, then the firmware can get the list of files, can open a file and read it for printing, etc., etc.  It is recognizing the format of the card, and the G-code file is valid.  Likewise, if you can bring up the list of SD card files on the Viki, then the SD card is almost certainly not the problem.

Move on to the Viki interface.  List out what works.  (Scrolling through the list of files on the card via the Viki display works, if I interpret your post correctly... so it can open folders and list filenames.)  Look for common things vs. things unique to the Viki print-from-SDCard function.  Check the middle button in other functions.  If it works properly, it's not the wiring of the button or the initialization of the MCU pin its wired to (pull-up/pull-down/open, input/output, etc.).  If the middle button doesn't work right in ANY function, check that wiring and firmware code associated with that button.

Put on your Sheldon hat and you'll find it!!!  (And hit up the Viki project and Marlin project forums for help if needed, too!)

Dale

Cal Braun

unread,
Jul 6, 2013, 9:40:00 PM7/6/13
to make...@googlegroups.com

TJ,

I can tell you how to get it working, format the sd-card on your computer (after backing up your files on it), I used "FAT (Default)" and just a "Quick Format". Then copy your gcode file to the sd card and that should be the only thing on it (mine was called latch.gcode). Then put SD card in the printer and try again.  You should get a beep as soon as you select the file, then the printer will warm up, then start printing. 

So what this means to me:

Since i had tried to select the exact same file on the sd card (latch.gcode) before formatting the SD card, and got no beep, that means something else on the SD card was causing the problem even though the filename was fine (not even having an under 3 character extension).  The differences I can think of are:

1. If the SD card has *any* filenames the firmware doesn't like, it causes an issue.
2. If the SD card has *any* subdirectories the firmware doesn't like (either it doesn't like them period, or the names can't be too long), it causes an issue.
3. As TJ said, it may need to be formatted correctly, Though I would suspect it won't even be able to list the files if that were the case.

whoDat

Cal Braun

unread,
Jul 6, 2013, 9:55:10 PM7/6/13
to make...@googlegroups.com
I put the M2Demos folder back on the SDCard and also added a file called ThisIsAReallyLongFIleName_Test.gcode, and it still let me select the latch.gcode. So not sure. It is known issue to be finicky from others I have talked too in #reprap, including issues with long filenames, and trying to select files in subdirectories (it will not let me use any of the files in the M2Demos folder for instance).

Oh and I meant Dale for #3 not TJ ;-) 

At any rate, perhaps this will be fixed in a newer version of marlin, but in the meantime I would say just format the SD card, and. stick to 8.3 filesnames, and don't use subdirectories and things should work fine.

whoDat

TJ

unread,
Jul 7, 2013, 12:55:31 PM7/7/13
to make...@googlegroups.com
Cal,

Thank you for the help so far. I think you are correct but I have not been able to fix my problem yet. All of my slicing software is on my mac. When I load a file set in pointer face some hidden mac system folders show up. In viki they do not. I am going to try and get out the old xp machine and confirm tonight. 
79beezer are you using a mac? 

The viki may just not be mac compatible. Haha. 

T.J. 
--

Brendan O'Reilly

unread,
Jul 8, 2013, 5:44:59 AM7/8/13
to make...@googlegroups.com
Hi folks,

Same issue here with a kit and LCD received last week.  I copied all of the files off the supplied 2Gb SD card, formatted it with FAT and then copied them all back on (m2demos plus a few custom files in the root folder).

I can now print files from the root folder (couldn't before format) but I can't print anything from the M2Demos folder.  In fact I cant even navigate back up to the root folder (using ..) and need to reset the printer to get back there.  It's like the first selection (either file or folder) works but that's it.

One last symptom, if I start a file printing and then cancel it, any further (root) file selections display the work TEST on the bottom line of the display and don't start printing the second file.

Despite the Formatting seeming to improve things, I think there is some sort of underlying firmware issue too.

79be...@googlemail.com

unread,
Jul 8, 2013, 6:23:04 AM7/8/13
to make...@googlegroups.com
I'm running windows. I tried formatting the sd card as Cal suggested and made no difference. 
I then tried transferring the files onto the sd card separately (not in the M2 Demos folder) and they worked perfectly so it seems as Cal says the problem is in trying to select files in sub directories.

Thanks for all the help

Karl Williams

unread,
Jul 9, 2013, 12:54:54 PM7/9/13
to make...@googlegroups.com
I finally got my Viki LCD setup last night with the new firmware. I had to solder a 4 pin header into the I2C port. I'm having the same problem with selecting a file from the SD card using the LCD panel. I formatted the card as FAT 32 and copied a small file onto it with a short filename and was able to print that. When I copied a bunch of files to the SD card I couldn't select anymore. I didn't have time to do much more than that but will look at it tonight and experiment with filenames. Here's a picture of my setup:


Sal Campana

unread,
Jul 24, 2013, 2:16:15 PM7/24/13
to make...@googlegroups.com
Any movement on this guys? I was able to print from SD ONCE on the LCD...no problem printing from SD when invoked from Simplify Creator..so the slot works....Using Creator to kickoff the print from SD makes the LCD pointless...

I assume this is an LCD-software issue.....Has anyone gotten anywhere with this issue?

Thanks,

-Sal

Brendan O'Reilly

unread,
Jul 24, 2013, 5:39:00 PM7/24/13
to make...@googlegroups.com
I had a look (my first) into the Marlin firmware regarding this issue a couple of weeks ago but couldn't see any specific code that was causing the problem. 

I did make some interesting observations and planned to have another go sometime:
  • The LCD refreshes it's display frequently (multiple per second?)
  • The above is not a problem for most menus because they are fixed text but the SD menu actually loops through reading the SD card every time the LCD refreshes.
  • The above seems worse for sub folders on the LCD as it seems to take more work for the card reader to access those.  I could also see this by observing the SD activity light on the front of the Viki which was flashing a lot when I'm in a SD sub folder menu.
  • The only way I could see to debug this was to write out to the serial port at key locations in the code but I think this also interfered with the button handling as doing this is certain places stopped other "normal" menu items from being selected.
My suspicion at the moment is that, rather than a specific coding error, the problem is that the refresh cycle for the SD menu is taking too long.  For a start it would be good if it only refreshed when something changed (eg button pressed or rotary thingy moved).  After that there might be a more efficient way to directly action a menu item without having to re-read / re-draw it first.  I think the biggest limitation might be RAM which possibly prevents the SD contents being loaded once and cached for the LCD to use.

Sorry none of this as an answer - but it may be of interest.

Cheers,
Brendan.

Kyle Smith

unread,
Jul 26, 2013, 10:12:10 PM7/26/13
to make...@googlegroups.com
Thanks Cal, that worked! Quick formatted FAT and now I can select files from the LCD Menu. This combined with changing the power jumper on the Rambo to PS (JP1) and now I don't have to bring my laptop out to the garage anymore.

My old Ultimaker had no problems with subdirectories, but it truncated everything to 8.3. Not sure what version of Marlin that was, older than RC2 at least. Will have to dig through Github and see if any other SD boards are having this problems.

Kyle

Kyle Smith

unread,
Jul 26, 2013, 10:42:45 PM7/26/13
to make...@googlegroups.com
Just found this issue #266 which may be related. a search for "oldpercent" through both the Viki Marlin build directory and the Marlin_v1 directory returned 0 hits...

https://github.com/ErikZalm/Marlin/issues/266

Kyle Smith

unread,
Jul 26, 2013, 10:56:07 PM7/26/13
to make...@googlegroups.com
Also, SDHC cards (>2GB) are reportedly twonky with the FAT library. Both my cards are 4GB SDHC. Will report results with a 2GB MicroSD card.

https://github.com/ErikZalm/Marlin/issues/116

Sal Campana

unread,
Jul 27, 2013, 8:32:06 AM7/27/13
to make...@googlegroups.com
I ran a bunch of tests yesterday with a 2gb and a 16gb card....

My observations of the usage of the LCD SD slot:

1. SD card must be in slot before powering on. It only reads the card at startup it seems, and doesn't access/pull the directoy info if inserted after the LCD is already running.
2. Fat32 works fine
3. SD slot doesn't notice when card is removed after initial reading, and even seems to have loaded (at least one) file into memory. I was able to start a print with a card removed.
4. File names longer than 8 chars will not be selectable
5. File names with NUMBERS WILL NOT be selectable. this is where I was stumbling I think!
6. Use the .g extension for file names
7. If you start a print from SD, stop it using menu item, then try to start another..you get "Test" at the bottom of the screen and it doesn't seem to do anything.
8. Directories are not seen on the LCD
9. Using Creator to connect to M2 can access the files and start prints as usual, which shows the sd slot is fine these are nuances of the firmware/software for accessing the sd from the LCD only.

Hopefully this helps others out and are consistent observations with what others can/cannot do!

Brendan O'Reilly

unread,
Jul 29, 2013, 2:22:07 AM7/29/13
to make...@googlegroups.com
Yipee I think I've cracked it!  Basically the SD menu was taking too long to render so the button interrupt was coming along and clearing out LCD_CLICKED before the menu got to it.  My solution was to take note of LCD_CLICKED first and use it later. 

My changes to ultralcd.cpp are highlighted in red below:

/* Helper macros for menus */
#define START_MENU() do { \
    if (encoderPosition > 0x8000) encoderPosition = 0; \
    if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\
    uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
    bool wasClicked = LCD_CLICKED;\
    for(uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
        _menuItemNr = 0;
#define MENU_ITEM(type, label, args...) do { \
    if (_menuItemNr == _lineNr) { \
        if (lcdDrawUpdate) { \
            const char* _label_pstr = PSTR(label); \
            if ((encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \
                lcd_implementation_drawmenu_ ## type ## _selected (_drawLineNr, _label_pstr , ## args ); \
            }else{\
                lcd_implementation_drawmenu_ ## type (_drawLineNr, _label_pstr , ## args ); \
            }\
        }\
        if (wasClicked && (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) {\
            lcd_quick_feedback(); \
            menu_action_ ## type ( args ); \
            return;\
        }\
    }\
    _menuItemNr++;\
} while(0)


Although not necessary, I also added the following to bail out of rendering the menu all together if there was nothing to do...

void lcd_sdcard_menu()
{
    if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) 
        return; // nothing to do (so don't thrash the SD card)

    uint16_t fileCnt = card.getnrfilenames();
...

If someone can confirm these changes work for them also, then I'll write this up on Github and hopefully they'll make it into the Marlin firmware.

Cheers,
Brendan

Brendan O'Reilly

unread,
Jul 29, 2013, 6:15:14 AM7/29/13
to make...@googlegroups.com
Okay, so I got carried away and submitted a pull request for Marlin on GitHub with this fix.

Karl Williams

unread,
Jul 29, 2013, 1:25:12 PM7/29/13
to make...@googlegroups.com
Thanks Brendan! I'll add your changes and give it a try tonight after work.

Joshua Wills

unread,
Jul 29, 2013, 1:46:03 PM7/29/13
to make...@googlegroups.com
Brendan, tested on a fresh unit here, your changes seem to fix it
completely - standard SD card that we ship, not specially formatted,
with files in the M2Demos subdirectory, load fine. I'm going to keep
testing it, but I don't see any immediate issues, so I'll probably be
putting a new version up on the wiki shortly - email me how you'd like
your name credited.

This is exactly why I love our community and customers - the hivemind
we form is far more formidable than any single one of us. Thank you
for the huge contribution X)

--
Josh
MakerGear

Cal Braun

unread,
Jul 29, 2013, 2:53:23 PM7/29/13
to make...@googlegroups.com
Great job Brenden! I shall update with this changes as well...

whoDat

Brendan O'Reilly

unread,
Jul 29, 2013, 3:39:49 PM7/29/13
to make...@googlegroups.com
Hi folks,

It looks like this change has just been pulled into the main Marlin firmware on Github too.  I'm glad it seems to be working for everyone :)

Cheers,
Brendan.

TJ Johnson

unread,
Jul 29, 2013, 4:09:20 PM7/29/13
to make...@googlegroups.com
Hi All, 
Brendan nice work, but for me I still had to restart every time to get it to read an SD card, it would never initialize an SD card if it was started without one, the refresh option would never show up. So I started chasing down that function and it appears it is taking a define from the Old Utilipanel and assigning a pin to SDCARDDETECT. I don't seem to have a working SDCard Detect pin. 
This will let you initialize a SD card if you started it without one, and refresh or change a card without restarting it. 
In pins.h

#if MOTHERBOARD == 301
#define KNOWN_BOARD
/*****************************************************************
* Rambo Pin Assignments
******************************************************************/

#ifndef __AVR_ATmega2560__
#error Oops!  Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu.
#endif

#define LARGE_FLASH true

#define X_STEP_PIN 37
#define X_DIR_PIN 48
#define X_MIN_PIN 12
#define X_MAX_PIN 24
#define X_ENABLE_PIN 29
#define X_MS1_PIN 40
#define X_MS2_PIN 41

#define Y_STEP_PIN 36
#define Y_DIR_PIN 49
#define Y_MIN_PIN 11
#define Y_MAX_PIN 23
#define Y_ENABLE_PIN 28
#define Y_MS1_PIN 69
#define Y_MS2_PIN 39

#define Z_STEP_PIN 35
#define Z_DIR_PIN 47
#define Z_MIN_PIN 10
#define Z_MAX_PIN 30
#define Z_ENABLE_PIN 27
#define Z_MS1_PIN 68
#define Z_MS2_PIN 67

#define HEATER_BED_PIN 3
#define TEMP_BED_PIN 2

#define HEATER_0_PIN  9
#define TEMP_0_PIN 0

#define HEATER_1_PIN 7
#define TEMP_1_PIN 1

#ifdef BARICUDA
#define HEATER_2_PIN 6
#else
#define HEATER_2_PIN -1
#endif
#define TEMP_2_PIN -1

#define E0_STEP_PIN         34
#define E0_DIR_PIN          43
#define E0_ENABLE_PIN       26
#define E0_MS1_PIN 65
#define E0_MS2_PIN 66

#define E1_STEP_PIN         33
#define E1_DIR_PIN          42
#define E1_ENABLE_PIN       25
#define E1_MS1_PIN 63
#define E1_MS2_PIN 64

#define DIGIPOTSS_PIN 38
#define DIGIPOT_CHANNELS {4,5,3,0,1} // X Y Z E0 E1 digipot channels to stepper driver mapping

#define SDPOWER            -1
#define SDSS               53
#define LED_PIN            13
#define FAN_PIN            8
#define PS_ON_PIN          4
#define KILL_PIN           -1
#define SUICIDE_PIN        -1  //PIN that has to be turned on right after start, to keep power flowing.


#ifdef ULTIPANEL 
 #ifdef NEWPANEL

//arduino pin which triggers an piezzo beeper
 #define BEEPER 79 // Beeper on AUX-4
 #define LCD_PINS_RS 70 
 #define LCD_PINS_ENABLE 71
 #define LCD_PINS_D4 72
 #define LCD_PINS_D5 73 
 #define LCD_PINS_D6 74
 #define LCD_PINS_D7 75
 //buttons are directly attached using AUX-2
 #define BTN_EN1 76
 #define BTN_EN2 77
 #define BTN_ENC 81 //the click
 #define BLEN_C 2
 #define BLEN_B 1
 #define BLEN_A 0  
 #define SDCARDDETECT -1 //if you are using the VIKI Lcd sets the SDCardDetect to unused, otherwise use 82 

 //encoder rotation values
 #define encrot0 0
 #define encrot1 2
 #define encrot2 3
 #define encrot3 1

 #endif
#endif

#endif


Brendan O'Reilly

unread,
Jul 29, 2013, 4:26:57 PM7/29/13
to make...@googlegroups.com
@TJ:  The SD card detect works fine on my Viki LCD.  Perhaps the issue does not apply to all of them.

Karl Williams

unread,
Jul 29, 2013, 4:41:11 PM7/29/13
to make...@googlegroups.com
The card detect works fine on mine too.


On Mon, Jul 29, 2013 at 4:26 PM, Brendan O'Reilly <brenda...@gmail.com> wrote:
@TJ:  The SD card detect works fine on my Viki LCD.  Perhaps the issue does not apply to all of them.

--

TJ

unread,
Jul 29, 2013, 4:59:29 PM7/29/13
to make...@googlegroups.com
Well then it looks like its just my problem. Sorry ignore my previous post. 

T.J. 

Sal Campana

unread,
Jul 30, 2013, 9:07:02 AM7/30/13
to make...@googlegroups.com
I have the issue that the SD card is not detected unless it is inserted at paower-on.

Additionally if I change the sd card after the printer is powered on, it does not re-read the card.  I need to power cycle the printer to make it re-read the card.

Brendan O'Reilly

unread,
Jul 30, 2013, 5:22:33 PM7/30/13
to make...@googlegroups.com
I see that the SD Card detect feature has it's own wire connecting the LCD to the RAMBO.  Perhaps it is a wiring issue with some machines (rather than a full-on hardware issue)?  

From reading the wiki and this post (Q*bert) it looks like the yellow wire plugged in to EXT15 if for card detect if that helps.

Brendan O'Reilly

unread,
Aug 1, 2013, 7:18:32 PM8/1/13
to make...@googlegroups.com
Okay, so this fix (for the LCD SD card menu) was working for me ...until I started adding more files to the SD card.  Suddenly my button stopped working again!  

The previous version was still counting the files on the SD card before capturing the button click.  This time I've taken the previous solution a little further and now capture the button click at the start of the LCD refresh cycle.

See below for details of the changes or view on GitHub.

est1983gmail

unread,
Aug 13, 2013, 12:21:48 PM8/13/13
to make...@googlegroups.com
I'm really struggling here... as far as I can tell I've followed all the advice.

I've installed the latest firmware (did it just a couple of days ago), I formatted my card to FAT32, I have changed the name and extension to GPS.G and when I insert the SD card and navigate to the file if I click on it the green SD card light faintly flashes very quickly and then after a few seconds it just goes back to the info page and nothing happens.

To top it off I can't communicate with my Macbook anymore because it can't do the 25k baud rate thing.

So I'm a bit stuck....

Kyle Smith

unread,
Aug 13, 2013, 4:55:07 PM8/13/13
to make...@googlegroups.com
I was in the same spot last week. I don't think Brendan's most recent code changes made it into the version on the wiki- I had to manually edit the ultralcd.cpp file and rebuild marlin. Now it works correctly. see attached for my hex file. You can load it with Cura.  See below for the code changes.

Kyle


     Okay, so this fix (for the LCD SD card menu) was working for me ...until I started adding more files to the SD card.  Suddenly my button stopped working again!  

     The previous version was still counting the files on the SD card before capturing the button click.  This time I've taken the previous solution a little further and now capture the button click at the start of the   LCD refresh cycle.

     See below for details of the changes or view on GitHub.



Marlin.Viki_02.hex.zip

est1983gmail

unread,
Aug 13, 2013, 8:09:34 PM8/13/13
to make...@googlegroups.com
Thanks, Joshua sent me an updated firmware to try (also with a lower baud rate) and now I'm happily printing away using the LCD - nice to be freed of my PC!

The one thing I've noticed is that the motors make a bit of a racket on the inital rapid moves since installing the new firmware, but once printing it's fine. Any idea why that might be? Much louder during those first rapid moves than normal (the home and then wipe move from creator)

Kyle Smith

unread,
Aug 14, 2013, 10:48:42 AM8/14/13
to make...@googlegroups.com
Possibly the acceleration values are different, or the max speed settings. The initial moves are defined in your start.gcode, so you can change the speed for G1 commands with F- e.g. G1 F10800

See kefir's page for an example start.gcode file.

Kyle
https://github.com/kefir-/M2-config/blob/master/start.gcode
Reply all
Reply to author
Forward
0 new messages