File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,35 @@ static void sdram_init_seq(SDRAM_HandleTypeDef
228
228
*/
229
229
#define REFRESH_COUNT (MICROPY_HW_SDRAM_REFRESH_RATE*90000/8192-20)
230
230
HAL_SDRAM_ProgramRefreshRate (hsdram , REFRESH_COUNT );
231
+
232
+ #if defined(STM32F7 )
233
+ /* Enable MPU for the SDRAM Memory Region to allow non-aligned
234
+ accesses (hard-fault otherwise)
235
+ */
236
+
237
+ MPU_Region_InitTypeDef MPU_InitStruct ;
238
+
239
+ /* Disable the MPU */
240
+ HAL_MPU_Disable ();
241
+
242
+ /* Configure the MPU attributes for SDRAM */
243
+ MPU_InitStruct .Enable = MPU_REGION_ENABLE ;
244
+ MPU_InitStruct .BaseAddress = SDRAM_START_ADDRESS ;
245
+ MPU_InitStruct .Size = MPU_REGION_SIZE_4MB ;
246
+ MPU_InitStruct .AccessPermission = MPU_REGION_FULL_ACCESS ;
247
+ MPU_InitStruct .IsBufferable = MPU_ACCESS_NOT_BUFFERABLE ;
248
+ MPU_InitStruct .IsCacheable = MPU_ACCESS_NOT_CACHEABLE ;
249
+ MPU_InitStruct .IsShareable = MPU_ACCESS_NOT_SHAREABLE ;
250
+ MPU_InitStruct .Number = MPU_REGION_NUMBER0 ;
251
+ MPU_InitStruct .TypeExtField = MPU_TEX_LEVEL1 ;
252
+ MPU_InitStruct .SubRegionDisable = 0x00 ;
253
+ MPU_InitStruct .DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE ;
254
+
255
+ HAL_MPU_ConfigRegion (& MPU_InitStruct );
256
+
257
+ /* Enable the MPU */
258
+ HAL_MPU_Enable (MPU_PRIVILEGED_DEFAULT );
259
+ #endif
231
260
}
232
261
#endif //FMC_SDRAM_BANK
233
262
You can’t perform that action at this time.
0 commit comments