XMMC and i2c
blindstar
Posts: 12
I am having a good time playing with the Propeller GCC beta. I’ve been trying to make use of the XMMC memory model. I am using a C3 board and SimpleIDE 0-8-5 for OSX.
The cog_c_toggle demo works if I set the SimpleIDE memory model to XMMC and the board type C3-SDXMMC or C3F-SDXMMC. However if I take a working C program (compiled for LMM) that is reading a DS1307 RTC using the i2c buss and compile it using the same parameters it hangs on the “i2c_open();” Should the i2c functions work in XMMC?
Thanks.
Mark
The cog_c_toggle demo works if I set the SimpleIDE memory model to XMMC and the board type C3-SDXMMC or C3F-SDXMMC. However if I take a working C program (compiled for LMM) that is reading a DS1307 RTC using the i2c buss and compile it using the same parameters it hangs on the “i2c_open();” Should the i2c functions work in XMMC?
Thanks.
Mark
Comments
If you're using the SD to store XMMC memory then the XMM driver will be accessing the i2c bus. This is could be a problem. I'm not familiar enough with the internal workings of the XMM drivers and i2c code to be able to say whether there is any way to make the combination work.
Will your code fit in hub memory in CMM mode?
Eric
When you say you're using i2c_open, do you mean i2cOpen? I'm not familiar with i2c_open.
Thanks,
David
Thanks for your help.
The problem with XMMC running from EEPROM is that it uses I2C for fetching code. This can result in a conflict with other devices that use I2C.
One way around this problem is to prepend all of the I2C functions with: HUBTEXT
I.E:
HUBTEXT void RTCread(I2C *bus, uint8_t *bptr)
{
...
}
HUBTEXT will cause any such function to live in HUB RAM so that the I2C bus is not used for fetching code while the I2C is being accessed.
The functions RTCread, i2cRead, i2cWrite, and maybe gettime are all candidates for being HUBTEXT.
The call that is failing is i2cBootOpen, the i2c_open is my wrapper - sorry. This does not seem to change the behavior. I'm wondering if I should open an i2c bus on different pins? I have been using 28/29 with i2CBootOpen.
Thanks for the comments.
Below is a very simple attempt to open the i2c buss on pins 28/29. I got rid of all the DS1307 stuff. All it does is a i2cOpen. It works fine complied with LMM, but it never returns from the i2cOpen if I use XMMC. I get the same result using i2cBootOpen.
What should the last parameter of the i2cOpen be? I found an example that used 400000 so that is what I tried. Is there something that I should be reading to get more background? Thanks for trying to help me out.
mark