Discuz! Board

标题: 51822跑s110时进行IIC读操作出现了HardFault_Handler故障 [打印本页]

作者: 钟HL    时间: 2016-2-19 16:20
标题: 51822跑s110时进行IIC读操作出现了HardFault_Handler故障
请教大家:51822跑s110时,使用twi_master_transfer()进行IIC读操作出现了HardFault_Handler故障。
前提:在初始化时进行读操作并未出现异常。
而在按键事件处理button_event_handler()函数中进行读操作就会发生上述故障!
希望大神指教!
作者: zzz7794672    时间: 2016-3-4 17:25
我用官方的5.1版本的SDK也遇到过这种问题,后来改成10.0版本的SDK就解决了,所以如果你还是用老版本的SDK就赶紧升级吧。
作者: armM0    时间: 2016-4-18 19:36
本帖最后由 armM0 于 2016-4-18 19:38 编辑

顶。我的也是。我使用的是硬件方式,不是IO口模拟IIC时序的。
在nRF51寄存器说明书v3.0.pdf第145页,
28.3 Shared resources
The TWI shares registers and other resources with other peripherals that have the same ID as the TWI.
Therefore, you must disable all peripherals that have the same ID as the TWI before the TWI can be
configured and used. Disabling a peripheral that has the same ID as the TWI will not reset any of the
registers that are shared with the TWI. It is therefore important to configure all relevant TWI registers
explicitly to secure that it operates correctly.
The Instantiation table in Instantiation on page 17 shows which peripherals have the same ID as the TWI.
17页:
ID Base address  Peripheral    Instance     Description
4 0x40004000   SPI        SPI1      SPI master 1
4 0x40004000   SPIS       SPIS1      SPI slave 1
4 0x40004000   TWI       TWI1      Two-wire interface master 1

以上说明twi和spi共用一个ID,请教各位:如何禁用SPI,SPIS,只保留TWI的ID?




欢迎光临 Discuz! Board (http://qfv8.com/) Powered by Discuz! X3