Hi fellow campers, I am having some difficulty getting two 28x2's (5 volt) to chat with each other using I2C. Picaxe #1 is going to be set up to monitor water flow pulses (5 of them) and record to the scratchpad the cumulative flows (in liters, about 330 pulses per liter), as well as instantaneous sensor data (4-20ma), all of which will sit in scratchpad memory. The program will also occasionally read a value from the scratchpad, and will turn on/off a couple of digital outs based on the value in the scratchpad.
OK, a second picaxe 28x2 is being programmed to simulate what will eventually be a netduino or similar device operating about 100 feet away from the above picaxe. I want to use I2c between these, along with RS-422 adaptors at each end due to the distance involved (I beleive you can run I2C on an Rs-422 transmission system from what I can understand).
So, for now, I just want to get basic I2C up and running between the two 28X2's just to test communications etc. I set picaxe #2 as an I2CMaster, i2cslow speed, and set the adress to %1010000. I also programmed Picaxe#1 to I2cslave, i2cslow, same address, and that was about it for that one. I started with both pic's running at 64mhz using an external 16mhz oscillator. I have pwm'ed out signals from both pics to confirm that the oscillator is working correctly.
I also have a logic analyser, so I can sniff the I2C line and see what's happening, using a "Lab Nation" analyser, in digital mode using I2C protocol, works really well.
So with both Pic's running, I can see picaxe # 2 sending out the first I2c command which is to read from picaxe#1's scratchpad. I can see the start of the I2C's transaction, with the correct address, %1010000, but picaxe#1 does not alknowlege the transmission. (The analyser shows "NACK", not "ACK").
Both Pic's are set to the same I2C address, I have tried it runing both pic's at 64 mhz (they share the same oscillator running at 16 mhz, the 28x2 runs at 4x the external oscillator, "setfreq em64"), and I have also tried running the 28x2's at their default 8mhz. I have also tried runing i2cslow and i2cfast, all scenarios without any alknowlegement from picaxe #1.
Are there any specific timing issues or constraints when using I2C with the 28x2 picaxes that I am not aware of? I am hoping to run the 28x2 at the full 64 mhz so it can reliably read and process the water flow pulses, and I am hoping that the i2c bus will run properly at either i2cslow or i2cfast (100khz or 400 khz) with the pic running at 64mhz. Any ideas on why #1 is not alknowleging the I2C transaction would be appreciated.
OK, a second picaxe 28x2 is being programmed to simulate what will eventually be a netduino or similar device operating about 100 feet away from the above picaxe. I want to use I2c between these, along with RS-422 adaptors at each end due to the distance involved (I beleive you can run I2C on an Rs-422 transmission system from what I can understand).
So, for now, I just want to get basic I2C up and running between the two 28X2's just to test communications etc. I set picaxe #2 as an I2CMaster, i2cslow speed, and set the adress to %1010000. I also programmed Picaxe#1 to I2cslave, i2cslow, same address, and that was about it for that one. I started with both pic's running at 64mhz using an external 16mhz oscillator. I have pwm'ed out signals from both pics to confirm that the oscillator is working correctly.
I also have a logic analyser, so I can sniff the I2C line and see what's happening, using a "Lab Nation" analyser, in digital mode using I2C protocol, works really well.
So with both Pic's running, I can see picaxe # 2 sending out the first I2c command which is to read from picaxe#1's scratchpad. I can see the start of the I2C's transaction, with the correct address, %1010000, but picaxe#1 does not alknowlege the transmission. (The analyser shows "NACK", not "ACK").
Both Pic's are set to the same I2C address, I have tried it runing both pic's at 64 mhz (they share the same oscillator running at 16 mhz, the 28x2 runs at 4x the external oscillator, "setfreq em64"), and I have also tried running the 28x2's at their default 8mhz. I have also tried runing i2cslow and i2cfast, all scenarios without any alknowlegement from picaxe #1.
Are there any specific timing issues or constraints when using I2C with the 28x2 picaxes that I am not aware of? I am hoping to run the 28x2 at the full 64 mhz so it can reliably read and process the water flow pulses, and I am hoping that the i2c bus will run properly at either i2cslow or i2cfast (100khz or 400 khz) with the pic running at 64mhz. Any ideas on why #1 is not alknowleging the I2C transaction would be appreciated.