Oleg, You are most welcome,
Did you adjust the size of the board dma allocator? https://github.com/PX4/PX4-Autopilot/blob/1dd6b6a5058199ea6bbf1e2321010abe88a656ee/platforms/nuttx/src/px4/common/board_dma_alloc.c#L57? -----Original Message----- From: Oleg Evseev [mailto:ev.m...@gmail.com] Sent: Wednesday, November 25, 2020 12:46 AM To: dev@nuttx.apache.org Subject: Re: STM32F4 SPI DMA buffer size issue Thanks for the enhanced feedback, David! When I reduced the slew rate control from 50MHz to 2MHz it fixes issues with a SD card when DMA is not enabled. But when DMA is enabled, MTD and SD still are attached and mounted, but are empty, as I see on block reads - px4 successfully reads mtd_params files, but it is empty. SD content also empty, ls shows only created empty log dir on boot, but can't store anything (for example on echo - "No such file or directory"). I turned off all uart DMA just in case, but it didn't help. вт, 24 нояб. 2020 г. в 21:45, David Sidrane <david.sidr...@nscdg.com>: > Hi Oleg, > > See inline [DBS] > > David > -----Original Message----- > From: Oleg Evseev [mailto:ev.m...@gmail.com] > Sent: Tuesday, November 24, 2020 9:46 AM > To: dev@nuttx.apache.org > Subject: Re: STM32F4 SPI DMA buffer size issue > > > Have you scoped the interface? > > You mean a bus by analyzer? No, I don't have such ability for now. > > [DBS] Use an oscilloscope, but with a high speed FET probe. You may see > incredible overshoot, when DMA is on. > > > For SD card I tried to reduce the SPI frequency from 24MHz to 10MHz, but > it > didn't help when DMA is enabled. In fact it get failed to find a valid > boot > record, while fat_hwread of sector zero is returned without errors. > > > [DBS] By drive strength I mean the slew rate control not frequency > > See > > https://github.com/PX4/PX4-Autopilot/blob/master/boards/px4/fmu-v6x/nuttx-config/include/board.h#L411-L431 > For an eample. > > The other strange thing I found out, is that when *DMA is not used*, SD > can't be used after mounting on boot. If I go through breakpoints in stm32 > spi_setfrequency for example it get mounted ok and ls shows SD content. > It's hard to understand what is going on because it seems that debug > influence on the result. While debugging I saw the case when SD get > mounted > but than on mkdir of log folder reading mmcsd_geometry get failed in > mmcsd_getcsd or mkdir success, but log dir is the only one thing on SD > while it is not empty. > > In this case (without DMA) reducing SPI frequency from 24MHz to 20MHz > seems > to fix the problem (but maybe it depends on delays and may appear again > once there will be more commands on boot for instance, I don't know). > > Quite a strange behaviour for now. > > вт, 24 нояб. 2020 г. в 17:12, David Sidrane <david.sidr...@nscdg.com>: > > > Oleg, > > > > Have you scoped the interface? > > > > For gins and giggles try reducing the SPI clock drive strength. Step it > > down > > and retest. > > > > David > > > > -----Original Message----- > > From: Oleg Evseev [mailto:ev.m...@gmail.com] > > Sent: Tuesday, November 24, 2020 4:57 AM > > To: dev@nuttx.apache.org > > Subject: STM32F4 SPI DMA buffer size issue > > > > Hi all, > > > > STM32f405rg custom board - MTD on SPI1 and SD card on SPI2. > > > > MTD on SPI1 works without DMA and with if defined > > CONFIG_STM32_SPI1_DMA=y > > > > but if also > > CONFIG_STM32_SPI1_DMA_BUFFER=1024 > > is set, partitions get created, there are mtdblockX in /dev, geometry > > can > > be read correctly, but reading or writing hangs up. > > As I see in map g_spi1_rxbuf, g_spi1_txbuf are in SRAM, not in CCM. > > > > Same with SD card. If defined CONFIG_STM32_SPI2_DMA_BUFFER=1024 there is > > still /dev/mmcsd device, it gets mounted, but ls /fs/microsd shows no SD > > content. > > > > CONFIG_STM32_SPI_DMATHRESHOLD=8 > > > > What can be a problem? Thanks in advance for help! > > > > --- > > With regards, Oleg. > > >