Flash 2 click
Flash 2 click
IC/Module Microchip SST26VF064B
(http://ww1.microchip.com/downloads/en/DeviceDoc/20005119G.pdf)
Interface SPI (MISO, MOSI, SCK), CS, #HOLD
Power
supply
3.3V
Website www.mikroe.com/click/flash-2 (http://www.mikroe.com/click/flash-2)
Schematic also available in PDF (http://cdn-
docs.mikroe.com/images/9/96/Schematic-
Flash_2_click_v100.pdf)
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
Flash 2 click
From MikroElektonika Documentation
Flash 2 click carries Microchip’s SST26VF064B flash-memory module with 8
MB capacity. It’s a highly reliable module with a specified minimum of 100,000
write cycles and with over 100 years of Data Retention. For data security, the
module features a One-Time Programmable (OTP) 2 KB bit secure ID and a 64 bit
unique, factory pre-programmed identifier. Additional software security measures
include inidividual-block write Protection with permanent lock-down capability.
Flash 2 click communicates with the target MCU through the mikroBUS™ SPI
interface (CS#, SCK, MISO, MOSI) with additional functionality provided by the
#HOLD pin (in place of default mikroBUS™ RST pin). The board is designed to
use a 3.3V power supply.
Features and usage notes
The SST26VF064B/064BA
memory array is organized in
uniform, 4 KByte erasable
sectors with the following
erasable blocks:
- Eight 8 KB parameter
- Two 32 KByte overlay
- One-hundred twenty-six 64
KByte overlay blocks
The #HOLD pin temporarily
stops serial communication
with the SPI Flash memory
while the device is selected. This pin only works in SPI, single-bit and dual-bit Read mode and must be tied
high when not in use.
The manufacturer's data sheet has more information about the memory protection features of the chip:
"SST26VF064B/064BA offers flexible memory protection scheme that allows the protection state of each individual block to be controlled separately. In
addition, the Write-Protection Lock-Down register prevents any change of the lock status during device operation. To avoid inadvertent writes during power-up,
the device is write-protected by default after a power-on reset cycle. A Global Block Protection Unlock command offers a single command cycle that unlocks the
entire memory array for faster manufacturing throughput."
Programming
This snippet initializes all necessary pins and functions for using Flash 2 Click, and performs a test by writing test values to the click, and then reading them
back to the user through UART communication.
#include <stdint.h>
#include "flash_2_hw.h"
sbit FLASH_2_WP at GPIOA_ODR.B0;
sbit FLASH_2_CS at GPIOD_ODR.B13;
sbit FLASH_2_HLD at GPIOC_ODR.B2;
int main(void)
{
uint8_t buffer[4] = {15,20,25,30};
uint16_t count =4;
uint32_t address = 0x0100F0;
uint8_t receive_buffer[4];
char tmp[20];
GPIO_Digital_Output( &GPIOA_BASE, _GPIO_PINMASK_0 );
GPIO_Digital_Output( &GPIOC_BASE, _GPIO_PINMASK_2 );
GPIO_Digital_Output( &GPIOD_BASE, _GPIO_PINMASK_13 );
SPI1_Init_Advanced( _SPI_FPCLK_DIV64,
_SPI_MASTER | _SPI_8_BIT | _SPI_CLK_IDLE_LOW |
_SPI_FIRST_CLK_EDGE_TRANSITION | _SPI_MSB_FIRST |
_SPI_SS_DISABLE | _SPI_SSM_ENABLE |
_SPI_SSI_1,
&_GPIO_MODULE_SPI3_PC10_11_12 );
Delay_ms(300);
UART1_Init(9600);
Page 1 of 2