PDA

View Full Version : Can't get SST25VF032B to work



Christopher4187
- 6th March 2015, 13:29
I'm using the same footprint as a FM25V10 and the SST25VF032B appears to have almost the exact same instructions as the FM25V10. The problem is, no matter what commands I try, reading or writing produce nothing usable. The code is below. Can anyone see something that I missed?



MSSP_WRITE:

LOW PORTH.3
SSP2BUF = 6
WHILE PIR3.7 = 0:WEND:PIR3.7 = 0
HIGH PORTH.3

LOW PORTH.3
SSP2BUF = 2
WHILE PIR3.7 = 0:WEND:PIR3.7 = 0
SSP2BUF = MCP_ADDRESS_EXT
WHILE PIR3.7 = 0:WEND:PIR3.7 = 0
SSP2BUF = MCP_ADDRESS_.HIGHBYTE
WHILE PIR3.7 = 0:WEND:PIR3.7 = 0
SSP2BUF = MCP_ADDRESS.LOWBYTE
WHILE PIR3.7 = 0:WEND:PIR3.7 = 0
SSP2BUF = WRITE_DATA
WHILE PIR3.7 = 0:WEND:PIR3.7 = 0
HIGH PORTH.3
RETURN

MSSP_READ:

LOW PORTH.3
SSP2BUF = 3
WHILE PIR3.7 = 0:WEND:PIR3.7 = 0
SSP2BUF = MCP_ADDRESS_EXT
WHILE PIR3.7 = 0:WEND:PIR3.7 = 0
SSP2BUF = MCP_ADDRESS.HIGHBYTE
WHILE PIR3.7 = 0:WEND:PIR3.7 = 0
SSP2BUF = MCP_ADDRESS.LOWBYTE
WHILE PIR3.7 = 0:WEND:PIR3.7 = 0
READ_DATA = SSP2BUF
HIGH PORTH.3

RETURN

HenrikOlsson
- 6th March 2015, 15:23
Hi,
As far as I understand (having played around with the SST25VF08 a couple of years ago) you have to,
A) Make sure the adress you're trying to write to it's erased,
B) If the WP-pin is HIGH, make sure the block you're trying to write is NOT protected by the Block Protect bits in the status register, see below.
B.1) Execute the EWSR command
B.2) Execute the WRSR command
B.2) Write the new value (0 to unlock all of it) of the status register
C) Execute the WREN instruction.

I highly recommend you declare a bunch of constants for the various commands, it's much easier than having to a bunch a magic numbers in the code.

SST_Cmd_Read CON $03 ' Read byte, adress increment automatically
SST_Cmd_EWSR CON $50 ' Enable status register write
SST_Cmd_WREN CON $06 ' Write Enable

SSPBUF = SST_Cmd_WREN


/Henrik.