I2C SPI USB CAN eSPI Cable Testing View All Videos Quick Start Guides Software Downloads App Notes White Papers User Manuals Knowledge Base Sales Support About Us
Products Blog Sales Support Contact Search
I enabled the I2C or SPI slave and started receiving messages Now I try to disable the slave and I receive an status code of AA COMMUNICATION ERROR Why can t I disable the slave Is this a bug
I enabled the I2C or SPI slave and started receiving messages. Now I try to disable the slave and I receive an status code of AA_COMMUNICATION_ERROR. Why can't I disable the slave? Is this a bug?

No, there is most likely a master sending large amounts of data and thereby saturating the host PC receive buffer for this Aardvark I2C/SPI Host Adapter. The communication error signifies that, while the PC sent the disable request to the slave, an acknowledgment from the Aardvark adapter was not received. In most cases, the slave was probably disabled regardless. If the Aardvark adapter did in fact disable the slave, there will be no more incoming data to saturate the link. A subsequent call to disable the slave should return without error.

While this is not necessarily a critical problem in your code, you can improve the situation in a number of ways. One is to reduce the amount of traffic that is sent by the master. This will require the ability to reconfigure the offending master device. Another option is to more regularly poll the slave to obtain any pending asynchronous messages. Keep in mind that each call to read pending messages can have a timeout of up to 500 ms. Therefore, if there is other time critical code that must be executed simultaneously, it is best to employ a threading model. (Aardvark adapter API calls are not thread-safe, but can be used if wrapped by appropriate thread synchronization calls.)

For the most performance critical development environments, it is advisable to use two Aardvark adapters. One Aardvark adapter can be setup to receive the asynchronous I2C/SPI slave messages and the other can be used for synchronous I2C/SPI master communication. With this setup, one thread in the application can execute a tight loop to process the slave messages and another thread can process synchronous operations.