Jump to content
  • 0

AD3 SPI Breaks I2C


JuanThePawn

Question

I'm using the AD3 WaveForms SDK to try and control some I2C and SPI peripherals. I'm aware of this note in the manual:

The protocols use the Digital-In/Out device resources to create various communication protocols. Only one of the
protocols can be used at a time.

In spite of this note, I thought I would be OK because:

1. My I2C DIOs are different than my SPI DIOs.

2. I don't need to do SPI and I2C simultaneously (or anything close to simultaneously), e.g., my requirement is to do an I2C master write, and then ~100ms later do a SPI master read/write.

In developing my application I have found that I2C works fine, until the moment I call FDwfDigitalSpiWriteRead() (or any SPI Write()/Read() routine, for that matter). After I call FDwfDigitalSpiWriteRead(), all subsequent calls to FDwfDigitalI2CWrite() will error out (pNak = -1).

Do I need to take additional steps to switch between AD3 and I2C protocol functions?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

Hi @attila,

Calling FDwfDigitalI2cClear() is not sufficient to "fix" I2C after a SPI transaction.

Calling FDwfDigitalInReset() and FDwfDigitalOutReset() is sufficient to "fix" I2C (I found references you made to these routines in some other threads).

FDwfDigitalInReset() and FDwfDigitalOutReset() seem like pretty big hammers (I think all DIOs get reset after calling these?), but maybe there is no alternative?

Edited by JuanThePawn
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...