I2c In Sculpture
This page looks at the issues that I have had and solutions around getting these devices to connect to each other. I'm wanting to use this in sculptures so that I have have many different modules talking to each other. If this cannot be done reliably and over extended long periods then I need to find another solution, not sure what as its a pretty cool feature, but lets see how it goes.
Background Information
1) http://tronixstuff.com/2010/10/20/tutorial-arduino-and-the-i2c-bus/
2) http://www.instructables.com/id/I2C_Bus_for_ATtiny_and_ATmega/
Libraries to use
TinyM library is used on atTin85 and atMega there is a freezing issue.
With and Without External Crystal - two 328s
Aim
The aim is to not have to have the crystal as I want to go for minimal parts.
Experiment
Looking at two 328 working together, seemed to need to have the external crystal on both chips. Not exactly sure why this would be but that is how it is. Or maybe the wait time for returning signal needs to be larger.
notes
1) set fuse to default but without divide but 8 internal clock,
-U lfuse:w:0xff:m -U hfuse:w:0xd9:m -U efuse:w:0xfd:m, ok this work :) do I want to look into this, no not really, tested with new chip. nop still needing external crystal so something not right. OK so I need to change the serial communication speed to be correct. if we don't have external crystal then speed is 1/16 that what it says. Still some strange results, Darn. Master should be working
tried avrdude -c usbtiny -p m328p -U lfuse:w:0xe2:m -U hfuse:w:0xf9:m -U efuse:w:0xff:m
OK bit more searching of the internet and found this link, http://playground.arduino.cc/Main/SoftwareI2CLibrary, looks another library to work in certain situations.
OMG people are suggesting that I get my oscilloscope out and check rise time if I'm connecting from attiny to atmega 16MHz. Do I want to go this far down the rabit hole?
http://dsscircuits.com/articles/arduino-i2c-master-library.html
AP - 20131226 - ok try the i2cMaster library and see how it goes. Looks like it should work on both the 328 and attiny :), although the whole idea of getting i2c working on attiny is having less appeal now as its difficult to figure out where the issues are, but lets see what happens first. ic2Master might work fine. Or I could just eliminate i2c alltogether, certainly the current library has some nice features.Again lets read, time to eat.
Freezing issue
Ok so I looked up the atmega328 with crystal and then loaded in the atTin85 do that it took in the byte added 1 and outputted the result. Keep freezing on them, even had the pull up resistor in place (which didn't seem to make much difference). Here is what a few people have done. I'll investigate if they work shortly
Conclusion 1 - 20131229
Well it looks like the i2c is not as stable as I would like it for sculpture(20140427 - I think this relates to the attiny i2c not i2c in general), really need to test this out in the flesh and see how true and if there are issues in the field. So round 1 I need to design a board that uses 328 and doesn't rely on i2c to drive it. Seems that with a reset all will be good. So back to skinny board design with 328 on it using minimal pins.
Background Information
1) http://tronixstuff.com/2010/10/20/tutorial-arduino-and-the-i2c-bus/
2) http://www.instructables.com/id/I2C_Bus_for_ATtiny_and_ATmega/
Libraries to use
TinyM library is used on atTin85 and atMega there is a freezing issue.
With and Without External Crystal - two 328s
Aim
The aim is to not have to have the crystal as I want to go for minimal parts.
Experiment
Looking at two 328 working together, seemed to need to have the external crystal on both chips. Not exactly sure why this would be but that is how it is. Or maybe the wait time for returning signal needs to be larger.
notes
1) set fuse to default but without divide but 8 internal clock,
-U lfuse:w:0xff:m -U hfuse:w:0xd9:m -U efuse:w:0xfd:m, ok this work :) do I want to look into this, no not really, tested with new chip. nop still needing external crystal so something not right. OK so I need to change the serial communication speed to be correct. if we don't have external crystal then speed is 1/16 that what it says. Still some strange results, Darn. Master should be working
tried avrdude -c usbtiny -p m328p -U lfuse:w:0xe2:m -U hfuse:w:0xf9:m -U efuse:w:0xff:m
OK bit more searching of the internet and found this link, http://playground.arduino.cc/Main/SoftwareI2CLibrary, looks another library to work in certain situations.
OMG people are suggesting that I get my oscilloscope out and check rise time if I'm connecting from attiny to atmega 16MHz. Do I want to go this far down the rabit hole?
http://dsscircuits.com/articles/arduino-i2c-master-library.html
AP - 20131226 - ok try the i2cMaster library and see how it goes. Looks like it should work on both the 328 and attiny :), although the whole idea of getting i2c working on attiny is having less appeal now as its difficult to figure out where the issues are, but lets see what happens first. ic2Master might work fine. Or I could just eliminate i2c alltogether, certainly the current library has some nice features.Again lets read, time to eat.
Freezing issue
Ok so I looked up the atmega328 with crystal and then loaded in the atTin85 do that it took in the byte added 1 and outputted the result. Keep freezing on them, even had the pull up resistor in place (which didn't seem to make much difference). Here is what a few people have done. I'll investigate if they work shortly
- New library - check it out https://github.com/steamfire/WSWireLib
Here is another link, http://forum.arduino.cc/index.php/topic,19624.0.html, which also has code that might do the same thing. Need to check out both to see if they work. - If I remove the fuse to div
Issue here
1) This code needs to be really reliable. Having a system that freezes every so often is no use really.
Conclusion 1 - 20131229
Well it looks like the i2c is not as stable as I would like it for sculpture(20140427 - I think this relates to the attiny i2c not i2c in general), really need to test this out in the flesh and see how true and if there are issues in the field. So round 1 I need to design a board that uses 328 and doesn't rely on i2c to drive it. Seems that with a reset all will be good. So back to skinny board design with 328 on it using minimal pins.