Go Down

Topic: I2c Slave mode. (Read 4662 times) previous topic - next topic

nickgammon


A Morse key are a radio ham?


No, it came with an electronics kit I got for the kids.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

peter224722

Hi Nick, I`m using address 8 for the master on the flyport, so I do know about the shift.

I am triggering the requestEvent !!! , but like I said, I can`t use :-
start ( write address ) , send data , restart ( write address + 1 ) , read data , stop .

I`ve found I need to use :-

start ( write address ) , send data , stop , start ( write address + 1 ) , raed data , stop.
I also needed to add a couple of ms wait between the stop start. 

I`ve got it working now , I`ll see if it still working when I start adding code in requestEvent.

Quote
what it is sending or expecting to receive


I know how the program for the arduino better than for the pic chips , so I`m using it as a co-pro , plus move some load away from the flyport.

The flyport has zero documentation, so been able to use the arduino is a good fall back tool.

nickgammon


Hi Nick, I`m using address 8 for the master on the flyport, so I do know about the shift.


Oh good. It's just your comment that threw me:

Quote
Code: [Select]
  Wire.begin(4);                // join i2c bus with address #2


So you mean "address 8" (or 4, depending on how you look at it).

I'm glad it's working. All you should need to do in the requestEvent is a single Wire.send (). The library handles the rest. Be aware that doing multiple Wire.send will not work properly in a requestEvent. So if you need to send 10 bytes (say) then create a buffer and send that buffer with a single send.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

wayneft

Also any additional code you add to requestEvent will stretch the clock, so if the Flyport doesn't support clock stretching you may have problems.

peter224722

Thanks , so only one Wire.send () , and hope the flyport does clock stretching , which I know it does because I had to make a mod for that to get it to read and write to eeproms.

Thanks again Peter

Go Up