- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am in the process of developing communication between a Master device and a Slave device. In my Slave device code, I started off with having the I2C in the main() (polling). After several communication tests, I found that this is not desirable for my project. I then researched on I2C interrupt driven. The code I have attached is currently I2C interrupt driven but may not be implemented correctly. I have found results where my devices "hang" and don't respond to a command. I want to make sure that the slave receives the entire message from the Master, executes the command, and can safely receive the next command. Any help is appreciated.
Thank you,
Rick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Bob,
I'm not sure this is related to a hardware issue. My project use to work when my i2c code was in the main() (polling.). Now that it is in the intterupt handler, the program hangs. Do you know if this is the correct way to call the interrupt for an I2C?
Thanks,
Rick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, my above post was misplaced and was an answer to a complete different thread. That should happen to my bank-account 😉
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not a problem. Happens to the best of us haha...
Would you happen to know how to properly construct an I2C interrupt?
Rick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What I would ask first (assuming it is a slave) "What will I be interrupted for?" When it is a simple read-one-byte-application the information to be returned can be set up in advance, so I must only be informed when the master has finished reading.
I would use the macro callback feature (Did you already update to Creator last version) and try to analyze the state the I2C is in.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Slave is intended for turning on LEDS and reading in various sensors which is why i went with I2C Interrupt instead of Polled I2C. My problem is properly writing the I2C interrupt. I have attached the project to this post if you would like to take a look.
Thanks,
Rick