Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_spi_master.h"
60 #define FLASH10_CMD_READ_ARRAY 0x03
61 #define FLASH10_CMD_FAST_READ_ARRAY 0x0B
67 #define FLASH10_CMD_BLOCK_ERASE_4KB 0x20
68 #define FLASH10_CMD_BLOCK_ERASE_32KB 0x52
69 #define FLASH10_CMD_BLOCK_ERASE_64KB 0xD8
70 #define FLASH10_CMD_CHIP_ERASE 0x60
71 #define FLASH10_CMD_BYTE_PAGE_PROGRAM 0x02
72 #define FLASH10_CMD_SEQUENTIAL_PROGRAM 0xAD
73 #define FLASH10_CMD_ERASE_PROGRAM_SUSPEND 0x75
74 #define FLASH10_CMD_ERASE_PROGRAM_RESUME 0x7A
80 #define FLASH10_CMD_WRITE_ENABLE 0x06
81 #define FLASH10_CMD_WRITE_DISABLE 0x04
82 #define FLASH10_CMD_VOLATILE_STATUS 0x50
83 #define FLASH10_CMD_INDIVIDUAL_BLOCK_LOCK 0x36
84 #define FLASH10_CMD_INDIVIDUAL_BLOCK_UNLOCK 0x39
85 #define FLASH10_CMD_READ_BLOCK_LOCK 0x3C
86 #define FLASH10_CMD_GLOBAL_BLOCK_LOCK 0x7E
87 #define FLASH10_CMD_GLOBAL_BLOCK_UNLOCK 0x98
93 #define FLASH10_CMD_PROGRAM_OTP_SECURITY 0x9B
94 #define FLASH10_CMD_READ_OTP_SECURITY 0x4B
100 #define FLASH10_CMD_READ_STATUS_1 0x05
101 #define FLASH10_CMD_READ_STATUS_2 0x35
102 #define FLASH10_CMD_READ_STATUS_3 0x15
103 #define FLASH10_CMD_READ_STATUS_4 0x65
104 #define FLASH10_CMD_READ_STATUS_5 0x65
105 #define FLASH10_CMD_WRITE_STATUS_1 0x01
106 #define FLASH10_CMD_WRITE_STATUS_2 0x31
107 #define FLASH10_CMD_WRITE_STATUS_3 0x11
108 #define FLASH10_CMD_WRITE_STATUS_4 0x71
109 #define FLASH10_CMD_WRITE_STATUS_5 0x71
110 #define FLASH10_CMD_READ_STATUS 0x65
111 #define FLASH10_CMD_WRITE_STATUS 0x71
112 #define FLASH10_CMD_STATUS_LOCK 0x6F
118 #define FLASH10_CMD_DEEP_POWER_DOWN 0xB9
119 #define FLASH10_CMD_ULTRA_DEEP_POWER_DOWN 0x79
120 #define FLASH10_CMD_RESUME_FROM_DPD 0xAB
126 #define FLASH10_CMD_ENABLE_RESET 0x66
127 #define FLASH10_CMD_RESET_DEVICE 0x99
128 #define FLASH10_CMD_TERMINATE 0xF0
134 #define FLASH10_CMD_MANUFACTURER_ID 0x90
135 #define FLASH10_CMD_JEDEC_ID 0x9F
141 #define FLASH10_CMD_READ_SFDP 0x5A
159 #define FLASH10_STATUS_REG_1 1
160 #define FLASH10_STATUS_REG_2 2
161 #define FLASH10_STATUS_REG_3 3
162 #define FLASH10_STATUS_REG_4 4
163 #define FLASH10_STATUS_REG_5 5
169 #define FLASH10_STATUS1_SRP0 0x80
170 #define FLASH10_STATUS1_BPSIZE 0x40
171 #define FLASH10_STATUS1_TB 0x20
172 #define FLASH10_STATUS1_WEL 0x02
173 #define FLASH10_STATUS1_BSY 0x01
179 #define FLASH10_MIN_ADDRESS 0x000000
180 #define FLASH10_MAX_ADDRESS 0x3FFFFFul
181 #define FLASH10_PAGE_SIZE 256
187 #define FLASH10_MANUFACTURER_ID 0x1F
188 #define FLASH10_DEVICE_ID 0x47
198 #define FLASH10_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
199 #define FLASH10_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
217 #define FLASH10_MAP_MIKROBUS( cfg, mikrobus ) \
218 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
219 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
220 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
221 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
222 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
223 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_PWM );
err_t flash10_write_cmd_data(flash10_t *ctx, uint8_t cmd, uint8_t *data_in, uint8_t len)
Flash 10 write cmd data function.
err_t flash10_read_cmd_address_data(flash10_t *ctx, uint8_t cmd, uint32_t address, uint8_t *data_out, uint32_t len)
Flash 10 read cmd address data function.
err_t flash10_write_enable(flash10_t *ctx)
Flash 10 write enable function.
pin_name_t chip_select
Definition: flash10.h:241
err_t flash10_read_status(flash10_t *ctx, uint8_t status_reg_num, uint8_t *status)
Flash 10 read status function.
pin_name_t sck
Definition: flash10.h:254
This file contains SPI specific macros, functions, etc.
err_t flash10_memory_write(flash10_t *ctx, uint32_t address, uint8_t *data_in, uint32_t len)
Flash 10 memory write function.
err_t flash10_erase_memory(flash10_t *ctx, uint8_t erase_cmd, uint32_t address)
Flash 10 erase memory function.
digital_out_t rst
Definition: flash10.h:235
Flash 10 Click context object.
Definition: flash10.h:233
err_t flash10_check_communication(flash10_t *ctx)
Flash 10 check communication function.
uint32_t spi_speed
Definition: flash10.h:262
err_t flash10_read_cmd_data(flash10_t *ctx, uint8_t cmd, uint8_t *data_out, uint8_t len)
Flash 10 read cmd data function.
spi_master_t spi
Definition: flash10.h:239
pin_name_t cs
Definition: flash10.h:255
err_t flash10_write_cmd(flash10_t *ctx, uint8_t cmd)
Flash 10 write cmd function.
err_t flash10_write_protect(flash10_t *ctx)
Flash 10 write protect function.
err_t flash10_write_cmd_address_data(flash10_t *ctx, uint8_t cmd, uint32_t address, uint8_t *data_in, uint32_t len)
Flash 10 write cmd address data function.
pin_name_t miso
Definition: flash10.h:252
@ FLASH10_OK
Definition: flash10.h:274
spi_master_chip_select_polarity_t cs_polarity
Definition: flash10.h:264
void flash10_set_wp_pin(flash10_t *ctx, uint8_t state)
Flash 10 set wp pin function.
err_t flash10_soft_reset(flash10_t *ctx)
Flash 10 soft reset function.
Flash 10 Click configuration object.
Definition: flash10.h:250
pin_name_t mosi
Definition: flash10.h:253
pin_name_t wp
Definition: flash10.h:259
err_t flash10_write_status(flash10_t *ctx, uint8_t status_reg_num, uint8_t status)
Flash 10 write status function.
pin_name_t rst
Definition: flash10.h:258
err_t flash10_init(flash10_t *ctx, flash10_cfg_t *cfg)
Flash 10 initialization function.
flash10_return_value_t
Flash 10 Click return value data.
Definition: flash10.h:273
err_t flash10_memory_read(flash10_t *ctx, uint32_t address, uint8_t *data_out, uint32_t len)
Flash 10 memory read function.
void flash10_cfg_setup(flash10_cfg_t *cfg)
Flash 10 configuration object setup function.
void flash10_set_rst_pin(flash10_t *ctx, uint8_t state)
Flash 10 set rst pin function.
spi_master_mode_t spi_mode
Definition: flash10.h:263
digital_out_t wp
Definition: flash10.h:236
@ FLASH10_ERROR
Definition: flash10.h:275