bdring / Grbl_Esp32

A port of Grbl CNC Firmware for ESP32
GNU General Public License v3.0
1.69k stars 530 forks source link

Defining SD pins #161

Closed just-jason closed 5 years ago

just-jason commented 5 years ago

Is there a possibility to add pin definitions for the the SD card ? I have found an ESP32 board in UNO format, and it is a straight plug and play fit on a CNC shield. What I am not able to see is how I can define the SD pins to fit my application.

luc-github commented 5 years ago

it use default values present in variants/pins_arduino.h

static const uint8_t SS    = 5;
static const uint8_t MOSI  = 23;
static const uint8_t MISO  = 19;
static const uint8_t SCK   = 18;

I think only CS/SS should be a parameter not SPI ones, may be SD speed would be also a good addition if default frequency is not optimal

bdring commented 5 years ago

@just-jason You don't give us any details on the pins you need to use or the hardware you are talking about.

The ESP32 has several hardware SPI buses. We use the one that Arduino HAL uses. That simplified things for us and makes the code potentially more portable.

The SD features could be refactored to allow the others, but it is not a priority at this time.

just-jason commented 5 years ago

@luc-github Thanks, that should be just the thing I need

@bdring , You are right, I have not given you much info to work with, mainly because I am still at the very beginning of an idea, and it is still a bit vague. This is what I can tell you so far. I would like to use a WEMOS D1 R32 board ( an ESP32 in UNO format ) together with a Protoneer CNC shield which will give me a good plug and play match. I would like to use it together with two stepper drivers to run a x / y plotter, and I would like to adapt the pins to my needs. You have done a great job in the config.h of defining the pins for all the other pins that I need, but I would like to look at moving the SD pins too. I will use Luc's suggestion and give it a try