How can I read an Unique ID number using SPIFFY1 ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

My NVRAM is a serial flash connected to SPIFFY1. To protect my system I want to read Unique ID Number from sflash.

How can I access this data using SPIFFY1 interface ? Since SPIFFY1 has limited availability for application use is it possible at all ? How can I assert CS since this pin is not accessible from application ? Is it always asserted ?

0 Likes
1 Solution

I just realized that for this API, txLen + rxLen must be <= 14. Split your transaction into two reads. The other thing you may have to do is to put the SF out of deep sleep before reading and then put it back in deep sleep after you are done. Since you are bypassing the serial flash driver, you have to request the SF driver to do it for you. Here is some pseudocode:

extern void sfi_exitDeepPowerDown(void);

extern void sfi_enterDeepPowerDown(void);

extern void spiffy_txrxBlock(UINT32 txLen, const UINT8* txBuf, UINT32 rxLen, UINT8* rxBuf, void* ctxt);

UINT8 txBuf[5] = {0x5A, 0x11, 0x22, 0x33, 0x00};  /// instruction, 3 byte address, dummy byte

UINT8 rxBuf[12];

// Bring the SF out of deep sleep first

sfi_exitDeepPowerDown();

// Read keep rx + tx <= 14

spiffy_txrxBlock(5, txBuf, 9, rxBuf, (void*)spiffy_cfg_adr);

// --> Update address to read here.

spiffy_txrxBlock(5, txBuf, 3, rxBuf + 9, (void*)spiffy_cfg_adr);

// Put the SF back in deep sleep.

sfi_enterDeepPowerDown();

View solution in original post

13 Replies