i2c woes
danielstritt
Posts: 43
I was wondering if there was currently an issue I'm not aware of, that prevents I2C from working using PropGCC? Most specifically, I am trying to get a Wii Nunchuck or Classic Controller to work (as in read button states). I am using the Wii Nunchuck and Classic Controller Drivers by Pat Daderko that I downloaded from the object exchange. Basically, I tried to convert them using spin2cpp with the commands --ccode and --main (on the Test*.spin demo files, not the drivers). The only modification to the files is the pin numbers used to communicate over I2c. I am using a Gadget Gangster Quick Player so I changed them from 28/29 to 22/23. In the spin tool, the files run fine. But converted to C it give me garbage values. Then I tried to load the spin file directly in SimpleIDE, and compile the demo file as a spin file. That gave all 0's as the returned values. I even tried writing my own simple code to communicate with the device, but I have little experience with that protocol, so I could have just made a mistake since that didn't work either.
Im sorry about the generallities, I know those never help. But it's late, and ive been working on this issue for days before I realized PropGCC is still considered beta, and maybe this feature isn't working yet.
Any Ideas? I really want to work just in C/C++ on the prop.
Thanks,
Daniel
Im sorry about the generallities, I know those never help. But it's late, and ive been working on this issue for days before I realized PropGCC is still considered beta, and maybe this feature isn't working yet.
Any Ideas? I really want to work just in C/C++ on the prop.
Thanks,
Daniel
Comments
This thread may be useful: http://forums.parallax.com/showthread.php?142296-multi-byte-i2c-with-current-interface-is-it-possible
As for your specific code: can you post what you have, and the outputs? I'm having similar problems (partially garbage values) with a spin2cpp serial object. It might be the same issue from both.
Also, maybe try making it a C++ project (instead of C with --ccode), and see if that works.
-mark
P27/28 can be shared via a some advanced methods.
Eric
nu.c
I noticed the Arduino code for the Nunchuck driver is different, using the i2c address of 0x52, and sending just 2 bytes to handshake (0x40, 0x00), but that never worked for me either.