pico-ice
RaspberryPi Pico with an iCE40 FPGA
Ice_sram

SRAM chip I/O. More...

Macros

#define ICE_SRAM_STATUS_BUSY_MASK   0x01
 
#define ICE_SRAM_TRANSFER_SIZE   32
 

Functions

void ice_sram_init (void)
 Send an initialization command to the SRAM chip.
 
void ice_sram_reset (void)
 Send a reset command to the SRAM chipo.
 
void ice_sram_get_id (uint8_t id[8])
 Obtain the chip ID from the SRAM chip. More...
 
void ice_sram_write_async (uint32_t addr, const uint8_t *data, size_t data_size, void(*callback)(volatile void *), void *context)
 Calling this function when any SPI transfer is in progress on this bus waits for it then starts. More...
 
void ice_sram_write_blocking (uint32_t addr, const uint8_t *data, size_t data_size)
 Write a buffer to the flash chip and wait until completion. More...
 
void ice_sram_read_async (uint32_t addr, uint8_t *data, size_t data_size, void(*callback)(volatile void *), void *context)
 Read a buffer from the flash chip in the background, with a callback called once done. More...
 
void ice_sram_read_blocking (uint32_t addr, uint8_t *data, size_t data_size)
 Read a buffer from the flash chip and wait until completion. More...
 

Detailed Description

SRAM chip I/O.

The SRAM chip is APS6404L-3SQN.

Function Documentation

◆ ice_sram_get_id()

void ice_sram_get_id ( uint8_t  id[8])

Obtain the chip ID from the SRAM chip.

Parameters
idBuffer to which the ID is written.

The format is:

  • 8 bits - Manufacturer ID (MF ID) - 0x0D for AP Memory
  • 8 bits - Known Good Die (KGD) - 0b01010101 if pass, 0b01011101 if fail
  • 3 bits - Density EID - A code for memory size
  • 45 bits - EID - the rest of the chip identifier

◆ ice_sram_read_async()

void ice_sram_read_async ( uint32_t  addr,
uint8_t *  data,
size_t  data_size,
void(*)(volatile void *)  callback,
void *  context 
)

Read a buffer from the flash chip in the background, with a callback called once done.

Parameters
addrAddress from which read the data.
dataBuffer to which save the data read.
data_sizeSize of this buffer in bytes.
callbackFunction called once the transfer is complete.
contextArgument passed to that function.

Calling this function when any SPI transfer is in progress on this bus waits for it then starts.

◆ ice_sram_read_blocking()

void ice_sram_read_blocking ( uint32_t  addr,
uint8_t *  data,
size_t  data_size 
)

Read a buffer from the flash chip and wait until completion.

Parameters
addrAddress from which read the data.
dataBuffer to which save the data read.
data_sizeSize of this buffer in bytes.

◆ ice_sram_write_async()

void ice_sram_write_async ( uint32_t  addr,
const uint8_t *  data,
size_t  data_size,
void(*)(volatile void *)  callback,
void *  context 
)

Calling this function when any SPI transfer is in progress on this bus waits for it then starts.

Parameters
addrAddress to which write the data.
dataBuffer with the data to send.
data_sizeSize of this buffer in bytes.
callbackFunction called once the transfer is complete.
contextArgument passed to that function.

Calling this function when a transfer is in progress waits then starts.

◆ ice_sram_write_blocking()

void ice_sram_write_blocking ( uint32_t  addr,
const uint8_t *  data,
size_t  data_size 
)

Write a buffer to the flash chip and wait until completion.

Parameters
addrAddress to which write the data.
dataBuffer with the data to send.
data_sizeSize of this buffer in bytes.