diff options
author | David Crocker <dcrocker@eschertech.com> | 2022-04-27 21:16:03 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-04-27 21:16:03 +0300 |
commit | e4794741e9afa7ad26b91f6e3dc96ef5dab6db72 (patch) | |
tree | 81beb57473167faf49bd0c4a8832fb4d9f6af359 | |
parent | 0a1b2ee0cfc7c344a9fa5f27be45fd30b7b9d54b (diff) |
FMDC board: made corrections + temporarily disabled SDHC
-rw-r--r-- | src/Config/Pins_FMDC.h | 20 | ||||
-rw-r--r-- | src/Hardware/SAME5x/Devices.cpp | 6 | ||||
-rw-r--r-- | src/Libraries/sd_mmc/conf_sd_mmc.h | 4 |
3 files changed, 24 insertions, 6 deletions
diff --git a/src/Config/Pins_FMDC.h b/src/Config/Pins_FMDC.h index e38a7a28..f496338e 100644 --- a/src/Config/Pins_FMDC.h +++ b/src/Config/Pins_FMDC.h @@ -29,7 +29,7 @@ constexpr uint32_t IAP_IMAGE_START = 0x20028000; #define HAS_SBC_INTERFACE 0 #define HAS_MASS_STORAGE 1 -#define HAS_HIGH_SPEED_SD 1 +#define HAS_HIGH_SPEED_SD 0//1 //#define HAS_CPU_TEMP_SENSOR 0 // according to the SAME5x errata doc, the temperature sensors don't work in revision A or D chips (revision D is latest as at 2020-06-28) #define HAS_CPU_TEMP_SENSOR 1 // enable this as an experiment - it may be better than nothing @@ -189,16 +189,24 @@ constexpr bool DiagOnPolarity = false; constexpr bool ActOnPolarity = false; // SD cards +#if !HAS_HIGH_SPEED_SD //TEMP!! +constexpr size_t NumSdCards = 1; +constexpr Pin SdCardDetectPins[NumSdCards] = { /*PortBPin(0)*/ NoPin }; + +constexpr Pin SdWriteProtectPins[NumSdCards] = { NoPin }; +constexpr Pin SdSpiCSPins[NumSdCards - HAS_HIGH_SPEED_SD] = { PortCPin(14) }; +#else constexpr size_t NumSdCards = 2; -constexpr Pin SdCardDetectPins[NumSdCards] = { PortBPin(16), PortBPin(0) }; +constexpr Pin SdCardDetectPins[NumSdCards] = { PortBPin(16), /*PortBPin(0)*/ NoPin }; constexpr Pin SdWriteProtectPins[NumSdCards] = { NoPin, NoPin }; -constexpr Pin SdSpiCSPins[NumSdCards - 1] = { PortCPin(14) }; +constexpr Pin SdSpiCSPins[NumSdCards - HAS_HIGH_SPEED_SD] = { PortCPin(14) }; constexpr Pin SdMciPins[] = { PortAPin(20), PortAPin(21), PortBPin(18), PortBPin(19), PortBPin(20), PortBPin(21) }; constexpr GpioPinFunction SdMciPinsFunction = GpioPinFunction::I; -Sdhc * const SdDevice = SDHC0; -constexpr IRQn_Type SdhcIRQn = SDHC0_IRQn; +Sdhc * const SdDevice = SDHC1; +constexpr IRQn_Type SdhcIRQn = SDHC1_IRQn; constexpr uint32_t ExpectedSdCardSpeed = 15000000; +#endif // LCD interface constexpr unsigned int LcdSercomNumber = 0; @@ -348,7 +356,7 @@ constexpr PinDescription PinTable[] = { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PB28 not on chip { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PB29 not on chip { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::sercom5d, SercomIo::none, 14, PinCapability::read, "io3.in" }, // PB30 IO3_IN - { TcOutput::none, TccOutput::tcc0_7G, AdcInput::none, SercomIo::none, SercomIo::sercom5d, Nx, PinCapability::wpwm, "io3.out" }, // PB31 IO3_OUT + { TcOutput::none, TccOutput::tcc4_1F, AdcInput::none, SercomIo::none, SercomIo::sercom5d, Nx, PinCapability::wpwm, "io3.out" }, // PB31 IO3_OUT // Port C { TcOutput::none, TccOutput::none, AdcInput::adc1_10, SercomIo::none, SercomIo::none, Nx, PinCapability::ain, "temp0" }, // PC00 thermistor0 diff --git a/src/Hardware/SAME5x/Devices.cpp b/src/Hardware/SAME5x/Devices.cpp index ff9f2c8c..aeb7f6a1 100644 --- a/src/Hardware/SAME5x/Devices.cpp +++ b/src/Hardware/SAME5x/Devices.cpp @@ -117,6 +117,8 @@ static void UsbInit() noexcept gpio_set_pin_function(PortAPin(25), PINMUX_PA25H_USB_DP); } +#if HAS_HIGH_SPEED_SD + static void SdhcInit() noexcept { // Set up SDHC clock @@ -141,13 +143,17 @@ static void SdhcInit() noexcept } } +#endif + void DeviceInit() noexcept { // Ensure the Ethernet PHY or WiFi module is held reset pinMode(EspResetPin, OUTPUT_LOW); UsbInit(); +#if HAS_HIGH_SPEED_SD SdhcInit(); +#endif AnalogIn::Init(NvicPriorityAdc); AnalogOut::Init(); diff --git a/src/Libraries/sd_mmc/conf_sd_mmc.h b/src/Libraries/sd_mmc/conf_sd_mmc.h index e25c8321..c506b42b 100644 --- a/src/Libraries/sd_mmc/conf_sd_mmc.h +++ b/src/Libraries/sd_mmc/conf_sd_mmc.h @@ -55,8 +55,12 @@ // SD card configuration for Duet and Duet WiFi #define SD_MMC_ENABLE +#ifdef FMDC_V02 +#define SD_MMC_HSMCI_MEM_CNT 0 // TEMP disable SDHC +#else #define SD_MMC_HSMCI_MEM_CNT 1 // Number of HSMCI card slots supported #define SD_MMC_HSMCI_SLOT_0_SIZE 4 // HSMCI bus width +#endif #ifdef PCCB # define SD_MMC_SPI_MEM_CNT 0 // Number of SPI card slots supported |