File tree Expand file tree Collapse file tree 3 files changed +84
-0
lines changed
Expand file tree Collapse file tree 3 files changed +84
-0
lines changed Original file line number Diff line number Diff line change 1+ #ifndef ROCKETLIB_QSPI_FLASH .H
2+ #define ROCKETLIB_QSPI_FLASH .H
3+
4+ #include <stdbool.h>
5+ #include <stdint.h>
6+
7+ #include "common.h"
8+
9+ #ifdef __cplusplus
10+ extern "C" {
11+ #endif
12+
13+ #ifdef __cplusplus
14+ }
15+ #endif
16+
17+ #endif /* ROCKETLIB_QSPI_FLASH.H */
Original file line number Diff line number Diff line change 1+ #include "stm32h7xx_hal.h"
2+
3+ // Normal SPI
4+ const QSPI_CommandTypeDef command = {
5+ .Instruction = 0x0 ;
6+ .Address = 0x014 ;
7+ .AlternateBytes = 0x0 ;
8+ .AdressSize = 0x0 ; // 8-bits
9+ .AlternateBytesSize = 0x0 ;
10+ .DummyCycles = 0x8 ;
11+ .InstructionMode = 0x1 ; // Mode for a single line
12+ .AddressMode = 0x1 ;
13+ .AlternateBytesMode = 0x1 ;
14+ .DataMode = 0x1 ;
15+ .NbData = 0x0 ;
16+ .DdrMode = 0 ; // DDR disabled
17+ .DdrHoldHalfCycle = 0x0 ;
18+ .SIOOMode = 0x0 ;
19+ }
20+
21+ // Quad SPI
22+ const QSPI_CommandTypeDef command = {
23+ .Instruction = 0x0 ;
24+ .Address = 0x014 ;
25+ .AlternateBytes = 0x0 ;
26+ .AdressSize = 0x0 ; // 8-bits
27+ .AlternateBytesSize = 0x0 ;
28+ .DummyCycles = 0x8 ;
29+ .InstructionMode = 0x3 ; // Mode for four lines
30+ .AddressMode = 0x3 ;
31+ .AlternateBytesMode = 0x3 ;
32+ .DataMode = 0x3 ;
33+ .NbData = 0x0 ;
34+ .DdrMode = 0x1 ; // DDR enabled
35+ .DdrHoldHalfCycle = 0x0 ;
36+ .SIOOMode = 0x0 ;
37+ }
38+
39+ // send to switch flash to qpsi mode
40+ wstatus_t qspi_switch () {
41+ HAL_StatusTypeDef HAL_QSPI_Command (QSPI_HandleTypeDef * hqspi , QSPI_CommandTypeDef * cmd , uint32_t Timeout )
42+ }
Original file line number Diff line number Diff line change 1+ #ifndef ROCKETLIB_MX25l25645G_DEFS_H
2+ #define ROCKETLIB_MX25l25645G_DEFS_H
3+
4+ #include <stdbool.h>
5+ #include <stdint.h>
6+
7+ #include "common.h"
8+
9+ typedef enum {
10+ MX_CMD_READ = 0x03 ,
11+ MX_CMD_FAST_READ = 0x0B ,
12+ MX_CMD_2READ = 0xBB ,
13+ MX_CMD_DREAD = 0x3B ,
14+ MX_CMD_4READ = 0xEB ,
15+ MX_CMD_QREAD = 0x6B ,
16+ MX_CMD_4DTRD = 0xED ,
17+ MX_CMD_PP = 0x02 ,
18+ MX_CMD_4PP = 0x38 ,
19+ MX_CMD_SE = 0x20 ,
20+ MX_CMD_BE32K = 0x52 ,
21+ MX_CMD_BE = 0xD8 ,
22+ MX_CMD_CE = 0xC7
23+ } command_t ;
24+
25+ #endif /* ROCKETLIB_MX25l25645G_DEFS_H */
You can’t perform that action at this time.
0 commit comments