Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 00:44 06 Dec 2022 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: minor Nunchuk/Classic controller "bug"

Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 2830
Posted: 11:29am 21 Nov 2022
Copy link to clipboard 
Print this post

Hi Peter,

It appears to be currently possible from MMBasic to open a Wii controller and then read from it before the firmware has performed the first (16 mSec) poll of the controller resulting in the "initial values" being returned (these appear to be zeroes, but I think I saw "garbage" on one occasion that I can't now reproduce.)

It's easy enough to workaround (add a short PAUSE), but you might want to consider updating the firmware to force a poll immediately after the controller has opened, or equivalently add a pause at the end of the OPEN routine; assuming that won't block the poll.

Best wishes,

Tom
Edited 2022-11-21 21:29 by thwill
CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 6619
Posted: 01:15pm 21 Nov 2022
Copy link to clipboard 
Print this post

Try this (untested)


CMM2.zip
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 2830
Posted: 01:27pm 21 Nov 2022
Copy link to clipboard 
Print this post

Thanks Peter,

  matherp said  Try this (untested)


Bill (@Turbo46) would you test this on your Nunchuck, don't forget to remove the PAUSE that you added. I'll test it with the Classic.

Best wishes,

Tom
CMM2 Welcome Tape, Creaky old text adventures
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1120
Posted: 01:05am 22 Nov 2022
Copy link to clipboard 
Print this post

Sorry, that didn't work for me. I still get zeros for the first readings of JX and JY.

Bill
Keep safe. Live long and prosper.
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1120
Posted: 06:16am 22 Nov 2022
Copy link to clipboard 
Print this post

I had some problems with this firmware. A couple of times the keyboard would not work. Because I had the wrong keyboard option set (UK not US), I changed the keyboard option.

After that the keyboard only worked very occasionally after powering down and up. No console to teraterm either. I tried another keyboard and power supply and got no improvement.

Eventually I re-flashed the CMM2 with 5.07.02b6 and all is good again.

It was a bit flaky before I changed the keyboard.

Bill
Keep safe. Live long and prosper.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 6619
Posted: 10:13am 22 Nov 2022
Copy link to clipboard 
Print this post

Try again. I've reverted to an older version of the IDE. It is the only change that could affect USB since RC6


CMM2.zip
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1120
Posted: 11:06am 22 Nov 2022
Copy link to clipboard 
Print this post

Thanks Peter I'll try it out tomorrow for the USB problem but it didn't help with the initial problem before I tried to change the keyboard.

Bill
Keep safe. Live long and prosper.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 6619
Posted: 11:07am 22 Nov 2022
Copy link to clipboard 
Print this post

I have made a further change to the controller check in the latest. Somehow I think you found a 2mSec window
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1120
Posted: 11:27am 22 Nov 2022
Copy link to clipboard 
Print this post

Thanks again Peter, Murphy's law always works against me. I will try again tomorrow.

Bill
Keep safe. Live long and prosper.
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1120
Posted: 09:10pm 22 Nov 2022
Copy link to clipboard 
Print this post

Sorry again, while I can change the keyboard back and forth with no problems now, JX and JY still read zero for the first time. There is a 250mS delay in my test program before I read it again to give me time to see that first reading.

Bill
Keep safe. Live long and prosper.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 6619
Posted: 10:44pm 22 Nov 2022
Copy link to clipboard 
Print this post

The controller has been polled multiple times in 250mSec so there is nothing more I can do. My "fix" was just to make sure one poll happens before the OPEN command completes.
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1120
Posted: 11:04pm 22 Nov 2022
Copy link to clipboard 
Print this post

Thanks for trying Peter, I guess a pause 16mS or more before polling the Nunchuk will work. Or a do - loop waiting for a non zero value. (and they do)

Bill
Keep safe. Live long and prosper.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 6619
Posted: 09:30am 23 Nov 2022
Copy link to clipboard 
Print this post

One more try

I found a variable that wasn't labelled volatile that is changed in the interrupt routine so it is possible the issue was a caching/optimisation issue


CMM2.zip
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1120
Posted: 10:12am 23 Nov 2022
Copy link to clipboard 
Print this post

SUCCESS! Thanks Peter, there are no zero readings on jx and jy on my first reading of the Nunchuk. No PAUSE or DO...LOOP needed.

I hope that fixes any issues for Tom with his Classic.

Thanks again.
Bill
Keep safe. Live long and prosper.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 2830
Posted: 10:20am 23 Nov 2022
Copy link to clipboard 
Print this post

Lovely, I'll give it a thrash with the Wii Classic Controller at the weekend.

Thanks for your dogged determination Peter.

Best wishes,

Tom
CMM2 Welcome Tape, Creaky old text adventures
 
toml_12953
Senior Member

Joined: 13/02/2015
Location: United States
Posts: 273
Posted: 09:50am 26 Nov 2022
Copy link to clipboard 
Print this post

  matherp said  One more try

I found a variable that wasn't labelled volatile that is changed in the interrupt routine so it is possible the issue was a caching/optimisation issue


CMM2.zip


Does this have all the features of the beta CMM2V5.07.02b6? If not what's the latest version?
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 2830
Posted: 04:38pm 28 Nov 2022
Copy link to clipboard 
Print this post

  thwill said  Lovely, I'll give it a thrash with the Wii Classic Controller at the weekend.


I've briefly tested it (better late than never) and as far as I can tell it is now behaving itself. Thanks again Peter.

  toml_12953 said  Does this have all the features of the beta CMM2V5.07.02b6? If not what's the latest version?


I assume so. It reports itself to be 5.07.02b8 but I don't know if Peter has "officially blessed" this as beta 8 or that is an "accident".

Best wishes,

Tom
Edited 2022-11-29 03:06 by thwill
CMM2 Welcome Tape, Creaky old text adventures
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2022