Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:32 29 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Help needed for I2C-slave command

     Page 2 of 2    
Author Message
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3196
Posted: 06:18pm 08 May 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 6102
Posted: 07:52pm 08 May 2014
Copy link to clipboard 
Print this post

No problems Geoff.
We can easily flush the buffer to make sure the problem doesn't cause grief.

Jim


VK7JH
MMedit   MMBasic Help
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 05:08am 10 May 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 6102
Posted: 02:17pm 10 May 2014
Copy link to clipboard 
Print this post

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   MMBasic Help
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 03:47pm 10 May 2014
Copy link to clipboard 
Print this post

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!!!
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024