From: Michael McMaster Date: Wed, 19 May 2021 05:55:14 +0000 (+1000) Subject: Disable the FMC fifo until we have code that can detect when it's empty. X-Git-Tag: v6.4.7 X-Git-Url: http://git.codesrc.com/gitweb.cgi?a=commitdiff_plain;h=a7ddc5da111d5ce22817765355b49f165d3f0d44;p=SCSI2SD-V6.git Disable the FMC fifo until we have code that can detect when it's empty. --- diff --git a/STM32CubeMX/2021/Src/fmc.c b/STM32CubeMX/2021/Src/fmc.c index 56e0f7c3..cc23ebee 100644 --- a/STM32CubeMX/2021/Src/fmc.c +++ b/STM32CubeMX/2021/Src/fmc.c @@ -49,7 +49,9 @@ void MX_FMC_Init(void) hsram1.Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_DISABLE; hsram1.Init.WriteBurst = FMC_WRITE_BURST_DISABLE; hsram1.Init.ContinuousClock = FMC_CONTINUOUS_CLOCK_SYNC_ONLY; - hsram1.Init.WriteFifo = FMC_WRITE_FIFO_ENABLE; + hsram1.Init.WriteFifo = FMC_WRITE_FIFO_DISABLE; + // WE MAY start writing another 512 bytes before this FIFO is empty! + hsram1.Init.PageSize = FMC_PAGE_SIZE_NONE; /* Timing */ diff --git a/src/firmware/bsp_driver_sd.c b/src/firmware/bsp_driver_sd.c index e69c7183..2ac26625 100755 --- a/src/firmware/bsp_driver_sd.c +++ b/src/firmware/bsp_driver_sd.c @@ -55,7 +55,7 @@ uint8_t BSP_SD_Init(void) } SD_state = HAL_SD_Init(&hsd); #ifdef BUS_4BITS - if (SD_state == MSD_OK) + if (SD_state == HAL_OK) { if (HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B) != HAL_OK) { diff --git a/src/firmware/config.c b/src/firmware/config.c index 109b856f..81de8b61 100755 --- a/src/firmware/config.c +++ b/src/firmware/config.c @@ -36,11 +36,13 @@ #include -static const uint16_t FIRMWARE_VERSION = 0x0646; +static const uint16_t FIRMWARE_VERSION = 0x0647; // Optional static config extern uint8_t* __fixed_config; +extern SD_HandleTypeDef hsd; + #ifdef S2S_USB_HS #define configUsbDev hUsbDeviceHS #else @@ -235,7 +237,7 @@ debugCommand() response[23] = scsiDev.msgCount; response[24] = scsiDev.cmdCount; response[25] = scsiDev.watchdogTick; - response[26] = blockDev.state; + response[26] = (hsd.State << 4) | blockDev.state; response[27] = scsiDev.lastSenseASC >> 8; response[28] = scsiDev.lastSenseASC; response[29] = *SCSI_STS_DBX & 0xff; // What we've read diff --git a/src/firmware/scsiPhy.c b/src/firmware/scsiPhy.c index 684887dc..a883dd5a 100755 --- a/src/firmware/scsiPhy.c +++ b/src/firmware/scsiPhy.c @@ -104,17 +104,15 @@ scsiSetDataCount(uint32_t count) int scsiFifoReady(void) { __NOP(); -#ifdef STM32F4xx - __NOP(); -#endif - HAL_GPIO_ReadPin(GPIOE, FPGA_GPIO3_Pin); + uint8_t test1 = HAL_GPIO_ReadPin(GPIOE, FPGA_GPIO3_Pin); __NOP(); #ifdef STM32F4xx __NOP(); __NOP(); __NOP(); #endif - return HAL_GPIO_ReadPin(GPIOE, FPGA_GPIO3_Pin) != 0; + uint8_t test2 = HAL_GPIO_ReadPin(GPIOE, FPGA_GPIO3_Pin); + return test1 != 0 && test2 != 0; } uint8_t