STM32F429ZIT6 con SDRAM IS42S16320F Problema de lectura / escritura

3

Diseñé una placa que contiene dos SDRAM (IS42S16320F) y STM32F476ZIT6 MCU (y otros componentes también). Puedo acceder a la SDRAM pero los datos cambian independientemente del código. Mi tablero tiene seis capas y la distancia entre RAM y MCU es de solo 2.8 cm. Y también hay otros componentes de alta velocidad en el tablero. De todos modos, he soldado la RAM, las resistencias en serie (22R), la MCU y los componentes de alimentación para depurar la placa, luego me di cuenta de este problema. Aquí está mi esquema, pila de capas, longitudes de rastreo y código;

Longituddetrazaenmm;

DataBusTraceLengths|AddressBusTraceLengths|ControlTracesLengthsD0=39,998|A0=50,301|CKE=53,983D1=27,51|A1=49,345|CLK=44,827D2=46,56|A2=49,567|NRAS=50,664D3=50,625|A3=48,266|NCAS=46,541D4=46,072|A4=42,726|NE=55,028D5=46,629|A5=43,585|NWRE=51,462D6=46,61|A6=44,654|NBL0=51,449D7=42,588|A7=47,963|NBL1=61,992D8=42,862|A8=49,552|BA0=30,563D9=39,407|A9=48,685|BA1=30,449D10=36,655|A10=47,991D11=33,025|A11=52,05D12=30,672|A12=39,684D13=24,976D14=23,563D15=21,279

AcabodesoldarelU5yestáenlasegundainterfazSDRAMenFMCquesignificaFMC_Bank2_SDRAM,porloquesudirecciónes0xD0000000.Aquíestánmiscódigosdeinicializaciónylectura/escritura;

/*******************************************************************************@briefConfiguresallSDRAMmemoryI/Ospins.*@paramNone.*@retvalNone.*@noteUsedpinsfromMCUforPHD;*+------------------------------------------------------------------------------+|SDRAMPinsAssignment|+------------------+-------------------+-------------------+-------------------+|PD0<->FMC_D2|PE0<->FMC_NBL0|PF0<->FMC_A0|PG0<->FMC_A10||PD1<->FMC_D3|PE1<->FMC_NBL1|PF1<->FMC_A1|PG1<->FMC_A11||PD8<->FMC_D13|PE7<->FMC_D4|PF2<->FMC_A2|PG4<->FMC_BA0||PD9<->FMC_D14|PE8<->FMC_D5|PF3<->FMC_A3|PG5<->FMC_BA1||PD10<->FMC_D15|PE9<->FMC_D6|PF4<->FMC_A4|PG8<->FMC_SDCLK||PD14<->FMC_D0|PE10<->FMC_D7|PF5<->FMC_A5|PG15<->FMC_NCAS||PD15<->FMC_D1|PE11<->FMC_D8|PF11<->FMC_NRAS|-------------------++------------------|PE12<->FMC_D9|PF12<->FMC_A6||PE13<->FMC_D10|PF13<->FMC_A7||PE14<->FMC_D11|PF14<->FMC_A8||PE15<->FMC_D12|PF15<->FMC_A9|+-------------------+-------------------+|PB5<->FMC_SDCKE1|->SDRAM_U2|PB6<->FMC_SDNE1|->SDRAM_U2|PC3<->FMC_SDCKE0|->SDRAM_U1|PC2<->FMC_SDNE0|->SDRAM_U1|PC0<->FMC_SDNWE|->COMMON+---------------------------------------+******************************************************************************/voidSDRAM_GPIOInit(void){GPIO_InitTypeDefgpio;/*EnableallGPIOportclocks*/RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOC|RCC_AHB1Periph_GPIOD|RCC_AHB1Periph_GPIOD|RCC_AHB1Periph_GPIOE|RCC_AHB1Periph_GPIOF|RCC_AHB1Periph_GPIOG,ENABLE);/*CommonGPIOconfiguration*/gpio.GPIO_Mode=GPIO_Mode_AF;gpio.GPIO_Speed=GPIO_Speed_50MHz;gpio.GPIO_OType=GPIO_OType_PP;gpio.GPIO_PuPd=GPIO_PuPd_NOPULL;/*GOIOBconfiguration*/GPIO_PinAFConfig(GPIOB,GPIO_PinSource5,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOB,GPIO_PinSource6,GPIO_AF_FMC);gpio.GPIO_Pin=GPIO_Pin_5|GPIO_Pin_6;GPIO_Init(GPIOB,&gpio);/*GPIOCconfiguration*/GPIO_PinAFConfig(GPIOC,GPIO_PinSource0,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOC,GPIO_PinSource2,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOC,GPIO_PinSource3,GPIO_AF_FMC);gpio.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_2|GPIO_Pin_3;GPIO_Init(GPIOC,&gpio);/*GPIODconfiguration*/GPIO_PinAFConfig(GPIOD,GPIO_PinSource0,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOD,GPIO_PinSource1,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOD,GPIO_PinSource8,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOD,GPIO_PinSource9,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOD,GPIO_PinSource10,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOD,GPIO_PinSource14,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOD,GPIO_PinSource15,GPIO_AF_FMC);gpio.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_14|GPIO_Pin_15;GPIO_Init(GPIOD,&gpio);/*GPIOEconfiguration*/GPIO_PinAFConfig(GPIOE,GPIO_PinSource0,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOE,GPIO_PinSource1,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOE,GPIO_PinSource7,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOE,GPIO_PinSource8,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOE,GPIO_PinSource9,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOE,GPIO_PinSource10,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOE,GPIO_PinSource11,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOE,GPIO_PinSource12,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOE,GPIO_PinSource13,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOE,GPIO_PinSource14,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOE,GPIO_PinSource15,GPIO_AF_FMC);gpio.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;GPIO_Init(GPIOE,&gpio);/*GPIOFconfiguration*/GPIO_PinAFConfig(GPIOF,GPIO_PinSource0,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOF,GPIO_PinSource1,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOF,GPIO_PinSource2,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOF,GPIO_PinSource3,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOF,GPIO_PinSource4,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOF,GPIO_PinSource5,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOF,GPIO_PinSource11,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOF,GPIO_PinSource12,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOF,GPIO_PinSource13,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOF,GPIO_PinSource14,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOF,GPIO_PinSource15,GPIO_AF_FMC);gpio.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;GPIO_Init(GPIOF,&gpio);/*GPIOGconfiguration*/GPIO_PinAFConfig(GPIOG,GPIO_PinSource0,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOG,GPIO_PinSource1,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOG,GPIO_PinSource8,GPIO_AF_FMC);GPIO_PinAFConfig(GPIOG,GPIO_PinSource15,GPIO_AF_FMC);gpio.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_8|GPIO_Pin_15;GPIO_Init(GPIOG,&gpio);}voidSDRAM_InitSequence(uint32_ttarget_bank,uint32_tfmc_bank){__IOFMC_SDRAMCommandTypeDefsdCMD;__IOuint32_ttmp;/*Configureaclockconfigurationenablecommand*/sdCMD.FMC_CommandMode=FMC_Command_Mode_CLK_Enabled;sdCMD.FMC_CommandTarget=target_bank;sdCMD.FMC_AutoRefreshNumber=1;sdCMD.FMC_ModeRegisterDefinition=0;/*WaituntiltheSDRAMcontrollerisready*/while(FMC_GetFlagStatus(fmc_bank,FMC_FLAG_Busy)!=RESET){}/*Sendthecommand*/FMC_SDRAMCmdConfig(&sdCMD);/*Inserta100msdelay*/Delay(100);/*ConfigureaPALL(prechargeall)command*/sdCMD.FMC_CommandMode=FMC_Command_Mode_PALL;sdCMD.FMC_CommandTarget=target_bank;sdCMD.FMC_AutoRefreshNumber=1;sdCMD.FMC_ModeRegisterDefinition=0;/*WaituntiltheSDRAMcontrollerisready*/while(FMC_GetFlagStatus(fmc_bank,FMC_FLAG_Busy)!=RESET){}/*Sendthecommand*/FMC_SDRAMCmdConfig(&sdCMD);/*ConfigureaAuto-Refreshcommand*/sdCMD.FMC_CommandMode=FMC_Command_Mode_AutoRefresh;sdCMD.FMC_CommandTarget=target_bank;sdCMD.FMC_AutoRefreshNumber=1;sdCMD.FMC_ModeRegisterDefinition=0;/*WaituntiltheSDRAMcontrollerisready*/while(FMC_GetFlagStatus(fmc_bank,FMC_FLAG_Busy)!=RESET){}/*Sendthefirstcommand*/FMC_SDRAMCmdConfig(&sdCMD);/*WaituntiltheSDRAMcontrollerisready*/while(FMC_GetFlagStatus(fmc_bank,FMC_FLAG_Busy)!=RESET){}/*Sendthesecondcommand*/FMC_SDRAMCmdConfig(&sdCMD);/*Programtheexternalmemorymoderegister*/tmp=(uint32_t)SDRAM_MODEREG_BURST_LENGTH_2|SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL|SDRAM_MODEREG_CAS_LATENCY_3|SDRAM_MODEREG_OPERATING_MODE_STANDARD|SDRAM_MODEREG_WRITEBURST_MODE_SINGLE;/*ConfigureaLoadModeRegistercommand*/sdCMD.FMC_CommandMode=FMC_Command_Mode_LoadMode;sdCMD.FMC_CommandTarget=target_bank;sdCMD.FMC_AutoRefreshNumber=1;sdCMD.FMC_ModeRegisterDefinition=tmp;/*WaituntiltheSDRAMcontrollerisready*/while(FMC_GetFlagStatus(fmc_bank,FMC_FLAG_Busy)!=RESET){}/*Sendthecommand*/FMC_SDRAMCmdConfig(&sdCMD);/*Settherefreshratecounter*//*64ms/8192=7,81us;((7,81xFreq)-20)=683*//*Savethedevicerefreshcounter*/FMC_SetRefreshCount(683);/*WaituntilSDRAMcontrollerisready*/while(FMC_GetFlagStatus(fmc_bank,FMC_FLAG_Busy)!=RESET){}}voidSDRAM_Init(void){FMC_SDRAMInitTypeDefSDRAM;FMC_SDRAMTimingInitTypeDefTiming;/*ConfiguretheGPIOforFMCBank*/SDRAM_GPIOInit();/*EnableFMCclock*/RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FMC,ENABLE);/*FMCConfiguration*//*FMCSDRAMBankConfiguration*//*Timingconfigurationfor90MHzofSDClockfrequency(180MHz/2)*//*TMRD:2cycle*/Timing.FMC_LoadToActiveDelay=2;/*TXSR:min67ns(7x11.11ns)*/Timing.FMC_ExitSelfRefreshTime=7;/*TRAS:min37ns(4x11.11ns)max100000ns*/Timing.FMC_SelfRefreshTime=4;/*TRC:min8cycle*/Timing.FMC_RowCycleDelay=8;/*TWR:min14ns(2x11.11ns)*/Timing.FMC_WriteRecoveryTime=2;/*TRP:20ns(2x11.11ns)*/Timing.FMC_RPDelay=2;/*TRCD:20ns(2x11.11ns)*/Timing.FMC_RCDDelay=2;/*FMCSDRAMcontrolconfiguration*/SDRAM.FMC_Bank=FMC_Bank2_SDRAM;/*Rowaddressing[9:0]*/SDRAM.FMC_ColumnBitsNumber=FMC_ColumnBits_Number_10b;/*Columnaddressing[12:0]*/SDRAM.FMC_RowBitsNumber=FMC_RowBits_Number_13b;SDRAM.FMC_SDMemoryDataWidth=FMC_SDMemory_Width_16b;SDRAM.FMC_InternalBankNumber=FMC_InternalBank_Number_4;SDRAM.FMC_CASLatency=FMC_CAS_Latency_3;SDRAM.FMC_WriteProtection=FMC_Write_Protection_Disable;SDRAM.FMC_SDClockPeriod=FMC_SDClock_Period_2;SDRAM.FMC_ReadBurst=FMC_Read_Burst_Disable;SDRAM.FMC_ReadPipeDelay=FMC_ReadPipe_Delay_1;SDRAM.FMC_SDRAMTimingStruct=&Timing;/*InitializationofFMCSDRAMBank2*/FMC_SDRAMInit(&SDRAM);/*InitsequenceforSDRAMBank2*/SDRAM_InitSequence(FMC_Command_Target_bank2,FMC_Bank2_SDRAM);}#defineIS42S16320F_SIZE(uint32_t)0x10000#defineSDRAM_ADDR(uint32_t)0xD0000000__IOuint32_tcounter=0;__IOuint8_tubReadByte=0;constuint8_tubWriteByte=0x3C;intmain(void){/*InitializetheSysTick*/SystemCoreClockUpdate();if(SysTick_Config(SystemCoreClock/1000)){while(1);}/*SDRAMInitialization*/SDRAM_Init();/*Disablewriteprotection*/FMC_SDRAMWriteProtectionConfig(FMC_Bank2_SDRAM,DISABLE);/*EraseSDRAMmemory*/for(counter=0;counter<IS42S16320F_SIZE;counter++){*(__IOuint8_t*)(SDRAM_ADDR+counter)=(uint8_t)0x00;}/*WritedatavaluetoSDRAMmemory*/for(counter=0;counter<IS42S16320F_SIZE;counter++){*(__IOuint8_t*)(SDRAM_ADDR+counter)=ubWriteByte;}/*ReadbackSDRAMmemoryandcheckcontentcorrection*/for(counter=0;counter<IS42S16320F_SIZE;counter++){ubReadByte=*(__IOuint8_t*)(SDRAM_ADDR+counter);if(ubWriteByte!=ubReadByte)break;}/*InthisstageI'mexpectingnochangeondataintheSDRAMbutwhenIwatchthememorysectionsdataischanging.Thepicturesaboutthataddedtheendofthequestion.*/while(1){}}

Losdatosnosonigualesconelvalorescritodurantelalectura.Yenelbuclesinfin,losdatosestáncambiandodeformaindependiente.¿Hayalgúnproblemaconlosvaloresdeactualización/sincronizaciónolasecuenciadeinicializacióndeSDRAM?AquíestáelenlacedelaSDRAM hoja de datos . Gracias de antemano por cualquier ayuda.

EDITAR: Verifiqué todas las conexiones con el ojo y luego, en un multímetro, encontré algunos problemas de soldadura con las resistencias de la matriz. Luego, desoldé y volví a soldar todo lo relacionado con SDRAM. MCU luego verificó cada conexión de extremo a extremo. Ahora puedo leer lo que escribí pero en un reloj SDRAM de 45MHz. Todavía faltan datos en el modo de 90MHz.

    
pregunta Orkun Kasapoglu

0 respuestas

Lea otras preguntas en las etiquetas