Skip to main content

spiflash.read(address, numberOfBytes)

Copies data from the SPI flash and returns it as a series of bytes

Availability

Device

Parameters

Name Type Description
address Integer The address from which to copy the data
numberOfBytes Integer The number of bytes to copy

Returns

Blob — the bytes read from the SPI flash

Description

This method reads the number of bytes specified, starting at the given address, and writes them into a new blob object which it creates and returns after the read is complete.

Contrast this method with spiflash.readintoblob() which performs the same task but writes the bytes read from the SPI flash into an existing blob passed as a parameter.

Example Code

Read 36 bytes from SPI flash starting from address 3 * 1024.