ST意法半导体
直播中

笑过就走

10年用户 991经验值
擅长:可编程逻辑 电源/新能源 MEMS/传感技术
私信 关注
[问答]

QSPI加载器在CubeProgrammer中读取函数失败是何原因

你好。
我用 W25Q64 为 STM32F746NEH6 开发了一个定制板。
我为这个闪存芯片制作了一个驱动程序。一切(如读取、写入、擦除、内存映射模式...)工作正常...
但是在制作 stldr 文件后我得到了这个错误:
这是我的引出线:
读取函数是否导致此错误?
但是loader不需要这个功能。
我测试了内存映射模式功能......它工作正常......在其他代码中使用它后,外部闪存作为内部闪存工作:

  • uint8_t CSP_QSPI_EnableMemoryMappedMode(void)
  • {
  •         QSPI_CommandTypeDef sCommand = {0};
  •         QSPI_MemoryMappedTypeDef sMemMappedCfg;
  •         /* basic configuration */
  •   sCommand.InstructionMode          = QSPI_INSTRUCTION_1_LINE;        // * 1 line mode Send instruction * /
  •   sCommand.AddressSize              = QSPI_ADDRESS_24_BITS;                 // * 24 Bit address * /
  •   sCommand.AlternateByteMode        = QSPI_ALTERNATE_BYTES_NONE;      // * No interverter byte * /
  •   sCommand.DdrMode                  = QSPI_DDR_MODE_DISABLE;          // * W25Q64JV does not support DDR * /
  •   sCommand.DdrHoldHalfCycle         = QSPI_DDR_HHC_ANALOG_DELAY;      // * DDR mode, data output delay * /
  •   sCommand.SIOOMode                 = QSPI_SIOO_INST_EVERY_CMD;       // * Each transmission must send instructions * /
  •         // * Read data * /
  •   sCommand.Instruction    = QUAD_OUT_FAST_READ_CMD;     // * Read status command * /
  •   sCommand.AddressMode    = QSPI_ADDRESS_1_LINE;        // * 1 Line address * /
  •   sCommand.DataMode       = QSPI_DATA_4_LINES;          // * 1 wire data * /
  •   sCommand.DummyCycles    = 8;                          // * 8 cycles * /
  •         //MemoryMapped settings
  •         sMemMappedCfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE;
  •         sMemMappedCfg.TimeOutPeriod                 = 0;
  •         if (HAL_QSPI_MemoryMapped(&hqspi, &sCommand, &sMemMappedCfg) != HAL_OK) {
  •                 return HAL_ERROR;
  •         }
  •         /* basic configuration */
  •   sCommand.InstructionMode          = QSPI_INSTRUCTION_1_LINE;        // * 1 line mode Send instruction * /
  •   sCommand.AddressSize              = QSPI_ADDRESS_24_BITS;                 // * 24 Bit address * /
  •   sCommand.AlternateByteMode        = QSPI_ALTERNATE_BYTES_4_LINES;   // * 4 Line interverter byte * /
  •         sCommand.AlternateBytesSize       = QSPI_ALTERNATE_BYTES_8_BITS;    // * 1 Byte alternate * /
  •         sCommand.AlternateBytes                       = 0xFF;                                                                                                    // * should be 0xFx * /
  •   sCommand.DdrMode                  = QSPI_DDR_MODE_DISABLE;          // * W25Q64JV does not support DDR * /
  •   sCommand.DdrHoldHalfCycle         = QSPI_DDR_HHC_ANALOG_DELAY;      // * DDR mode, data output delay * /
  •   sCommand.SIOOMode                 = QSPI_SIOO_INST_EVERY_CMD;       // * Each transmission must send instructions * /
  •         // * Read data * /
  •   sCommand.Instruction    = QUAD_INOUT_FAST_READ_CMD;   // * Read status command * /
  •   sCommand.AddressMode    = QSPI_ADDRESS_4_LINES;       // * 4 Line address address * /
  •   sCommand.DataMode       = QSPI_DATA_4_LINES;          // * 1 wire data * /
  •   sCommand.DummyCycles    = 4;                          // * 4 cycles * /
  •         //MemoryMapped settings
  •         sMemMappedCfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE;
  •         sMemMappedCfg.TimeOutPeriod                 = 0;
  •         if (HAL_QSPI_MemoryMapped(&hqspi, &sCommand, &sMemMappedCfg) != HAL_OK) {
  •                 return HAL_ERROR;
  •         }
  • }
所以...有什么问题?
谁能帮助我吗?


回帖(1)

刘桂英

2022-12-27 14:35:07
我评论了内存映射函数的第一部分,在第二部分中使用了 2 个虚拟周期而不是备用 0xff 字节:


  • uint8_t CSP_QSPI_EnableMemoryMappedMode(void)
  • {
  •         QSPI_CommandTypeDef sCommand = {0};
  •         QSPI_MemoryMappedTypeDef sMemMappedCfg;

  • //        /* basic configuration */
  • //        sCommand.InstructionMode          = QSPI_INSTRUCTION_1_LINE;        // * 1 line mode Send instruction * /
  • //        sCommand.AddressSize              = QSPI_ADDRESS_24_BITS;                 // * 24 Bit address * /
  • //        sCommand.AlternateByteMode        = QSPI_ALTERNATE_BYTES_NONE;      // * No interverter byte * /
  • //        sCommand.DdrMode                  = QSPI_DDR_MODE_DISABLE;          // * W25Q64JV does not support DDR * /
  • //        sCommand.DdrHoldHalfCycle         = QSPI_DDR_HHC_ANALOG_DELAY;      // * DDR mode, data output delay * /
  • //        sCommand.SIOOMode                 = QSPI_SIOO_INST_EVERY_CMD;       // * Each transmission must send instructions * /
  • //
  • //        // * Read data * /
  • //        sCommand.Instruction    = 0x6B;     // * Read status command * /
  • //        sCommand.AddressMode    = QSPI_ADDRESS_1_LINE;        // * 1 Line address * /
  • //        sCommand.DataMode       = QSPI_DATA_4_LINES;          // * 1 wire data * /
  • //        sCommand.DummyCycles    = 8;                          // * 8 cycles * /
  • //
  • //        //MemoryMapped settings
  • //        sMemMappedCfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE;
  • //        sMemMappedCfg.TimeOutPeriod                 = 0;
  • //
  • //        if (HAL_QSPI_MemoryMapped(&hqspi, &sCommand, &sMemMappedCfg) != HAL_OK) {
  • //                return HAL_ERROR;
  • //        }

  •         /* basic configuration */
  •         sCommand.InstructionMode          = QSPI_INSTRUCTION_1_LINE;        // * 1 line mode Send instruction * /
  •         sCommand.AddressSize              = QSPI_ADDRESS_24_BITS;                 // * 24 Bit address * /
  •         sCommand.AlternateByteMode        = QSPI_ALTERNATE_BYTES_NONE;   // * 4 Line interverter byte * /
  •         //sCommand.AlternateBytesSize       = QSPI_ALTERNATE_BYTES_8_BITS;    // * 1 Byte alternate * /
  •         //sCommand.AlternateBytes                       = 0xFF;                                                                                                    // * should be 0xFx * /
  •         sCommand.DdrMode                  = QSPI_DDR_MODE_DISABLE;          // * W25Q64JV does not support DDR * /
  •         sCommand.DdrHoldHalfCycle         = QSPI_DDR_HHC_ANALOG_DELAY;      // * DDR mode, data output delay * /
  •         sCommand.SIOOMode                 = QSPI_SIOO_INST_EVERY_CMD;       // * Each transmission must send instructions * /

  •         // * Read data * /
  •         sCommand.Instruction    = 0xEB;   // * Read status command * /
  •         sCommand.AddressMode    = QSPI_ADDRESS_4_LINES;       // * 4 Line address address * /
  •         sCommand.DataMode       = QSPI_DATA_4_LINES;          // * 1 wire data * /
  •         sCommand.DummyCycles    = 6;                          // * 4 cycles * /

  •         //MemoryMapped settings
  •         sMemMappedCfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE;
  •         sMemMappedCfg.TimeOutPeriod                 = 0;

  •         if (HAL_QSPI_MemoryMapped(&hqspi, &sCommand, &sMemMappedCfg) != HAL_OK) {
  •                 return HAL_ERROR;
  •         }

  •         return HAL_OK;
  • }


然后评论了 CSP_QUADSPI_Init 函数中的配置 func 部分......终于成功了!

在配置中,我将 QE 位设置为“高”(对于 jv 系列,它默认为高)并将 DRV0/DRV1 设置为“00”……但实际上这是问题的原因!
举报

更多回帖

发帖
×
20
完善资料,
赚取积分