cancel
Showing results for 
Search instead for 
Did you mean: 

Issue Interfacing Winbond W25Q16JV with STM32H745 Custom Board (QSPI)

Muruganandam
Associate

Hello everyone,

I am currently working on interfacing the Winbond W25Q16JV with my STM32H745 custom board over QSPI but have been facing issues with communication. I've utilized resources from ST’s QSPI library available at:
ST QSPI Drivers

Despite following the provided implementation, I am unable to achieve successful communication. When I flash the program, it either:

  1. Gets stuck in the middle of the QSPI initialization function.
  2. Occasionally, it even bricks the board.

Additionally, I have referred to Controllers Tech YouTube tutorials for guidance:
Controllers Tech - QSPI Playlist

I will attach the MX file (ZIP) for reference. Has anyone successfully interfaced the W25Q16JV with the STM32H7 series? Any insights, suggestions, or debugging tips would be greatly appreciated.

Thanks in advance!

3 REPLIES 3
Muruganandam
Associate
 

Most are likely using larger capacity parts.

With these older parts it will be important to track what state WP#/D2 pin is doing, and how/if you switch to 4-pin operation. And that SR1/SR2 write as a pair.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
 
uint8_t QSPI_Configuration(void) {
    QSPI_CommandTypeDef sCommand = { 0 };
      uint8_t sr1 = 0x00;  // Status Register 1
    uint8_t sr2 = 0x00;  // Status Register 2
    HAL_StatusTypeDef ret;
    // Read Status Register 1 and Status Register 2 (SR1 and SR2)
       sCommand.InstructionMode = QSPI_INSTRUCTION_1_LINE;
       sCommand.Instruction = READ_STATUS_REG1_CMD;  // Read SR1
       sCommand.AddressMode = QSPI_ADDRESS_NONE;
       sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
       sCommand.DataMode = QSPI_DATA_1_LINE;
       sCommand.DummyCycles = 0;
       sCommand.DdrMode = QSPI_DDR_MODE_DISABLE;
       sCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
       sCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
       sCommand.NbData = 1;
       // Read SR1
       if ((ret = HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)) != HAL_OK) {
           return ret;
       }
       if ((ret = HAL_QSPI_Receive(&hqspi, &sr1, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)) != HAL_OK) {
           return ret;
       }
       // Read SR2
       sCommand.Instruction = READ_STATUS_REG2_CMD;  // Read SR2
           if ((ret = HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)) != HAL_OK) {
               return ret;
           }
           if ((ret = HAL_QSPI_Receive(&hqspi, &sr2, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)) != HAL_OK) {
               return ret;
           }
           // Enable Volatile Write operations (for both SR1 and SR2)
               sCommand.DataMode = QSPI_DATA_NONE;
               sCommand.Instruction = VOLATILE_SR_WRITE_ENABLE;
               if (HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
                   return ret;
               }
               // Set the QE bit in SR2 (bit 1) and write to SR2
                    sr2 |= 0x02;  // Set QE bit in SR2
                   sCommand.DataMode = QSPI_DATA_1_LINE;
                   sCommand.Instruction = WRITE_STATUS_REG2_CMD;  // Write SR2
                   sCommand.NbData = 1;  // Write 1 byte (SR2)
                   if ((ret = HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)) != HAL_OK) {
                       return ret;
                   }
                   if ((ret = HAL_QSPI_Transmit(&hqspi, &sr2, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)) != HAL_OK) {
                       return ret;
                   }
                   // Write to SR1 (you can modify SR1 as needed)
                       sCommand.Instruction = WRITE_STATUS_REG1_CMD;  // Write SR1
                       if ((ret = HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)) != HAL_OK) {
                           return ret;
                       }
                       if ((ret = HAL_QSPI_Transmit(&hqspi, &sr1, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)) != HAL_OK) {
                           return ret;
                       }
                 HAL_Delay(1); // Small delay for stability
                 /* Step 4: Read Status Register 3 */
                 uint8_t sr3;
                 sCommand.Instruction = READ_STATUS_REG3_CMD;
                 sCommand.NbData = 1;
                 if ((ret = HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)) != HAL_OK) {
                     return ret;
                 }
                 if ((ret = HAL_QSPI_Receive(&hqspi, &sr3, HAL_QPSI_TIMEOUT_DEFAULT_VALUE)) != HAL_OK) {
                     return ret;
                 }
                 /* Step 5: Modify SR3 (DRV1:2 = 00) */
                 sr3 &= 0x9F; // Clear DRV1:2 bits
                 sCommand.Instruction = WRITE_STATUS_REG3_CMD;
                 if (HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
                     return ret;
                 }
                 if (HAL_QSPI_Transmit(&hqspi, &sr3, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
                     return ret;
                 }
                 HAL_Delay(1); // Ensure register write stability
                 return HAL_OK;
             }    
 
As per the your instruction i have changed the code to read both the SR1 and SR2 and  still it doesnt work I have attached the code above for your reference also the schematic connection attached along with this reply, Kindly refer those and assist me in solving this communication issue also provide detailed information about the SR1 and SR2 reading for this W25Q16J.