radu7

Wii Wing/Wii Nunchuck questions

8 posts in this topic

I've purchased a couple of Wii Wings and Wii Nunchucks from gadgetfactory.net and I'm having no success getting them working with my Papilio Pro and the WiiChuck example in DesignLab 1.0.8

I've connected the Wii wing to slot AL on the Papilio Pro and loaded the circuit and sketch for it, but the only output I get in the serial monitor is:

Starting
I2C at slot 9, instance 1, base register 0x0c800000
0
Chuck: 255 255 buttons 0 0
Chuck: 255 255 buttons 0 0
Chuck: 255 255 buttons 0 0
Chuck: 255 255 buttons 0 0
Chuck: 255 255 buttons 0 0

...

Pressing either button or moving the joystick does not cause any change in the output values.

As a test I powered the Papilio Pro up without the Wii wing connected and after starting the serial monitor pressed the reset button on the Papilip Pro and get:

Starting
I2C at slot 9, instance 1, base register 0x0c800000
0

with no further output, as expected.

I've tried both Wii wings and both nunchucks that I purchased and both give the same result.

As another test I wired the Wii wing with the nunchuck connected to an Arduino Uno and used the library and example at this site:

http://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/

and received the same output values via the serial monitor as when connected to the Papilio Pro.

I've got the nunchucks connected to the Wii wing so that the nunchuck's pinout matches the silkscreen (The 'indented' side of the nunchuck connector that has no middle pin facing up) and I've verified connectivity from the pin on the wing to the pin of the nunchuck via a DMM.

Any ideas on what may be going on?  I wouldn't think that I managed to get two bad sets of Wii wings and nunchucks so I'm at a bit of a loss as to what the issue could be.

Best regards,

Anthony

 

 

Share this post


Link to post
Share on other sites
Quote

"and received the same output values via the serial monitor as when connected to the Papilio Pro. "


This seems to imply your Wii chucks are not properly powered?. I used a small adaptor back when I wrote the support code, and played with it for a whole maker faire (many people did).
Do you have any digital scope so we can look at the signals ?

Alvie

Share this post


Link to post
Share on other sites

Thanks for the reply Alvie!  I can get access to a DSO and an openbench logic sniffer that I can use to troubleshoot this.  I'll try and get to that after work today.  I'll verify that 3.3V is getting to the Wii chuck and then test for activity on the SCL and SDA pins while pressing the buttons, etc...

If you have any specific test scenarios I should try please do let me know.

 

Regards,

Anthony

Share this post


Link to post
Share on other sites

More interested in the setup sequence. If you can capture that one it should shed some light.
I suspect SDA is high-tied to VCC, hence the readings and the I2C ack.

Share this post


Link to post
Share on other sites

Update:

I decided to try a newer Arduino library for the Wii chuck and a test sketch to read the buttons and joystick position and surprisingly it worked perfectly.

I then took a Digilent Analog Discovery and used the Waveforms software to have a look at what was happening on the I2C bus on the working Arduino example and then the non-working DesignLab example on the Papilio and I could see a difference in the initialization sequence being sent from each.  I guess I should have compared the two libraries and found the issue without breaking out a scope, but where's the fun in that, right?

The Arduino example was sending hF0, h55, hFB, h00 as the init sequence.

The Papilio example was sending h40, h00, hFB, h00 as the init sequence.

After doing a bit more reseearch I changed the following section in the WiiChuck.cpp in the WiiChuck library in DesignLab as below:

int WIIChuck_class::init_nunchuck()
{
    int err = 0;
    if (I2C.start(WIICHUCK_ADDRESS,0)!=0)
        err = -1;
    if (err==0)
        // if (I2C.tx(0x40)!=0) - this is for OEM Wii nunchucks
        if (I2C.tx(0xF0)!=0) // for clone Wii nunchucks
            err = -1;
    if (err==0)
        // if (I2C.tx(0x00)!=0) - this is for OEM Wii nunchucks
        if (I2C.tx(0x55)!=0) // for clone Wii nunchucks
            err = -1;
    I2C.stop();

 

I recompiled the sketch, uploaded to the Papilio and I'm now getting the following results when testing:

No Joystick or button activity - Chuck: 128 127 buttons 0 0

Joystick left - Chuck: 46 127 buttons 0 0

Joystick right - Chuck: 255 127 buttons 0 0

Joystick up - Chuck: 128 255 buttons 0 0

Joystick down - Chuck: 128 46 buttons 0 0

Button C - Chuck: 128 127 buttons 0 1

Button Z - Chuck: 128 127 buttons 1 1

Button C+Z - Chuck: 128 127 buttons 1 0

I was not aware that some (all?) clone chucks do not respond properly to the standard init sequence.  The following comment was in the Arduino library that I used (https://playground.arduino.cc/Main/WiiChuckClass):

            // instead of the common 0x40 -> 0x00 initialization, we
            // use 0xF0 -> 0x55 followed by 0xFB -> 0x00.
            // this lets us use 3rd party nunchucks (like cheap $4 ebay ones)
            // while still letting us use official oness.
            // only side effect is that we no longer need to decode bytes in _nunchuk_decode_byte
            // seehttp://forum.arduino.cc/index.php?topic=45924#msg333160

Thanks for the advice Alvie, using the scope certainly revealed the issue even if it wasn't due to a hardware fault or misconfiguration.

Regards,

Anthony

Share this post


Link to post
Share on other sites

My Wii Chuck is a Nintendo original and worked with the posted settings, I may need to try your changes so se if it still works.

Thanks a lot for testing this and finding a fix! :)

Alvie

Share this post


Link to post
Share on other sites

Hmmm, this is interesting. Was this with the Wii-Chucks that we are selling from the Gadget Factory store? I'm pretty sure I tested with those but maybe I got something different the last time I ordered...

Jack.

Share this post


Link to post
Share on other sites

Hi Jack,

Yes, I purchased the Wii-Chucks along with the Wii Wings from the Gadget Factory store earlier this month.

Anthony

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now