|  | @@ -1,49 +1,3 @@
 | 
											
												
													
														|  | -diff --git a/STM32CubeMX/2021/Src/fmc.c b/STM32CubeMX/2021/Src/fmc.c
 |  | 
 | 
											
												
													
														|  | -index dae179a..995fd15 100644
 |  | 
 | 
											
												
													
														|  | ---- a/STM32CubeMX/2021/Src/fmc.c
 |  | 
 | 
											
												
													
														|  | -+++ b/STM32CubeMX/2021/Src/fmc.c
 |  | 
 | 
											
												
													
														|  | -@@ -52,12 +52,28 @@ void MX_FMC_Init(void)
 |  | 
 | 
											
												
													
														|  | -   hsram1.Init.WriteFifo = FMC_WRITE_FIFO_ENABLE;
 |  | 
 | 
											
												
													
														|  | -   hsram1.Init.PageSize = FMC_PAGE_SIZE_NONE;
 |  | 
 | 
											
												
													
														|  | -   /* Timing */
 |  | 
 | 
											
												
													
														|  | -+
 |  | 
 | 
											
												
													
														|  | -+  // 1 clock to read the address, + 1 for synchroniser skew
 |  | 
 | 
											
												
													
														|  | -   Timing.AddressSetupTime = 2;
 |  | 
 | 
											
												
													
														|  | -   Timing.AddressHoldTime = 1;
 |  | 
 | 
											
												
													
														|  | -+
 |  | 
 | 
											
												
													
														|  | -+  // Writes to device:
 |  | 
 | 
											
												
													
														|  | -+  //   1 for synchroniser skew (dbx also delayed)
 |  | 
 | 
											
												
													
														|  | -+  //   1 to skip hold time
 |  | 
 | 
											
												
													
														|  | -+  //   1 to write data.
 |  | 
 | 
											
												
													
														|  | -+
 |  | 
 | 
											
												
													
														|  | -+  // Reads from device:
 |  | 
 | 
											
												
													
														|  | -+  //   3 for syncroniser
 |  | 
 | 
											
												
													
														|  | -+  //   1 to write back to fsmc bus.
 |  | 
 | 
											
												
													
														|  | -   Timing.DataSetupTime = 4;
 |  | 
 | 
											
												
													
														|  | -+
 |  | 
 | 
											
												
													
														|  | -+  // Allow a clock for us to release signals
 |  | 
 | 
											
												
													
														|  | -+  // Need to avoid both devices acting as outputs
 |  | 
 | 
											
												
													
														|  | -+  // on the multiplexed lines at the same time.
 |  | 
 | 
											
												
													
														|  | -   Timing.BusTurnAroundDuration = 1;
 |  | 
 | 
											
												
													
														|  | --  Timing.CLKDivision = 16;
 |  | 
 | 
											
												
													
														|  | --  Timing.DataLatency = 17;
 |  | 
 | 
											
												
													
														|  | -+
 |  | 
 | 
											
												
													
														|  | -+  Timing.CLKDivision = 16; // Ignored for async
 |  | 
 | 
											
												
													
														|  | -+  Timing.DataLatency = 17; // Ignored for async
 |  | 
 | 
											
												
													
														|  | -   Timing.AccessMode = FMC_ACCESS_MODE_A;
 |  | 
 | 
											
												
													
														|  | -   /* ExtTiming */
 |  | 
 | 
											
												
													
														|  | - 
 |  | 
 | 
											
												
													
														|  | -@@ -107,6 +123,10 @@ static void HAL_FMC_MspInit(void){
 |  | 
 | 
											
												
													
														|  | -   PE0   ------> FMC_NBL0
 |  | 
 | 
											
												
													
														|  | -   PE1   ------> FMC_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_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10 
 |  | 
 | 
											
												
													
														|  | -                           |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14 
 |  | 
 | 
											
												
													
														|  |  diff --git a/STM32CubeMX/2021/Src/sdio.c b/STM32CubeMX/2021/Src/sdio.c
 |  |  diff --git a/STM32CubeMX/2021/Src/sdio.c b/STM32CubeMX/2021/Src/sdio.c
 | 
											
												
													
														|  |  index 01e3895..33fbae1 100644
 |  |  index 01e3895..33fbae1 100644
 | 
											
												
													
														|  |  --- a/STM32CubeMX/2021/Src/sdio.c
 |  |  --- a/STM32CubeMX/2021/Src/sdio.c
 | 
											
										
											
												
													
														|  | @@ -447,3 +401,59 @@ index 4f23a45..614b6dc 100644
 | 
											
												
													
														|  |   /**
 |  |   /**
 | 
											
												
													
														|  |     * @brief  Send the Write Multi Block command and check the response
 |  |     * @brief  Send the Write Multi Block command and check the response
 | 
											
												
													
														|  |     * @param  SDIOx: Pointer to SDIO register base 
 |  |     * @param  SDIOx: Pointer to SDIO register base 
 | 
											
												
													
														|  | 
 |  | +diff --git a/STM32CubeMX/2021/Src/fmc.c b/STM32CubeMX/2021/Src/fmc.c
 | 
											
												
													
														|  | 
 |  | +index dae179a..a527167 100644
 | 
											
												
													
														|  | 
 |  | +--- a/STM32CubeMX/2021/Src/fmc.c
 | 
											
												
													
														|  | 
 |  | ++++ b/STM32CubeMX/2021/Src/fmc.c
 | 
											
												
													
														|  | 
 |  | +@@ -49,15 +49,33 @@ 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;
 | 
											
												
													
														|  | 
 |  | ++
 | 
											
												
													
														|  | 
 |  | +   hsram1.Init.PageSize = FMC_PAGE_SIZE_NONE;
 | 
											
												
													
														|  | 
 |  | +   /* Timing */
 | 
											
												
													
														|  | 
 |  | +-  Timing.AddressSetupTime = 2;
 | 
											
												
													
														|  | 
 |  | +-  Timing.AddressHoldTime = 1;
 | 
											
												
													
														|  | 
 |  | +-  Timing.DataSetupTime = 4;
 | 
											
												
													
														|  | 
 |  | +-  Timing.BusTurnAroundDuration = 1;
 | 
											
												
													
														|  | 
 |  | +-  Timing.CLKDivision = 16;
 | 
											
												
													
														|  | 
 |  | +-  Timing.DataLatency = 17;
 | 
											
												
													
														|  | 
 |  | ++
 | 
											
												
													
														|  | 
 |  | ++  // 1 clock to read the address, + 2 for synchroniser skew
 | 
											
												
													
														|  | 
 |  | ++  Timing.AddressSetupTime = 6;
 | 
											
												
													
														|  | 
 |  | ++  Timing.AddressHoldTime = 2;
 | 
											
												
													
														|  | 
 |  | ++
 | 
											
												
													
														|  | 
 |  | ++  // Writes to device:
 | 
											
												
													
														|  | 
 |  | ++  //   2 for synchroniser skew (dbx also delayed)
 | 
											
												
													
														|  | 
 |  | ++  //   1 to skip hold time
 | 
											
												
													
														|  | 
 |  | ++  //   1 to write data.
 | 
											
												
													
														|  | 
 |  | ++
 | 
											
												
													
														|  | 
 |  | ++  // Reads from device:
 | 
											
												
													
														|  | 
 |  | ++  //   1 to skip hold time
 | 
											
												
													
														|  | 
 |  | ++  //   2 for synchroniser skew on OE
 | 
											
												
													
														|  | 
 |  | ++  //   1 to write back to fsmc bus.
 | 
											
												
													
														|  | 
 |  | ++  Timing.DataSetupTime = 8;
 | 
											
												
													
														|  | 
 |  | ++
 | 
											
												
													
														|  | 
 |  | ++  // Allow a clock for us to release signals
 | 
											
												
													
														|  | 
 |  | ++  // Need to avoid both devices acting as outputs
 | 
											
												
													
														|  | 
 |  | ++  // on the multiplexed lines at the same time.
 | 
											
												
													
														|  | 
 |  | ++  Timing.BusTurnAroundDuration = 2;
 | 
											
												
													
														|  | 
 |  | ++
 | 
											
												
													
														|  | 
 |  | ++  Timing.CLKDivision = 16; // Ignored for async
 | 
											
												
													
														|  | 
 |  | ++  Timing.DataLatency = 17; // Ignored for async
 | 
											
												
													
														|  | 
 |  | +   Timing.AccessMode = FMC_ACCESS_MODE_A;
 | 
											
												
													
														|  | 
 |  | +   /* ExtTiming */
 | 
											
												
													
														|  | 
 |  | + 
 | 
											
												
													
														|  | 
 |  | +@@ -107,6 +125,10 @@ static void HAL_FMC_MspInit(void){
 | 
											
												
													
														|  | 
 |  | +   PE0   ------> FMC_NBL0
 | 
											
												
													
														|  | 
 |  | +   PE1   ------> FMC_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_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10 
 | 
											
												
													
														|  | 
 |  | +                           |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14 
 |