QSPI S7G2_DK driver Error Erase in 4 bytes addressing mode

Hi all,

I am currently working on porting an application from SSP 1.2.1 to SSP 2.3.0. Everything is going well for that part. 

In the ssp 1.2.1, we could only use 16Mb of or QSPI memory (mt25q256 - which works very closely to the n25q256a used in the S7G2_DK bsp).

As SSP 2.3.0 allows the use of 4B addressing mode i wanted to enable it. It works great on writes and reads, however erases always fail. By doing some debbuging i found out that it was the bsp_qspi_erase_command_get function inside bsp_qspi.c that caused the issue.

void bsp_qspi_erase_command_get(uint8_t *p_erase_command, uint8_t index)
{
    if(QSPI_DEVICE_MX25 == qspi_device)
    {
    	if (1U == mx25_config_reg.address_mode)
    	{
            *p_erase_command = mx25l12835f_4byte_erase_commands[index];
    	}
    	else
    	{
            *p_erase_command = mx25l12835f_erase_commands[index];
    	}
    }
    else
    {
	   if(4U == (flag_status.addressing_4_byte_mode + 3U))
	   {
		  *p_erase_command = n25q256a_4byte_erase_commands[index];
	   }
	   else
	   {
		  *p_erase_command = n25q256a_erase_commands[index];
	   }
    }
}

In here, the flag_status.addressing_4_byte_mode is always at 0, even when the qspi memory is in 4B mode and works for write and reads. As a result it is the 3B erase command that is passed to the qspi memory when it awaits a 4B command.

I tried to replace the "if" statement with only the 4B command selection tab, and then the erase works as it should, which makes me think there is an issue with the flag and how it is set (or maybe not updated? Or read?)

Has anyone seen something similar? How should I properly set this flag and where?

Many thanks for the help you could provide.