![]() |
Forum Index : Microcontroller and PC projects : Help needed for I2C-slave command
![]() ![]() |
|||||
Author | Message | ||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
No, both I2C_Rcv_Tail and I2C_Rcv_Head addresses will vary with each compile. It seems that I will have to build a test system and dig further into this. Unfortunately it will have to wait until I am back in a couple of months. Geoff Geoff Graham - http://geoffg.net |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6284 |
No problems Geoff. We can easily flush the buffer to make sure the problem doesn't cause grief. Jim VK7JH MMedit |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
Hi TassyJim and FrankNFurter, Have you come to any final conclusions on this I2C thing? I have designed this into a project to use a uMite as I2C slave to another uMite master to expand a few ports and am worried that this is not working as expected. Is it necessary to flush the receive buffer or does the open and close do that? FrankNFurter, I am especially interested in what you are doing as it sounds similar to my application. Are you having any better results yet? Thanks a million!!!! |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6284 |
Jim, I would feel confident with using the I2C SLAVE commands. There are two things to remember. 1. If you don't issue the I2C SLAVE CLOSE command, the master will not know that the slave is not responding. You could add code to send a 'reply'. This should only be a problem if the slave falls over. 2. Whenever the I2C SLAVE OPEN is issued, apart form the initial startup, there will be extra data in the receive buffer which needs to be flushed. How you do this depends on what format your data is in. ie fixed length or random length data would need to be handled differently. You are not able to flush this extra data until the first RECEIVE interrupt occurs so the first data after a fault may have to be discarded. The problem sounds easy to fix but because it is closely intermingled with the MASTER and sending code, a quick fix may not be a good idea. Jim VK7JH MMedit |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
Hi TassyJim, In my application, the master will be sending the slave only 1 byte as a command, so when I send to slave, should I anticipate that I need to flush 1 byte from the buffer prior to reading the next data byte? or should I do a major flushing like a few bytes and then read the data? Thanks for your help!!! |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |