I am trying to interface a Wii nunchuk to a ConnectBlue OEMSPA311 bluetooth module. It's not quite working, and I could use some suggestions.
First, here is my set up:
This ConnectBlue module is typically used as an rs232 to bluetooth adapter, but ConnectBlue offers firmware to use it for i2c. I'm using this firmware.
The Wii nunchuk uses i2c, and many people have connected their microcontrollers to it successfully.
I am using my own windows program on my bluetooth enabled laptop to communicate to the ConnectBlue module.
I have a digital compass IC that uses i2c, and I HAVE successfully connected and communicated with it through the ConnectBlue module.
I feel confident that I have the correct i2c address (0x52) for the nunchuk, because the ConnectBlue module gives me back good messages. If I give the ConnectBlue a bad address or if I disconnect the nunchuk, the ConnectBlue module sends back an error.
The problem is, when I read the 6 data bytes from the nunchuk, I get back FF FF FF FF FF FF.
I have seen many examples of how to communicate with the nunchuk. Init by sending 0x40 0x0, then to read send 0x00 and read 6 bytes. Some people put delays in places. I've tried the examples and many variations, with varying waits.
Now I'm wondering about the pull-up resistors.
I am a software engineer, and electronics at this level don't come easy.
I understand that for i2c I should use pull-up resistors on SDA and SCL. I did this for my digital compass, and it worked well.
But maybe it is more complicated with the nunchuk. I've read that it already has built in 1.8k resistors on each line, and my ConnectBlue says it already has 47k resistors on each line. (47k because those lines are uses for rs232 normally, but I'm using i2c firmware as I mentioned above). The ConnectBlue document says I might want to use a 2.2k resistor on each line.
I've tried a variety of resistors, 2.2k, 10k, 4.7k, and none.
But I'm just doing so without understanding it well or doing any math or anything.
Once I even used the 2.2k resistors as pull-DOWN resistors. Instead of reading 6 FF's I read 6 00's, which I guess makes sense.
So in summary, I'm confident I can communicate well with the ConnectBlue module, and I can read data from one i2c device (digital compass).
And I'm confident I'm communicating with the nunchuk, but....
either I'm not communicating to it properly or my pull-up resistors are a problem.
Can someone help me determine the proper pull-up resistors given that the nunchuk and ConnectBlue module already have some? Do I need to add or remove some?
Thank for any help!
(and sorry for writing a book. I hope it is actually helpful)
Ion
First, here is my set up:
This ConnectBlue module is typically used as an rs232 to bluetooth adapter, but ConnectBlue offers firmware to use it for i2c. I'm using this firmware.
The Wii nunchuk uses i2c, and many people have connected their microcontrollers to it successfully.
I am using my own windows program on my bluetooth enabled laptop to communicate to the ConnectBlue module.
I have a digital compass IC that uses i2c, and I HAVE successfully connected and communicated with it through the ConnectBlue module.
I feel confident that I have the correct i2c address (0x52) for the nunchuk, because the ConnectBlue module gives me back good messages. If I give the ConnectBlue a bad address or if I disconnect the nunchuk, the ConnectBlue module sends back an error.
The problem is, when I read the 6 data bytes from the nunchuk, I get back FF FF FF FF FF FF.
I have seen many examples of how to communicate with the nunchuk. Init by sending 0x40 0x0, then to read send 0x00 and read 6 bytes. Some people put delays in places. I've tried the examples and many variations, with varying waits.
Now I'm wondering about the pull-up resistors.
I am a software engineer, and electronics at this level don't come easy.
I understand that for i2c I should use pull-up resistors on SDA and SCL. I did this for my digital compass, and it worked well.
But maybe it is more complicated with the nunchuk. I've read that it already has built in 1.8k resistors on each line, and my ConnectBlue says it already has 47k resistors on each line. (47k because those lines are uses for rs232 normally, but I'm using i2c firmware as I mentioned above). The ConnectBlue document says I might want to use a 2.2k resistor on each line.
I've tried a variety of resistors, 2.2k, 10k, 4.7k, and none.
But I'm just doing so without understanding it well or doing any math or anything.
Once I even used the 2.2k resistors as pull-DOWN resistors. Instead of reading 6 FF's I read 6 00's, which I guess makes sense.
So in summary, I'm confident I can communicate well with the ConnectBlue module, and I can read data from one i2c device (digital compass).
And I'm confident I'm communicating with the nunchuk, but....
either I'm not communicating to it properly or my pull-up resistors are a problem.
Can someone help me determine the proper pull-up resistors given that the nunchuk and ConnectBlue module already have some? Do I need to add or remove some?
Thank for any help!
(and sorry for writing a book. I hope it is actually helpful)
Ion