9
0
Fork 0

STM32 SDIO DMA: Ignore DMA FIFO errors; these seem to be bogus. SD multiple block transfers result in CRC errors; avoid them by using smaller FTP buffer sizes

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4410 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-02-21 22:00:28 +00:00
parent 738e9f2cfd
commit 3207ae4731
10 changed files with 72 additions and 40 deletions

View File

@ -2,7 +2,7 @@
* apps/include/netutils/ftpd.h
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -61,9 +61,9 @@
* CONFIG_FTPD_SERVERID - The server name to use in FTP communications.
* Default: "NuttX FTP Server"
* CONFIG_FTPD_CMDBUFFERSIZE - The maximum size of one command. Default:
* 512 bytes.
* 128 bytes.
* CONFIG_FTPD_DATABUFFERSIZE - The size of the I/O buffer for data
* transfers. Default: 2048 bytes.
* transfers. Default: 512 bytes.
* CONFIG_FTPD_WORKERSTACKSIZE - The stacksize to allocate for each
* FTP daemon worker thread. Default: 2048 bytes.
*/
@ -85,11 +85,11 @@
#endif
#ifndef CONFIG_FTPD_CMDBUFFERSIZE
# define CONFIG_FTPD_CMDBUFFERSIZE 512
# define CONFIG_FTPD_CMDBUFFERSIZE 128
#endif
#ifndef CONFIG_FTPD_DATABUFFERSIZE
# define CONFIG_FTPD_DATABUFFERSIZE 2048
# define CONFIG_FTPD_DATABUFFERSIZE 512
#endif
#ifndef CONFIG_FTPD_WORKERSTACKSIZE

View File

@ -4923,10 +4923,10 @@ build
<code>CONFIG_FTPD_SERVERID</code>: The server name to use in FTP communications. Default: "NuttX FTP Server"
</li>
<li>
<code>CONFIG_FTPD_CMDBUFFERSIZE</code>: The maximum size of one command. Default: 512 bytes.
<code>CONFIG_FTPD_CMDBUFFERSIZE</code>: The maximum size of one command. Default: 128 bytes.
</li>
<li>
<code>CONFIG_FTPD_DATABUFFERSIZE</code>: The size of the I/O buffer for data transfers. Default: 2048 bytes.
<code>CONFIG_FTPD_DATABUFFERSIZE</code>: The size of the I/O buffer for data transfers. Default: 512 bytes.
</li>
<li>
<code>CONFIG_FTPD_WORKERSTACKSIZE</code>: The stacksize to allocate for each FTP daemon worker thread. Default: 2048 bytes.

View File

@ -1,4 +1,4 @@
NuttX TODO List (Last updated February 12, 2012)
NuttX TODO List (Last updated February 21, 2012)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file summarizes known NuttX bugs, limitations, inconsistencies with
@ -31,7 +31,7 @@ nuttx/
(2) ARM/LPC313x (arch/arm/src/lpc313x/)
(3) ARM/STR71x (arch/arm/src/str71x/)
(3) ARM/LM3S6918 (arch/arm/src/lm3s/)
(5) ARM/STM32 (arch/arm/src/stm32/)
(7) ARM/STM32 (arch/arm/src/stm32/)
(3) AVR (arch/avr)
(0) Intel x86 (arch/x86)
(4) 8051 / MCS51 (arch/8051/)
@ -1143,6 +1143,30 @@ o ARM/STM32 (arch/arm/src/stm32/)
Status: Open
Priority: Medium
Title: F4 SDIO MULTI-BLOCK TRANSFER FAILURES
Description: If you use a large I/O buffer to access the file system, then the
MMCSD driver will perform multiple block SD transfers. With DMA
ON, this seems to result in CRC errors detected by the hardware
during the transfer. Workaround: Use I/O buffers less the 1024
bytes.
Status: Open
Priority: Medium
Title: DMA BOUNDARY CROSSING
Description: I see this statement in the reference manual: "The burst
configuration has to be selected in order to respect the AHB protocol,
where bursts must not cross the 1 KB address boundary because the
minimum address space that can be allocated to a single slave
is 1 KB. This means that the 1 KB address boundary should not be crossed
by a burst block transfer, otherwise an AHB error would be generated,
that is not reported by the DMA registers."
The implication is that there may be some unenforced alignment
requirements for some DMAs. There is nothing in the DMA driver to
prevent this now.
Status: Open
Priority: Low (I am not even sure if this is a problem yet).
o AVR (arch/avr)
^^^^^^^^^^^^^^

View File

@ -60,13 +60,13 @@
*/
#if defined(CONFIG_STM32_STM32F10XX)
# define DMA_STATUS_FEIF 0
# define DMA_STATUS_DMEIF 0
# define DMA_STATUS_FEIF 0 /* (Not available in F1) */
# define DMA_STATUS_DMEIF 0 /* (Not available in F1) */
# define DMA_STATUS_TEIF DMA_CHAN_TEIF_BIT /* Channel Transfer Error */
# define DMA_STATUS_HTIF DMA_CHAN_HTIF_BIT /* Channel Half Transfer */
# define DMA_STATUS_TCIF DMA_CHAN_TCIF_BIT /* Channel Transfer Complete */
#elif defined(CONFIG_STM32_STM32F40XX)
# define DMA_STATUS_FEIF DMA_STREAM_FEIF_BIT /* Stream FIFO error */
# define DMA_STATUS_FEIF 0 /* Stream FIFO error (ignored) */
# define DMA_STATUS_DMEIF DMA_STREAM_DMEIF_BIT /* Stream direct mode error */
# define DMA_STATUS_TEIF DMA_STREAM_TEIF_BIT /* Stream Transfer Error */
# define DMA_STATUS_HTIF DMA_STREAM_HTIF_BIT /* Stream Half Transfer */

View File

@ -188,26 +188,7 @@
# define SDIO_TXDMA32_CONFIG (CONFIG_SDIO_DMAPRIO|DMA_CCR_MSIZE_32BITS|\
DMA_CCR_PSIZE_32BITS|DMA_CCR_MINC|DMA_CCR_DIR)
/* STM32 F4 stream configuration register (SCR) settings.
*
* Hmmm... I see conflicting statements in the Reference Manual. In the DMA
* section it says:
* "Note: The Burst mode is allowed only when incremetation is enabled:
* When the PINC bit is at 0, the PBURST bits should also be cleared to 00
* When the MINC bit is at 0, the MBURST bits should also be cleared to 00."
*
* But in the SDIO section it says:
*
* "4. Configure the DMA2 as follows:
* ...
* c) Program DMA2_Stream3 or DMA2_Stream6 Channel4 control register
* (memory increment, not peripheral increment, peripheral and source
* width is word size).
* ...
* e) Configure the incremental burst transfer to 4 beats (at least from
* peripheral side)..."
*/
/* STM32 F4 stream configuration register (SCR) settings. */
#elif defined(CONFIG_STM32_STM32F40XX)
# define SDIO_RXDMA32_CONFIG (DMA_SCR_PFCTRL|DMA_SCR_DIR_P2M|DMA_SCR_MINC|\

View File

@ -676,11 +676,14 @@ void stm32_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr,
* case, a FIFO error (flag FEIFx of the DMA_HISR or DMA_LISR register) will be
* generated when the stream is enabled, then the stream will be automatically
* disabled."
*
* NOTE: The FEIFx error interrupt is not enabled because the FEIFx seems to
* be reported spuriously causing good transfers to be marked as failures.
*/
regval = dmast_getreg(dmast, STM32_DMA_SFCR_OFFSET);
regval &= ~(DMA_SFCR_FTH_MASK | DMA_SFCR_FS_MASK);
regval |= (DMA_SFCR_FTH_FULL | DMA_SFCR_DMDIS | DMA_SFCR_FEIE);
regval &= ~(DMA_SFCR_FTH_MASK | DMA_SFCR_FS_MASK | DMA_SFCR_FEIE);
regval |= (DMA_SFCR_FTH_FULL | DMA_SFCR_DMDIS);
dmast_putreg(dmast, STM32_DMA_SFCR_OFFSET, regval);
/* "Configure data transfer direction, circular mode, peripheral & memory

View File

@ -953,9 +953,9 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_FTPD_SERVERID - The server name to use in FTP communications.
Default: "NuttX FTP Server"
CONFIG_FTPD_CMDBUFFERSIZE - The maximum size of one command. Default:
512 bytes.
128 bytes.
CONFIG_FTPD_DATABUFFERSIZE - The size of the I/O buffer for data
transfers. Default: 2048 bytes.
transfers. Default: 512 bytes.
CONFIG_FTPD_WORKERSTACKSIZE - The stacksize to allocate for each
FTP daemon worker thread. Default: 2048 bytes.

View File

@ -737,6 +737,28 @@ Where <subdir> is one of the following:
Then DMA works fine. The downside is, of course, is that we lose 64Kb
of precious SRAM.
5. Another SDIO/DMA issue. This one is probably a software bug. This is
the bug as stated in the TODO list:
"If you use a large I/O buffer to access the file system, then the
MMCSD driver will perform multiple block SD transfers. With DMA
ON, this seems to result in CRC errors detected by the hardware
during the transfer. Workaround: Use I/O buffers less the 1024
bytes."
For this reason, CONFIG_FTPD_DATABUFFERSIZE=512 appears in the defconfig
file.
6. Another DMA-related concern. I see this statement in the reference
manual: "The burst configuration has to be selected in order to respect
the AHB protocol, where bursts must not cross the 1 KB address boundary
because the minimum address space that can be allocated to a single slave
is 1 KB. This means that the 1 KB address boundary should not be crossed
by a burst block transfer, otherwise an AHB error would be generated,
that is not reported by the DMA registers."
There is nothing in the DMA driver to prevent this now.
ostest:
------
This configuration directory, performs a simple OS test using

View File

@ -864,9 +864,9 @@ CONFIG_NET_RESOLV_ENTRIES=4
# CONFIG_FTPD_SERVERID - The server name to use in FTP communications.
# Default: "NuttX FTP Server"
# CONFIG_FTPD_CMDBUFFERSIZE - The maximum size of one command. Default:
# 512 bytes.
# 128 bytes.
# CONFIG_FTPD_DATABUFFERSIZE - The size of the I/O buffer for data
# transfers. Default: 2048 bytes.
# transfers. Default: 512 bytes.
# CONFIG_FTPD_WORKERSTACKSIZE - The stacksize to allocate for each
# FTP daemon worker thread. Default: 2048 bytes.
#
@ -876,6 +876,7 @@ CONFIG_NET_RESOLV_ENTRIES=4
# CONFIG_DISABLE_PTHREAD - pthread support is required
# CONFIG_DISABLE_POLL - poll() support is required
#
CONFIG_FTPD_CMDBUFFERSIZE=512
#
# RTC Configuration

View File

@ -865,9 +865,9 @@ CONFIG_NET_RESOLV_ENTRIES=4
# CONFIG_FTPD_SERVERID - The server name to use in FTP communications.
# Default: "NuttX FTP Server"
# CONFIG_FTPD_CMDBUFFERSIZE - The maximum size of one command. Default:
# 512 bytes.
# 128 bytes.
# CONFIG_FTPD_DATABUFFERSIZE - The size of the I/O buffer for data
# transfers. Default: 2048 bytes.
# transfers. Default: 512 bytes.
# CONFIG_FTPD_WORKERSTACKSIZE - The stacksize to allocate for each
# FTP daemon worker thread. Default: 2048 bytes.
#
@ -877,6 +877,7 @@ CONFIG_NET_RESOLV_ENTRIES=4
# CONFIG_DISABLE_PTHREAD - pthread support is required
# CONFIG_DISABLE_POLL - poll() support is required
#
CONFIG_FTPD_CMDBUFFERSIZE=512
#
# RTC Configuration