STM32F103xCDE系列的FSMC多主访问冲突的bug相关描述和避免方法

下面是一位外国友人使用中的问题:

Hi,
I experience problems with the DMA and SPI. I want to send data from a buffer stored in external memory to SPI1. The external memory ist 16Bit wide and the SPI1 is configured to send 8Bits. I set up the DMA1-Channel3 for transmitting the data with 8bit width from the ext mem to the spi. Every time I enable the DMA to start transmission, the mcu catches a bus fault exception.

What is wrong? I red on some forums that the DMA is not able to transfer data from external memory, is that true?! It would make the DMA useless for most cases.
In the datasheet, under DMA features, is written:
- Access to Flash, SRAM, peripheral SRAM, APB1, APB2 and AHB peripherals as
source and destination

The external memory is connected to the FSMC, and the FSMC is a peripheral of the AHB. So I would say the DMA must be able to access external memorys. How can I find the fault, when experiencing a bus fault exception?
最后发现问题所在:
ask:Ok now I tried to transfer a buffer from external to internal SRAM and that does not work. Then I tried a transfer from internal to internal SRAM and that works fine. Transfer from external to external SRAM does not work.

It seems that the access of the external SRAM by the DMA causes the bus fault exception, but why?
answer:
Look up point 2.12 in Errata - FSMC multimaster access. Only one master can access FSMC at any given time.

and then:

Yeah thanks, I found that out yesterday evening too. That was the point where I resignated and decided to use NXP next time!

The Bug seems to be found in 2008 and is still in the newest revisions of the chip! I do not think that they will ever fix this within a reasonable time. So the DMA of this device is just useless for bigger designs with external components. The workaround is risible, who wants to use a DMA and then stop the cpu from working because it not allowed to access the same resources like the DMA!?
以下是一些解决办法:
来自21ic的:
作者: 香水城    时间: 2009-11-25 13:36

谢谢LZ的支持。

根据我的经验,要修正这个Bug,需要做较大的改动,要花不少时间,结果怎样也很难预料。

对于你的应用,建议通过2个办法绕过这个Bug,1)使用内部RAM作为DMA的缓冲区,2)在DMA传送数据到外部RAM时,限制程序只访问内部RAM,或执行WFI、WFE指令等待DMA完成。

当然,如果在DMA传送出错时能够重传数据,并且在碰到这个Bug而进入错误异常时能够通过软件恢复,则可以更高效的工作。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值