Pages: 1 [2]   Go Down
Author Topic: I2c Slave mode.  (Read 2489 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Offline Offline
Brattain Member
*****
Karma: 503
Posts: 19091
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A Morse key are a radio ham?

No, it came with an electronics kit I got for the kids.
Logged


Sheffield --- UK --
Offline Offline
Sr. Member
****
Karma: 0
Posts: 377
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 503
Posts: 19091
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
  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.
Logged


Worcester, MA
Offline Offline
God Member
*****
Karma: 3
Posts: 623
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

Sheffield --- UK --
Offline Offline
Sr. Member
****
Karma: 0
Posts: 377
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Pages: 1 [2]   Go Up
Jump to: