pico-ice
RaspberryPi Pico with an iCE40 FPGA
Ice_flash

Flash chip I/O. More...

Macros

#define ICE_FLASH_PAGE_SIZE   256
 The size of the flash.
 
#define ICE_FLASH_SECTOR_SIZE   4096
 
#define ICE_FLASH_BLOCK_SIZE   65536
 

Functions

void ice_flash_init (void)
 Initialise the SPI1 peripheral, dedicated to flashing the FPGA.
 
void ice_flash_read (uint32_t addr, uint8_t *buf, size_t sz)
 Communicate to the chip over SPI and read multiple bytes at chosen address onto onto a buffer. More...
 
void ice_flash_erase_sector (uint32_t addr)
 Erase a sector of the flash chip at the given address. More...
 
void ice_flash_program_page (uint32_t addr, uint8_t const page[ICE_FLASH_PAGE_SIZE])
 Program a page of the flash chip at the given address. More...
 
void ice_flash_erase_block (uint32_t addr)
 Send a command to erase a whole block. More...
 
void ice_flash_erase_chip (void)
 Send a command to erase the whole chip.
 
void ice_flash_wakeup (void)
 Send a command to wakeup the chip.
 
void ice_flash_sleep (void)
 Send a command to put the chip to sleep.
 

Detailed Description

Flash chip I/O.

All these functions act on the on-board flash chip. For a generic flash memory I/O, you can see the low-level ice_smem.h

Function Documentation

◆ ice_flash_erase_block()

void ice_flash_erase_block ( uint32_t  addr)

Send a command to erase a whole block.

Parameters
addrThe address at which the data is written.

◆ ice_flash_erase_sector()

void ice_flash_erase_sector ( uint32_t  addr)

Erase a sector of the flash chip at the given address.

Parameters
addrThe beginning of the sector.

◆ ice_flash_program_page()

void ice_flash_program_page ( uint32_t  addr,
uint8_t const  page[ICE_FLASH_PAGE_SIZE] 
)

Program a page of the flash chip at the given address.

Parameters
addrThe address at which the data is written.
dataThe buffer holding the data to be sent to the flash chip, of size ICE_FLASH_PAGE_SIZE.

◆ ice_flash_read()

void ice_flash_read ( uint32_t  addr,
uint8_t *  buf,
size_t  sz 
)

Communicate to the chip over SPI and read multiple bytes at chosen address onto onto a buffer.

Parameters
addrThe address at which the data is read.
dataThe buffer onto which the data read is stored.
data_sizeThe size of the buffer in bytes.