grblHAL / STM32F4xx

grblHAL driver for ST STM32F4xx (Nucleo-64, Blackpill)
Other
93 stars 85 forks source link

BTT_SKR_Pro v1.2 onboard sd_card #139

Open Melkiyby opened 1 year ago

Melkiyby commented 1 year ago

Hello. I'm trying to set up sd card support. I figured out the problems during compilation, but still an error 60 mounting the SD card. I commented the exp2 part and uncommented it from the onboard

`//#if SDCARD_ENABLE
// Connect to the  EXP2 Header
//#define SD_CS_PORT                  GPIOB
//#define SD_CS_PIN                   12
//#define SPI_PORT                    2 // GPIOB, SCK_PIN = 13, MISO_PIN = 14, MOSI_PIN = 15
//#endif

//*
#if SDCARD_ENABLE
// On board socket- flaky?
#define SD_CS_PORT                  GPIOA
#define SD_CS_PIN                   4
#define SPI_PORT                    11 // (MCU port 1) GPIOA: SCK_PIN = 5, MISO_PIN = 5, GBIOB: MOSI_PIN = 5
// PB11 - TF_SW - card detect
#endif
//*/`

Part of my platformio.ini

# uncomment `FatFS` and `sdcard` below.
  FatFs
  sdcard
  spindle
  # USB serial support
  Core
  Class
  App
  Target
lib_extra_dirs =
  .
  FatFs
  Middlewares/ST/STM32_USB_Device_Library
  USB_DEVICE

[env]
platform = ststm32
platform_packages = framework-stm32cubef4 @ ~1.26.2
framework = stm32cube
# Do not produce .a files for lib deps (which would prevent them from overriding weak symbols)
lib_archive = no
lib_ldf_mode = off

[env:btt_skr_pro_1_1]
# Untested and might not boot.  Please report issues at:
# https://github.com/grblHAL/STM32F4xx/issues
board = genericSTM32F407VGT6
board_build.ldscript = STM32F407VGTX_BL32K_FLASH.ld
build_flags = ${common.build_flags}
  # See Inc/my_machine.h for options
  -D BOARD_BTT_SKR_PRO_1_1=
  # 8MHz crystal
  -D HSE_VALUE=8000000
  -D HAS_BOOTLOADER
  -D TRINAMIC_ENABLE=2209
  -D USB_SERIAL_CDC=0
  -D POLAR_ROBOT
  -D SDCARD_ENABLE=1
  -D _VOLUMES=1
lib_deps = ${common.lib_deps}
  eeprom
  trinamic
lib_extra_dirs = ${common.lib_extra_dirs}
asulonn commented 1 year ago

I had the same issue, with the same board (SKR PRO V1.1). Unfortunately at the time i misplaced my issue under the core repo instead of here. I did some testing, but at some point i got busy doing other stuff and i did not have the time to further investigate. Meaby this info can help you and/or you can finish where i stopped:

https://github.com/grblHAL/core/issues/244

My plan was to one day pick this back up and go further with testing...

terjeio commented 1 year ago

There is a typo in spi.c... 5 should be GPIO_PIN_5.