我想通过原子的stm32f767的探索版,调试spi的内存映射功能,参照769的官方历程修改的,但是出来的数据一直不正确,这个是映射配置的代码 往w25q256里写的代码算是原子的历程, 变量的初始化 const u8 TEXT_Buffer[]={"Apollo STM32F7 QSPI TEST"}; #define SIZE sizeof(TEXT_Buffer) __IO uint8_t buf[100],*p while(1) { if(key==KEY2_PRES)//KEY0按下,读取字符串并显示 { LCD_Fill(0,170,239,319,WHITE);//清除半屏 LCD_ShowString(30,170,200,16,16,"OSPI Start Read QSPI.... "); Memory_Mapped_Enable(4); x=0; memset(datatemp,0,sizeof(TEXT_Buffer)); while(1) { if(*qspi_addr==0) { break; } datatemp[x++] = *qspi_addr++; printf("datatemp :%c",datatemp[x]); printf(" *qspi_addr:%4d",*qspi_addr); printf(" qspi_addr:%x\r\n",qspi_addr); } printf("x = %d",x); LCD_ShowString(30,170,200,16,16,"The qspi Data Readed Is: "); //提示传送完成 LCD_ShowString(30,230,200,16,16,datatemp); //显示读到的字符串 } } //使能内存映射. u8 Memory_Mapped_Enable(u32 dummyCycles) { QSPI_CommandTypeDef s_command; //命令结构体 QSPI_MemoryMappedTypeDef s_mem_mapped_cfg; //内存映射 配置结构体 /* Configure the command for the read instruction */ s_command.InstructionMode = QSPI_INSTRUCTION_1_LINE; //指令模式 单线传输数据 s_command.Instruction = Fast_Read_Quad; //指令 具体的指令 s_command.AddressMode = QSPI_ADDRESS_4_LINES; //地址模式 四线传输 s_command.Address = 0; s_command.AddressSize = QSPI_ADDRESS_24_BITS; //地址长度 24位地址 s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE; //交替字节 无交替字节 s_command.AlternateBytes = 0x00; //s_command.AlternateBytesSize = QSPI_ALTERNATE_BYTES_8_BITS; s_command.DataMode = QSPI_DATA_4_LINES; //数据模式 //QSPI_DATA_1_LINE s_command.NbData = 1; //每次读的字节数 s_command.DummyCycles = dummyCycles; //设置空指令周期数 s_command.DdrMode = QSPI_DDR_MODE_DISABLE; //关闭DDR模式 s_command.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY; //ddr模式下 数据输出延迟 s_command.SIOOMode = QSPI_SIOO_INST_EVERY_CMD; //每次都发送指令 //传输的数据个数 /* Configure the memory mapped mode */ s_mem_mapped_cfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE; s_mem_mapped_cfg.TimeOutPeriod = 0; if (HAL_QSPI_MemoryMapped(&QSPI_Handler, &s_command, &s_mem_mapped_cfg) != HAL_OK) { printf("HAL_QSPI_MemoryMapped Fail \r\n "); return 1; } else { printf("HAL_QSPI_MemoryMapped Sucess \r\n "); return 0; } } 恳求哪位大神帮我看看 是哪里出现错了 |