i2c Slave and COG RAM Access
EricGarlic
Posts: 41
Hello from the UK
I would like to use a propeller as an i2c Slave. The propeller then receives data written to it and then performs actions depending on the data that it receives. (I'm relatively new to propeller so any response should be couched in terms suitable for the hard of understanding).
The only i2c Slave object in existing is Hippy's :
forums.parallax.com/forums/default.aspx?f=25&m=263375
[noparse][[/noparse]url]
I can kick off the i2c Slave object in a cog. I can write to that slave (using another propeller and existing i2c master objects). How do I access the data accepted by the slave cog (I guess I'm asking how do I access COG ram data).
Any help appreciated.
Eric
I would like to use a propeller as an i2c Slave. The propeller then receives data written to it and then performs actions depending on the data that it receives. (I'm relatively new to propeller so any response should be couched in terms suitable for the hard of understanding).
The only i2c Slave object in existing is Hippy's :
forums.parallax.com/forums/default.aspx?f=25&m=263375
[noparse][[/noparse]url]
I can kick off the i2c Slave object in a cog. I can write to that slave (using another propeller and existing i2c master objects). How do I access the data accepted by the slave cog (I guess I'm asking how do I access COG ram data).
Any help appreciated.
Eric
Comments
If it's in Cog memory you'll need a mechanism to interact with the Cog and have it place its data in Hub memory so it can be accessed by other Cogs. This is going to interfere with the I2C Bus handling itself so it's not recommended. Having the I2C Slave Cog store its data in Hub is probably the best solution.
Added : Looking at the demo code you will find this to start a 16Kx8 RAM, based at $4000 in hub memory ...
i2c_Slave.Start( SCL_PIN, SDA_PIN, DEVICE_ID, $4000, 16*1024 )
You can use @MyArray to supply an array base address instead of $4000, and the array size can be any power of two, so ...
The AiChip_I2cSlave_Slave object uses 1KB of Cog regardless so it's necessary to delete the two lines at ":SaveByteToHub" and the two lines at ":LoadByteFromHub".
It's been a while since I used or looked at the code so apologies if I've remembered anything wrong. Shout if you need any further help.
Post Edited (hippy) : 10/24/2008 8:12:38 PM GMT
No joy. Here is my Master and Slave code respectively, in case I've done something daft.
Additional (I've re-edit (cut-n-paste) but the code is not looking so good when I paste onto the forum - sorry)
I've got to put the nippers to bed now so a reply isn't urgent.
Post Edited (EricGarlic) : 10/24/2008 9:10:44 PM GMT
did you ever get this figured out? I am working on the same thing and would love to avoid any wheel inventing.
thx
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Searider
Nope. Too busy at work and with the kids to get back to the bench. Give it go and post your findings. Good luck
Eric
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Searider
Eric
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Searider