Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MT25TL256 (32MiB dual-quad FLASH) + STM32H7A3ZIT6Q #13

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
3f51391
added STM32CubeMX generated project for STM32H7A3
Jan 6, 2023
6d3889e
disabled cubeMX backup
Jan 6, 2023
50e9dfc
added gitignore
Jan 6, 2023
9a109ed
updated cube generation
Jan 6, 2023
71bfc52
set mode to dual quad and updated defines
Jan 6, 2023
b4ce3a1
intermediate commit for ioc file
Jan 9, 2023
347f55e
intermediate commit
Jan 9, 2023
b4c9a99
intermediate commit
Jan 9, 2023
4167d49
intermediate commit reset of chip fails
Jan 10, 2023
86df936
intermediate commit: clocked flash lower, reading of first 2 id bytes…
Jan 11, 2023
502cd79
intermediate commit: reset and read id works
Jan 11, 2023
a2daaf1
added comment
Jan 11, 2023
b408f54
intermediate commit
Jan 11, 2023
84514dc
intermediate commit: refactored CSP_QSPI_WriteMemory
Jan 11, 2023
037561d
added QSPI_Command to simplify sending commands
Jan 12, 2023
962bdbd
intermediate commit: testing driver
Jan 12, 2023
6b05b44
intermediate commit
Jan 12, 2023
9b7710f
reading from volatile enhanced after writing fails
Jan 12, 2023
7f79097
intermediate commit, write enable is now set before writing configura…
Jan 13, 2023
03aa9c4
ID reading fails in QSPI protocol (0x70 instead of 0x20)
Jan 13, 2023
bb4a8d2
STR command + DTR address/data works
Jan 13, 2023
b3b5a93
intermediate commit: memory mapped works, write for 1st sector fails
Jan 13, 2023
aa9ad85
write doesn't work after erase
Jan 13, 2023
909d5b9
fixed erase function bug and check
Jan 16, 2023
eaf57df
intermediate commit: some refactoring
Jan 16, 2023
fa9323f
intermediate commit
Jan 16, 2023
80f9037
refactored CSP_QSPI_WriteMemory
Jan 16, 2023
fd3ce0c
intermediate commit
Jan 16, 2023
8e9f844
READ_DTR fails at byte 13
Jan 16, 2023
5d1b50a
clocked to 280MHz again, read DTR works
Jan 16, 2023
781f5e5
updated dummy cycles
Jan 16, 2023
411228a
updated todos
Jan 16, 2023
642bd88
removed unused variable
Jan 16, 2023
c26643d
flashing with stm32cube programmer fails
Jan 16, 2023
8de4f80
intermediate commit, loader has some issues, memory mapped read somet…
Jan 17, 2023
d147536
intermediate commit
Jan 17, 2023
361122b
doesn't work debug
Jan 17, 2023
06f52a1
intermediate commit, still doesn't work
Jan 18, 2023
ebf2644
fixed bug: if read id after reset fails it resets in quad mode too
Jan 19, 2023
01fc064
simplified reset
Jan 19, 2023
0a3bb95
enabled Discard unused sections (53.38kiB to 15.29kiB)
Jan 19, 2023
3e720e6
updated comment
Jan 19, 2023
f480464
fixed timeout for mass erase
Jan 19, 2023
58ccffa
synchronized linker file and ioc file
Jan 20, 2023
3238b72
changed comments and macros
Jan 20, 2023
8774b84
changed naming
Jan 20, 2023
212f7bd
forgotten commit
Jan 26, 2023
d4a889d
added readme
Jan 26, 2023
12a0517
added demo project for MT25TL256 (32MiB dual-quad FLASH) + STM32H7A3Z…
Jan 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 190 additions & 0 deletions Demo_Project_H7A3/.cproject

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Demo_Project_H7A3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Debug/
32 changes: 32 additions & 0 deletions Demo_Project_H7A3/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Custom_Loader</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.st.stm32cube.ide.mcu.MCUProjectNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUCubeProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCURootProjectNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
38 changes: 38 additions & 0 deletions Demo_Project_H7A3/Core/Inc/Dev_Inf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

#ifndef DEV_INF_H_
#define DEV_INF_H_

#define MCU_FLASH 1
#define NAND_FLASH 2
#define NOR_FLASH 3
#define SRAM 4
#define PSRAM 5
#define PC_CARD 6
#define SPI_FLASH 7
#define I2C_FLASH 8
#define SDRAM 9
#define I2C_EEPROM 10

#define SECTOR_NUM 10 // Max Number of Sector types

struct DeviceSectors
{
unsigned long SectorNum; // Number of Sectors
unsigned long SectorSize; // Sector Size in Bytes
};

struct StorageInfo
{
char DeviceName[100]; // Device Name and Description
unsigned short DeviceType; // Device Type: ONCHIP, EXT8BIT, EXT16BIT, ...
unsigned long DeviceStartAddress; // Default Device Start Address
unsigned long DeviceSize; // Total Size of Device
unsigned long PageSize; // Programming Page Size
unsigned char EraseValue; // Content of Erased Memory
struct DeviceSectors sectors[SECTOR_NUM];
};

extern struct StorageInfo const StorageInfo;


#endif /* DEV_INF_H_ */
16 changes: 16 additions & 0 deletions Demo_Project_H7A3/Core/Inc/Loader_Src.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef INC_LOADER_SRC_H_
#define INC_LOADER_SRC_H_

#include <stdint.h>

#define LOADER_OK 0x1
#define LOADER_FAIL 0x0

int Init(void);
int SectorErase(uint32_t EraseStartAddress, uint32_t EraseEndAddress);
int MassErase(void);
int Write(uint32_t Address, uint32_t Size, const uint8_t* buffer);
uint32_t CheckSum(uint32_t StartAddress, uint32_t Size, uint32_t InitVal);
uint64_t Verify(uint32_t MemoryAddr, uint32_t RAMBufferAddr, uint32_t Size,uint32_t missalignement);

#endif // INC_LOADER_SRC_H_
49 changes: 49 additions & 0 deletions Demo_Project_H7A3/Core/Inc/gpio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file gpio.h
* @brief This file contains all the function prototypes for
* the gpio.c file
******************************************************************************
* @attention
*
* Copyright (c) 2023 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __GPIO_H__
#define __GPIO_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

void MX_GPIO_Init(void);

/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif
#endif /*__ GPIO_H__ */

69 changes: 69 additions & 0 deletions Demo_Project_H7A3/Core/Inc/main.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @attention
*
* Copyright (c) 2023 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_hal.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
78 changes: 78 additions & 0 deletions Demo_Project_H7A3/Core/Inc/octospi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file octospi.h
* @brief This file contains all the function prototypes for
* the octospi.c file
******************************************************************************
* @attention
*
* Copyright (c) 2023 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __OCTOSPI_H__
#define __OCTOSPI_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

extern OSPI_HandleTypeDef hospi1;

/* USER CODE BEGIN Private defines */

//MT25TL256 memory parameters (single die specs):
#define MEMORY_FLASH_SIZE (16UL << 20) // 128 Mib => 16MiB
//#define MEMORY_BLOCK_SIZE (?UL << 10) // ? sectors of ?KiB
#define MEMORY_SECTOR_SIZE (4UL << 10) // 4096 subsectors of 4KiB
#define MEMORY_PAGE_SIZE 256 // 65536 pages of 256B
#define SECTORS_COUNT (MEMORY_FLASH_SIZE / MEMORY_SECTOR_SIZE)

//MT25TL256 memory parameters (twin die specs):
#define MEMORY_DUAL_FLASH_SIZE (MEMORY_FLASH_SIZE*2)
#define MEMORY_DUAL_PAGE_SIZE (MEMORY_PAGE_SIZE*2)
#define MEMORY_DUAL_SECTOR_SIZE (MEMORY_SECTOR_SIZE*2)

#define MEMORY_MAPPED_START_ADDRESS 0x90000000




/* USER CODE END Private defines */

void MX_OCTOSPI1_Init(void);

/* USER CODE BEGIN Prototypes */

uint8_t CSP_QUADSPI_Init(void);
uint8_t CSP_QSPI_EraseSector(uint32_t EraseStartAddress ,uint32_t EraseEndAddress);
uint8_t CSP_QSPI_WriteMemory(const uint8_t* buffer, uint32_t address, uint32_t buffer_size);
uint8_t CSP_QSPI_ReadMemory(uint8_t* buffer, uint32_t address, uint32_t buffer_size);
uint8_t CSP_QSPI_EnableMemoryMappedMode(void);
uint8_t CSP_QSPI_Erase_Chip(void);

extern OSPI_HandleTypeDef hospi1;

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __OCTOSPI_H__ */

Loading