技术服务你好!
我现在遇到一个比较棘手的问题,我在PXP工程新建了一个任务。任务里面同时使用了I2C和SPI端口,并且每隔一段时间就读取两个端口设备。但是这个新建的任务总会遇到不运行的时候,现在我不知道从哪里下手解决。谢谢!
空白User_APP(空白)
{
static unsigned char TX[10];
static unsigned char RX[16];
i2c_device I2C_dev;
spi_device SPI_dev;
port_init ();
demo_i2c_init ();
SPI1_init ();
Setup_breath (0, 255, 255, 255);
I2C_dev = ad_i2c_open (M41T62);
TX [0] = 0 x04;
TX [1] = 0 x92;
ad_i2c_write (I2C_dev TX 2);
TX [0] = 0 x0a;
TX [1] = 0 x40;
ad_i2c_write (I2C_dev TX 2);
ad_i2c_close (I2C_dev);
而(1)
{
TX [0] = 0;
I2C_dev = ad_i2c_open (M41T62);
ad_i2c_write (I2C_dev TX 1);
ad_i2c_read (I2C_dev RX 7);
ad_i2c_close (I2C_dev);
OS_DELAY (50);
SPI_dev = ad_spi_open (ADXL362);
TX [0] = 0 x0b;
TX [1] = 0 x01;
ad_spi_write (SPI_dev TX 2);
RX [0] = 0;
ad_spi_read (SPI_dev RX 1);
/ / ad_spi_transact (RX SPI_dev TX 2, 1);
ad_spi_close (SPI_dev);
OS_DELAY (50);
}
}
星期四,2017-01-12 00:59
#1
AD14680 PXP工程总是出现死机问题。
设备:
你可能没有正确配置调用I2C功能
参考对比一下项目\ dk_apps \ demo \ peripherals_demo \ demo \ demo_i2c_async.c看看是否有帮助