From b9cb4b0df307abdf0462de214c1c3f33b987e2eb Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 21 Feb 2012 19:16:41 +0000 Subject: [PATCH] Fix SDIO DMA (finally) git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4409 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 4 ++++ arch/arm/src/stm32/stm32_sdio.c | 2 +- configs/stm3240g-eval/README.txt | 14 ++++++++++++++ configs/stm3240g-eval/nsh2/defconfig | 10 +++++----- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b69ff81792..f585e1a50e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2473,3 +2473,7 @@ The received buffer size must be two bytes larger to account for the two byte checksum that is appended to the packet. Otherwise, the last two bytes of real data in the packet will get clobbered. + * arch/arm/src/stm32f40xx_dma.c: The STM32 F4 DMA has (finally) been verified + * arch/arm/src/stm32_sdio.c: STM32 F4 SDIO DMA is now supported + * configs/stm3240g-eval/nsh/defconfig: This configuration now supports SDIO + with DMA (see configs/stm3240g-eval/README.txt for some issues). diff --git a/arch/arm/src/stm32/stm32_sdio.c b/arch/arm/src/stm32/stm32_sdio.c index cd006c6257..60db7373b0 100644 --- a/arch/arm/src/stm32/stm32_sdio.c +++ b/arch/arm/src/stm32/stm32_sdio.c @@ -119,7 +119,7 @@ # if defined(CONFIG_STM32_STM32F10XX) # define CONFIG_SDIO_DMAPRIO DMA_CCR_PRIMED # elif defined(CONFIG_STM32_STM32F40XX) -# define CONFIG_SDIO_DMAPRIO DMA_SCR_PRIMED +# define CONFIG_SDIO_DMAPRIO DMA_SCR_PRIVERYHI # else # error "Unknown STM32 DMA" # endif diff --git a/configs/stm3240g-eval/README.txt b/configs/stm3240g-eval/README.txt index ef26c00887..e4902947e2 100755 --- a/configs/stm3240g-eval/README.txt +++ b/configs/stm3240g-eval/README.txt @@ -720,9 +720,23 @@ Where is one of the following: configuration. 2. RS-232 is disabled, but Telnet is still available for use as a console. + Since RS-232 and SDIO use the same pins (one controlled by JP22), RS232 + and SDIO cannot be used concurrently. 3. This configuration requires that jumper JP22 be set to enable SDIO operation. + 4. In order to use SDIO without overruns, DMA must be used. The STM32 F4 + has 192Kb of SRAM in two banks: 112Kb of "system" SRAM located at + 0x2000:0000 and 64Kb of "TCM" SRAM located at 0x1000:0000. It appears + that you cannot perform DMA from TCM SRAM. The work around that I have now + is simply to omit the 64Kb of TCM SRAM from the heap so that all memory is + allocated from System SRAM. This is done by setting: + + CONFIG_MM_REGIONS=1 + + Then DMA works fine. The downside is, of course, is that we lose 64Kb + of precious SRAM. + ostest: ------ This configuration directory, performs a simple OS test using diff --git a/configs/stm3240g-eval/nsh2/defconfig b/configs/stm3240g-eval/nsh2/defconfig index 61fcddf218..25ab466b88 100644 --- a/configs/stm3240g-eval/nsh2/defconfig +++ b/configs/stm3240g-eval/nsh2/defconfig @@ -90,7 +90,7 @@ CONFIG_ARCH_BOOTLOADER=n CONFIG_ARCH_LEDS=y CONFIG_ARCH_BUTTONS=n CONFIG_ARCH_CALIBRATION=n -CONFIG_ARCH_DMA=n +CONFIG_ARCH_DMA=y # # Identify toolchain and linker options @@ -127,7 +127,7 @@ CONFIG_STM32_CRC=n CONFIG_STM32_BKPSRAM=n CONFIG_STM32_CCMDATARAM=n CONFIG_STM32_DMA1=n -CONFIG_STM32_DMA2=n +CONFIG_STM32_DMA2=y CONFIG_STM32_ETHMAC=y CONFIG_STM32_OTGHS=n # AHB2: @@ -500,7 +500,7 @@ CONFIG_DEBUG_CAN=n CONFIG_DEBUG_I2C=n CONFIG_DEBUG_DMA=n CONFIG_HAVE_CXX=y -CONFIG_MM_REGIONS=2 +CONFIG_MM_REGIONS=1 CONFIG_ARCH_LOWPUTC=y CONFIG_RR_INTERVAL=200 CONFIG_SCHED_INSTRUMENTATION=n @@ -598,7 +598,7 @@ CONFIG_DISABLE_SIGNALS=n CONFIG_DISABLE_MQUEUE=n CONFIG_DISABLE_MOUNTPOINT=n CONFIG_DISABLE_ENVIRON=n -CONFIG_DISABLE_POLL=y +CONFIG_DISABLE_POLL=n # # Misc libc settings @@ -782,7 +782,7 @@ CONFIG_FS_WRITEBUFFER=n # CONFIG_MMCSD_HAVECARDDETECT # SDIO driver card detection is 100% accurate # -CONFIG_SDIO_DMA=n +CONFIG_SDIO_DMA=y #CONFIG_SDIO_PRI=128 #CONFIG_SDIO_DMAPRIO #CONFIG_SDIO_WIDTH_D1_ONLY