STM32的FMC接口接SRAM,用NWAIT等待功能。PD6 PC6都是FMC_NWAIT引脚。同样的程序用PD6没问题,PC6会导致STM32自锁、读保护。请问大家哪里的问题。下面是代码。
__HAL_RCC_GPIOC_CLK_ENABLE();
GPIO_Init_Structure.Pin = GPIO_PIN_6;
GPIO_Init_Structure.Mode=GPIO_MODE_AF_PP;
GPIO_Init_Structure.Pull=GPIO_NOPULL;
GPIO_Init_Structure.Speed=GPIO_SPEED_HIGH;
GPIO_Init_Structure.Alternate=GPIO_AF12_FMC;
HAL_GPIO_Init(GPIOD, &GPIO_Init_Structure);
SRAM_HandleTypeDef CPLD_sram;
FMC_NORSRAM_TimingTypeDef Timing;
CPLD_sram.Init.NSBank = FMC_NORSRAM_BANK1;
CPLD_sram.Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE;
CPLD_sram.Init.MemoryType = FMC_MEMORY_TYPE_SRAM;
CPLD_sram.Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_16;
CPLD_sram.Init.BurstAccessMode = FMC_BURST_ACCESS_MODE_DISABLE;
CPLD_sram.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW;
CPLD_sram.Init.WaitSignalActive = FMC_WAIT_TIMING_BEFORE_WS;
CPLD_sram.Init.WriteOperation = FMC_WRITE_OPERATION_ENABLE;
CPLD_sram.Init.WaitSignal = FMC_WAIT_SIGNAL_DISABLE;
CPLD_sram.Init.ExtendedMode = FMC_EXTENDED_MODE_DISABLE;
CPLD_sram.Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_ENABLE;
CPLD_sram.Init.WriteBurst = FMC_WRITE_BURST_DISABLE;
CPLD_sram.Init.ContinuousClock = FMC_CONTINUOUS_CLOCK_SYNC_ONLY;
CPLD_sram.Init.WriteFifo = 0;
CPLD_sram.Init.PageSize = 0;
CPLD_sram.Instance = FMC_NORSRAM_DEVICE;
CPLD_sram.Extended = FMC_NORSRAM_EXTENDED_DEVICE;
Timing.AddressSetupTime = 0;
Timing.AddressHoldTime = 0;
Timing.DataSetupTime = 3;
Timing.BusTurnAroundDuration = 1;
Timing.CLKDivision = 0;
Timing.DataLatency = 0;
Timing.AccessMode = FMC_ACCESS_MODE_A;
HAL_SRAM_DeInit(&CPLD_sram);
HAL_SRAM_Init(&CPLD_sram, &Timing, &Timing);
一周热门 更多>