I am using an ALFAT-SDR 1.2 card and I have connected it to my host via I2C. I have been able to set the interface mode and then read the banner out of the Alfat processor. Once I have completed that though, I cannot send a command and receive a valid “!00”.
Is there a definitive I2C timing diagram or bit chart to tell me exactly how I should be querying the device?
To read the banner,
I set the start bit for I2c
I write 0xA4 + 1 to the processor
wait for the transmit to finish and look for an Acknowledge from the part
I then read the part in a loop until the data read 0, which means the part has no more data to give, I think.
After the last byte of data, I send a NACK
then send a Stop.
The buffer I gather the banner in reads perfectly every time.
Then I try to send the initialization command: "I M:\n"
Set the start bit
Write the 0xA4 address
wait for the ACK
I then write each individual character of the command (I tried writing it as a string but after getting no where I broke it down to individual chars)
wait for the ACK after each char
restart the I2C
then use the same function as I did for reading the banner. I do not get the correct response. (Although I think once or twice out of 100 times I got the correct answer, though it could have just been the fog of failure playing tricks with my eyes).
So is there somewhere I can get a definitive routine for all the I2C bits and when they should be used?
Thanks for the help.