硬件平台:STM32F429I-DISCORVERY 软件平台:KEIL MDK5.10 作者 :羊村长 知识点:标准的SDRAM一般都是4个BANK,stm32f429-diso开发板使用的是IS42S16400J这个芯片。 IS42S16400J也有4个Bank,总容量为1Mbitx 16-bit x 4-bank = 67,108,864 bits = 64-Mbit ,每个BANK的组成 4096rows x 256 columns x 16 bits(=16Mbit), 对应的外部引线是12行8列,请参看datasheet. 实验目的:由于TM32F429I-DISCORVERY扩展了sdram,这对于视频播放,图片解码,音频解码,usb大容量数据缓冲 是非常有利的! 实验结果: 1.8Bit 测试成功率为100%,16Bit测试成功率为100% #define IS42S16400J_SIZE 0x400000 // 4M x 16Bit(存储宽度)=16Mbit(每个Bank的容量) int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup files (startup_stm32f429_439xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f4xx.c file */ uint8_t ubWritedata_8b = 0x3C, ubReaddata_8b = 0; uint16_t uhWritedata_16b = 0x1E5A, uhReaddata_16b = 0; uint32_t uwReadwritestatus = 0; uint32_t counter = 0x0; SysTick_Init(); STM_EVAL_LED_Config(); STM_EVAL_PBInit(BUTTON_MODE_EXTI); /* Initialize the LCD */ LCD_Init(); LCD_LayerInit(); LTDC_Cmd(ENABLE); LCD_SetLayer(LCD_FOREGROUND_LAYER); LCD_Clear(LCD_COLOR_BLUE); /* Disable write protection */ FMC_SDRAMWriteProtectionConfig(FMC_Bank2_SDRAM,DISABLE); while (1) { /*********************** 8-bits AHB transaction test ************************/ /* Wait for User button to be pressed */ while (STM_EVAL_PBGetState() != Bit_SET) {} STM_EVAL_LEDOff(LED3); STM_EVAL_LEDOff(LED4); /* Wait for User button is released */ while (STM_EVAL_PBGetState() != Bit_RESET) {} /* Erase SDRAM memory */ for (counter = 0x00; counter < IS42S16400J_SIZE; counter++) { *(__IO uint8_t*) (SDRAM_BANK_ADDR + counter) = (uint8_t)0x0; } /* Write data value to all SDRAM memory */ for (counter = 0; counter < IS42S16400J_SIZE; counter++) { *(__IO uint8_t*) (SDRAM_BANK_ADDR + counter) = (uint8_t)(ubWritedata_8b + counter); } /* Read back SDRAM memory and check content correctness*/ counter = 0; uwReadwritestatus = 0; while ((counter < IS42S16400J_SIZE) && (uwReadwritestatus == 0)) { ubReaddata_8b = *(__IO uint8_t*)(SDRAM_BANK_ADDR + counter); if ( ubReaddata_8b != (uint8_t)(ubWritedata_8b + counter)) { uwReadwritestatus = 1; } counter++; } if(uwReadwritestatus == 0) { STM_EVAL_LEDOn(LED3); STM_EVAL_LEDOff(LED4); LCD_Clear(LCD_COLOR_GREEN); LCD_DisplayStringLine(LCD_LINE_4, (uint8_t *)" 8-bits AHB "); LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" Transaction "); LCD_DisplayStringLine(LCD_LINE_6, (uint8_t *)" Test-> OK "); } else { STM_EVAL_LEDOn(LED4); STM_EVAL_LEDOff(LED3); LCD_Clear(LCD_COLOR_RED); LCD_DisplayStringLine(LCD_LINE_4, (uint8_t *)" 8-bits AHB "); LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" Transaction "); LCD_DisplayStringLine(LCD_LINE_6, (uint8_t *)" Test-> Failed "); } /*********************** 16-bits AHB transaction test ***********************/ /* Wait for User button to be pressed */ while (STM_EVAL_PBGetState() != Bit_SET) {} /* Turn Off Leds */ STM_EVAL_LEDOff(LED3); STM_EVAL_LEDOff(LED4); /* Wait for User button is released */ while (STM_EVAL_PBGetState() != Bit_RESET) {} /* Erase SDRAM memory */ for (counter = 0x00; counter < IS42S16400J_SIZE; counter++) { *(__IO uint16_t*) (SDRAM_BANK_ADDR + 2*counter) = (uint16_t)0x00; } /* Write data value to all SDRAM memory */ for (counter = 0; counter < IS42S16400J_SIZE; counter++) { *(__IO uint16_t*) (SDRAM_BANK_ADDR + 2*counter) = (uint16_t)(uhWritedata_16b + counter); } /* Read back SDRAM memory and check content correctness*/ counter = 0; uwReadwritestatus = 0; while ((counter < IS42S16400J_SIZE) && (uwReadwritestatus == 0)) { uhReaddata_16b = *(__IO uint16_t*)(SDRAM_BANK_ADDR + 2*counter); if ( uhReaddata_16b != (uint16_t)(uhWritedata_16b + counter)) { uwReadwritestatus = 1; } counter++; } if(uwReadwritestatus == 0) { STM_EVAL_LEDOn(LED3); STM_EVAL_LEDOff(LED4); LCD_Clear(LCD_COLOR_GREEN); LCD_DisplayStringLine(LCD_LINE_4, (uint8_t *)" 16-bits AHB "); LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" Transaction "); LCD_DisplayStringLine(LCD_LINE_6, (uint8_t *)" Test-> OK "); } else { STM_EVAL_LEDOn(LED4); STM_EVAL_LEDOff(LED3); LCD_Clear(LCD_COLOR_RED); LCD_DisplayStringLine(LCD_LINE_4, (uint8_t *)" 16-bits AHB "); LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" Transaction "); LCD_DisplayStringLine(LCD_LINE_6, (uint8_t *)" Test-> Failed "); } } } 16Bit数据测试: 8Bit数据测试: 工程代码: |
【STM32F429开发日志】汉字显示(取模方式)
【STM32F429开发日志】5.uCOS-ii V2.91 移植OK
图形化玩转Nucleo-STM32F413手机APP远程控制应用开发
【stm32F429开发日志】使用STM32CubeMX配置STM32F429_USB_HID
【STM32F429开发日志】(三)使用STM32Cube开发环境
【STM32F429开发日志】——网络收集的例程分享(包括所有STM32F429Discovery板上外设驱动)
分享个用STM32F429做的网络摄像头
STM32F429UCOS 源代码
【STM32F429开发日志】+hello led(闪烁led灯)
STM32F429DSICOVERY移植到STemWIN(图片+源码)
counter值应该是指可写16bit总数目,如果是读写一个字节8bit,可用总数量是counter*2,你可以试试
*(__IO uint8_t*) (SDRAM_BANK_ADDR + 2*counter-1) = (uint8_t)(ubWritedata_8b + counter);
ubReaddata_8b = *(__IO uint8_t*)(SDRAM_BANK_ADDR + 2*counter-1);
如果不减1,那就溢出了。
#define IS42S16400J_SIZE 0x400000 // 4M x 16Bit(存储宽度)=16Mbit(每个Bank的容量)
请问上面的注释对吗?
可以的,比如摄像头就需要FIFO,图片解码也需要大量ram的
RE:【STM32F429开发日志】2. 外部sdram读写测试
RE:【STM32F429开发日志】2. 外部sdram读写测试
RE:【STM32F429开发日志】2. 外部sdram读写测试
RE:【STM32F429开发日志】2. 外部sdram读写测试
RE:【STM32F429开发日志】2. 外部sdram读写测试
RE:【STM32F429开发日志】2. 外部sdram读写测试
回复:【STM32F429开发日志】2. 外部sdram读写测试
RE:【STM32F429开发日志】2. 外部sdram读写测试
回复:【STM32F429开发日志】2. 外部sdram读写测试
回复:【STM32F429开发日志】2. 外部sdram读写测试
回复:【STM32F429开发日志】2. 外部sdram读写测试
回复:【STM32F429开发日志】2. 外部sdram读写测试
回复:【STM32F429开发日志】2. 外部sdram读写测试
RE:【STM32F429开发日志】2. 外部sdram读写测试