Bad chip or bad initialization? S25FS512SDSBHV213

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

cross mob
ErGo_3681856
Level 1
Level 1

Hello,

I am using the S25FS512SDSBHV213 in serial SPI mode. Quad is not available on the nrf52832 processor. The only commands that seem to have effect are volatile ones, all non-volatile commands appear to fail silently. I only have the one custom PCB for another few weeks, is there any other tests I can run to see if it is just a bad IC, or if it is my firmware?

Code Run

//Set 4 byte mode

static uint8_t four_byte_mode[] =       {0xB7};

static uint8_t four_byte_mode_len = 1;

////Read from Any register

static uint8_t rdar_addr[] = {0x65, 0x00, 0x00, 0x00, 0x00 }; //Reads from any register

static uint8_t rdar_addr_len = 5;

static uint8_t rdar[64];

static uint8_t rdar_len = 5+1; //write length plus actual register

////Write to Config Register 2 Non-Volatile

static uint8_t cr2nv[] = {0x71, 0x00, 0x00, 0x00, 0x03, 0x88}; //writes to CR2NV , bit7=4-byte addressing, 6=QSPI, 5=IO3Reset,4=RFU, 3-0 = Read Latency

static uint8_t cr2nv_len = 6;

//Write Enable Command

static uint8_t write_en_cmd[] =          {0x06}; //addr 06

static uint8_t write_en_cmd_len = 1;

static void memory_read_register(uint32_t address, char * str, uint8_t len)

{

    if(memory_wait_until_ready() == false)

    {

        NRF_LOG_ERROR("Flash timed out before we could erase everything");

        NRF_LOG_FLUSH();

    }

    set_command_address(rdar_addr,address);

    spi_read(FLASH_SSEL_PIN,rdar_addr,rdar_addr_len,rdar,len);

    NRF_LOG_RAW_INFO("%s ",str);

    uint8_t i;

    for(i=0; i < len; i++)

        NRF_LOG_RAW_INFO("0x%02x ",rdar);

    NRF_LOG_RAW_INFO("\r\n");

    NRF_LOG_FLUSH();

}

void memory_init (void)

{

    ret_code_t err_code;

    uint8_t i;

    for(i=0; i < 4; i++)

        who_am_i = 0;

    //read the information about the flash to make sure it is the correct one

    spi_read(FLASH_SSEL_PIN,who_am_i_addr,who_am_i_addr_len, who_am_i, who_am_i_len);

    NRF_LOG_DEBUG("Indentification info should match 0x01,0x02,0x20 : 0x%02x,0x%02x,0x%02x ", who_am_i[1], who_am_i[2], who_am_i[3]);

    //Set ourselves in 4-byte addressing mode

    spi_write(FLASH_SSEL_PIN,write_en_cmd, write_en_cmd_len);

    spi_write(FLASH_SSEL_PIN,four_byte_mode, four_byte_mode_len);

    nrf_delay_ms(100);

    //Permanently set ourselves into 4 byte mode

    spi_write(FLASH_SSEL_PIN,write_en_cmd, write_en_cmd_len);

    spi_write(FLASH_SSEL_PIN,cr2nv, cr2nv_len);

    nrf_delay_ms(100);

    //flash memory timer

    err_code = app_timer_create(&flash_erase_timer_id, APP_TIMER_MODE_SINGLE_SHOT, flash_erase_timeout_handler);

    APP_ERROR_CHECK(err_code);

    //read from our status registers

    spi_read(FLASH_SSEL_PIN,sr1v_addr,sr1v_addr_len,sr1v,sr1v_len);

    NRF_LOG_INFO("SR1: %d",sr1v[2]);

    spi_read(FLASH_SSEL_PIN,sr2v_addr,sr2v_addr_len,sr1v,sr1v_len);

    NRF_LOG_INFO("SR2: %d",sr1v[2]);

    spi_read(FLASH_SSEL_PIN,cr1v_addr,sr1v_addr_len,sr1v,sr1v_len);

    NRF_LOG_INFO("CR1: %d",sr1v[2]);

    memory_read_register(0x00800000, "SR1:", 8);

    memory_read_register(2, "CR1NV:", 8);

    memory_read_register(3, "CR2NV:", 8);

    memory_read_register(4, "CR3NV:", 8);

    memory_read_register(5, "CR4NV:", 8);

    memory_read_register(0x00800002, "CR1:", 8);

    memory_read_register(0x00800003, "CR2:", 8);

    memory_read_register(0x00800004, "CR3:", 8);

    memory_read_register(0x00800005, "CR4:", 8);

    memory_read_register(0x00800040, "PPBL:", 8);

    spi_write(FLASH_SSEL_PIN,write_en_cmd, write_en_cmd_len);

    memory_read_register(0x00800000, "SR1:", 8);

    memory_read_ppbr(0, "PPBR:", 16);

    NRF_LOG_FLUSH();

    FLAG_FLASH_FINISHED_ERASING = 0;

    head_pointer = 0;

    tail_pointer = 0;

}

Results

<debug> app: Indentification info should match 0x01,0x02,0x20 : 0x01,0x02,0x20

<info> app: SR1: 0

<info> app: SR2: 0

<info> app: CR1: 0

SR1: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

CR1NV: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

CR2NV: 0x00 0x00 0x00 0x00 0x00 0x00 0x08 0x08

CR3NV: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

CR4NV: 0x00 0x00 0x00 0x00 0x00 0x00 0x10 0x10

CR1: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

CR2: 0x00 0x00 0x00 0x00 0x00 0x00 0x88 0x88

CR3: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

CR4: 0x00 0x00 0x00 0x00 0x00 0x00 0x10 0x10

PPBL: 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x01

SR1: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

PPBR: 0x00 0x00 0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF

0 Likes
9 Replies
BushraH_91
Moderator
Moderator
Moderator
750 replies posted 50 likes received 250 solutions authored

Hello,

Thank you for contacting Cypress Community Forum. We have received your inquiry and currently reviewing the case. We will get back to you as soon as we find the resolution.

Have a wonderful day

Regards,

Bushra

0 Likes

Hello,

What exact non-volatile command is failing? The correct right device IDs being read and also the register values don't look too wrong.

Thank you

Regards,

Bushra

0 Likes

Hi Bushra,

I'm writing cr2nv[] by sending this command:

cr2nv[] = {0x71, 0x00, 0x00, 0x00, 0x03, 0x88}; //writes to CR2NV

But afterwards, CR2NV still remains at 0x80.

CR2 volatile is at 0x88 because the 4-byte mode command worked.

static uint8_t four_byte_mode[] =       {0xB7};

I have also tried writing regular flash through the command {0x06} then {0x12,0x00,0x00,0x00,0x00, 0x01}, but readbacks {0x13,0x00,0x00,0x00,0x00} only give 0xFF.

Thank you

0 Likes

Hi Bushra,

Is there a "global flash write" enable command for this chip? I do not see such information in the datasheet.

0 Likes

Hello,

Did you send the Write Enable command (06h) before writing to the registers or programming to the flash?

Thank you

Regards,

Bushra

0 Likes

Hi Bushra,

Yes, I send the single character {0x06} followed by {0x71, 0x00, 0x00, 0x00, 0x03, 0x88};

But CR2NV stays at {0x08} instead of changing

Thank you very much

0 Likes

Hello

Please send us the logic analyzer traces.

Thank you

Regards,

Bushra

0 Likes

Hello,

We are still waiting for logic analyzer traces to debug the issue.

Thank you

Regards,

Bushra

0 Likes

Hello Bushra,

I am awaiting for a second PCB to arrive. I do not have good access to place logic analyzer probes on the current device.

I ordered the same flash in a different package and hand wired it up to a development kit. I got even worse replies out of the flash, even when responding to the ID request command. I was able to take pictures of that, but I do not think they will be useful in troubleshooting.

Thanks

0 Likes