-20170429 6.1.1
- - Add new "turbo" speed mode to get faster async transfers.
+201705XX 6.1.1
+ - Add new "turbo" speed option to boost speeds.
+ - May not be reliable, and use is not supported.
+ - Async timings trimmed
+ - Sync speeds boosted to theoretical 15.625MB/s, with 12.0MB/s measured
+ read througput.
+ - SD card put in "high speed" mode.
+ - USB for configuration/firmware updates is disabled in turbo mode when
+ processing SCSI commands. A power cycle may be required to connect
+ via USB to reset the 48MHz clock back to 48MHz.
- Fix scsi2sd-util6 size and sector-size inputs
- Fix crash when configured scsi disk starting sector is less than
SD card size
hsram1.Init.WriteBurst = FSMC_WRITE_BURST_DISABLE;
/* Timing */
- // 1 clock to read the address, + 3 for the synchroniser
- Timing.AddressSetupTime = 4;
+ // 1 clock to read the address, + 1 for synchroniser skew
+ Timing.AddressSetupTime = 2;
Timing.AddressHoldTime = 1;
- // 3 for synchroniser, 1 to skip hold time, 1 to process read, 1 to output
- Timing.DataSetupTime = 6;
+ // 1 for synchroniser skew, 1 to skip hold time, 1 to process read, 1 to output
+ Timing.DataSetupTime = 5;//4 doesn't work ? ?? ?
// Allow a clock for us to release signals, plus 3 for the synchroniser to
// realise the cycle has ended. Need to avoid both devices acting as outputs
PE0 ------> FSMC_NBL0
PE1 ------> FSMC_NBL1
*/
+ // MM: GPIO_SPEED_FREQ_MEDIUM is rated up to 50MHz, which is fine as all the
+ // fsmc timings are > 1 (ie. so clock speed / 2 is around 50MHz).
+
/* GPIO_InitStruct */
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM; //HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM; //HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;//HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
sdDev.capacity >> 24,\r
sdDev.capacity >> 16,\r
sdDev.capacity >> 8,\r
- sdDev.capacity\r
+ sdDev.capacity,\r
+ 1 // useSdConfig, always true for V6.\r
};\r
hidPacket_send(response, sizeof(response));\r
}\r
// run if the SD card is present at startup.\r
// Don't use VBUS monitoring because that just tells us about\r
// power, which could be from a charger\r
-#if 0\r
if ((blockDev.state & DISK_PRESENT) &&\r
isUsbStarted &&\r
(scsiDev.cmdCount > 0) && // no need for speed without scsi\r
- !USBD_Composite_IsConfigured(&hUsbDeviceFS))\r
+ !USBD_Composite_IsConfigured(&hUsbDeviceFS) &&\r
+ (scsiDev.boardCfg.scsiSpeed == S2S_CFG_SPEED_TURBO))\r
{\r
if (HAL_SD_HighSpeed(&hsd) == SD_OK)\r
{\r
isUsbStarted = 0;\r
}\r
}\r
-#endif\r
\r
else if (!(blockDev.state & DISK_PRESENT) && !isUsbStarted)\r
{\r
// FAST20 / 50ns / 20MHz is disabled for now due to\r
// data corruption while reading data. We can count the\r
// ACK's correctly, but can't save the data to a register\r
- // before it changes.\r
- // TODO work out the fastest sync period that will work\r
- /*\r
- if (transferPeriod <= 12)\r
+ // before it changes. (ie. transferPeriod == 12)\r
+ if ((scsiDev.boardCfg.scsiSpeed == S2S_CFG_SPEED_TURBO) &&\r
+ (transferPeriod <= 16))\r
{\r
- scsiDev.target->syncPeriod = 12; // 50ns, 20MB/s\r
+ scsiDev.target->syncPeriod = 16; // 15.6MB/s\r
}\r
- else */if (transferPeriod <= 25 &&\r
+ else if (scsiDev.boardCfg.scsiSpeed == S2S_CFG_SPEED_TURBO)\r
+ {\r
+ scsiDev.target->syncPeriod = transferPeriod;\r
+ }\r
+ else if (transferPeriod <= 25 &&\r
((scsiDev.boardCfg.scsiSpeed == S2S_CFG_SPEED_NoLimit) ||\r
(scsiDev.boardCfg.scsiSpeed >= S2S_CFG_SPEED_SYNC_10)))\r
{\r
#define SCSI_FAST10_HOLD 3 // 33ns\r
#define SCSI_FAST10_ASSERT 3 // 30ns\r
\r
+// Fastest possible timing, probably not 20MB/s\r
+#define SCSI_FAST20_DESKEW 1\r
+#define SCSI_FAST20_HOLD 2\r
+#define SCSI_FAST20_ASSERT 2\r
+\r
+\r
#define syncDeskew(period) ((period) < 45 ? \\r
SCSI_FAST10_DESKEW : SCSI_FAST5_DESKEW)\r
\r
if ((newPhase == DATA_IN || newPhase == DATA_OUT) &&\r
scsiDev.target->syncOffset)\r
{\r
- \r
- if (scsiDev.target->syncPeriod <= 25)\r
+ if (scsiDev.target->syncPeriod < 23)\r
+ {\r
+ scsiSetTiming(SCSI_FAST20_ASSERT, SCSI_FAST20_DESKEW, SCSI_FAST20_HOLD, 1);\r
+ }\r
+ else if (scsiDev.target->syncPeriod <= 25)\r
{\r
scsiSetTiming(SCSI_FAST10_ASSERT, SCSI_FAST10_DESKEW, SCSI_FAST10_HOLD, 1);\r
}\r
} else if (scsiDev.boardCfg.scsiSpeed >= S2S_CFG_SPEED_ASYNC_33) {\r
\r
asyncTiming = asyncTimings[SCSI_ASYNC_33];\r
- \r
+\r
} else {\r
asyncTiming = asyncTimings[SCSI_ASYNC_15];\r
}\r