terjeio / grblHAL

This repo has moved to a new home https://github.com/grblHAL
232 stars 90 forks source link

teensy 4.1 sd card commands #299

Closed karoria closed 3 years ago

karoria commented 3 years ago

Hi @terjeio @phil-barrett I am new here. Thanks for this wonderful project to opensource community. I have got teensy 4.1 and got it flashed with grblHAL successfully with default pin map (as per phil's ethernet breakout board). I can connect it with cncjs with compatibility mode and can jog it successfully. I have also "dry run" some gcode programs and those seem to work well. I have formatted an sd card of 32 gb class 10 to fat32 and inserted to sd slot and tried to execute commands $FM, $F etc. but they all failed with error:2 (Bad number format) Am I missing something while flashing? Best regards, Ravi (India)

terjeio commented 3 years ago

Have you enabled SD card support in my_machine.h by removing the comment from #define SDCARD_ENABLE?

$i+ should list the SD-card plugin if active.

karoria commented 3 years ago

Thanks @terjeio. That worked! Further, I have 2 questions as under:

  1. Is there any memory limitations for programs run from sd card? I am asking this because some senders hangs when opening files larger than 10-20MB.
  2. How to copy files to sd card without removing it? I mean is there some short of wireless or ethernet way.
terjeio commented 3 years ago
  1. 2 or 4GB? Max filesize is limited by the FatFS filesystem implementation.
  2. The latest version of the firmware and ioSender has upload implemented via the YModem protocol. Note that this is not possible to start a transfer outside of the sender as the initial start character to be sent from the receiver (controller) is not possible to implement unless an input pin is added for it.
karoria commented 3 years ago

Thanks for prompt reply. Your answer means a 50MB file should work. If I use ethernet breakout board by phil, can it be possible to host sd as ftp server?

terjeio commented 3 years ago

If I use ethernet breakout board by phil, can it be possible to host sd as ftp server?

It should be possible and if so it has to be implemented as part of the networking plugin. There are a number of ftp server implementations on top of lwIP that could be used more or less as-is or as a starting point. This is one I found from a quick search. IIRC the lwIP source has an implementation as well. I have no idea of how much work it will be though...

karoria commented 3 years ago

Thanks a lot.

terjeio commented 3 years ago

FTP server functionality has been added to the networking plugin but sadly the SD card library used for the Teensy is buggy so FTP cannot yet be used with this driver. I have a workaround for the library but I'll wait a bit to see if the owner of the library will fix it before I decide what to do. I can post the patched files here if you want to test it.

karoria commented 3 years ago

Hi @terjeio. Thanks for your efforts! I would love to give it a try if you have already done your part or I can wait for library owner to do the needful. I have to still make my pcb, so it will take time for me to connect it with ethernet for testing. But, I am sure if FTP will work like a charm, it will be a huge achievement and will be beneficial to mass.

terjeio commented 3 years ago

The SD card library has been fixed and I have committed an update with the latest changes for ftp (and some other stuff).

Note that the FatFs configuration in the library has to be changed, set

#define FF_FS_RPATH 2

in ffconf.h or you wil get a compiler error.

File transfer when running gcode from the SD card is not allowed.

karoria commented 3 years ago

Thanks a lot.