SparkFun Forums 

Where electronics enthusiasts find answers.

Questions &/or issues related to products in the Qwiic category should be posted in this forum. To learn more about Qwiic, consider checking out our pillar page on the Qwiic system.
#205030
Hello,
I have a Qwiic Joystick (COM-15168). I recently found an issue with the checkButton() function in the Qwiic Joystick Arduino library. I looked at the library code and I believe the issue may be in the joystick firmware itself.

Reading the button status through the Arduino library checkButton() function or even directly through i2c calls to read register 0x08 always returns 1. The register never seems to clear after being explicitly set to 0x00 through a write call in the Arduino library.

Here is Arduino code to based on Example 1 to duplicate the problem.
Code: Select all
#include <Wire.h>
#include "SparkFun_Qwiic_Joystick_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_joystick
JOYSTICK joystick; //Create instance of this object

void setup() {
  Serial.begin(9600);
  Serial.println("Qwiic Joystick Example");


  if(joystick.begin()) {
    Serial.print("Version: ");
    Serial.println(joystick.getVersion());
  } else {
    Serial.println("Joystick does not appear to be connected. Please check wiring. Freezing...");
    while(1);    
  } // if-else begin
}  // setup

void loop() {
  Serial.print("X: ");
  Serial.print(joystick.getHorizontal());

  Serial.print(" Y: ");
  Serial.print(joystick.getVertical());
  
  Serial.print(" Button: ");
  Serial.print(joystick.getButton());

  Serial.print(" Status: ");
  Serial.println(joystick.checkButton());

  delay(200);
} // loop
Running this code and pressing the button produces the following output. Please note that status value is always 1.
Code: Select all
Qwiic Joystick Example
Version: v2.4
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
Reading the register 0x08 directly in python on a Raspberry pi has the same result. I opened an issue on GitHub in the Sparkfun/Qwiic_Joystick repository for this, if you need to track the change there. Please let me know if there's anything else Sparkfun would like me to do.

Thanks,
Gaston
#205038
Hi Gaston,

Thanks for bringing this to our attention! Filing an issue on the GitHub repository should ping the engineers assigned to that repo so they will take a look and depending on their schedule, should respond to it soon. I can also test this with a known good board here and ping them directly to get this issue fixed.
#205200
Hi again Gaston,

I just spoke with a member of our tutorials team regarding this issue. It looks like it was a bug in the firmware for this setting that should be fixed today. If you have a programmer, you could update the firmware to the latest version hosted on our GitHub Repository once the fixed firmware has been pushed.

Otherwise, we would be happy to help with a return for replacement. If you would like a replacement and you purchased the Qwiic Joystick directly from SparkFun, please fill out the form on this page and in the "Why do you want an RMA?" box, fill in a brief description of the issue and link to this forum post and we will follow up with further instructions.
#205235
Hi again Gaston,

You have a few options to re-program the ATTiny85 on the Qwiic Joystick. You can use an AVR programmer like this or you can set up an Arduino like this tutorial. Our tutorial for Re-Programming the LilyTiny/LilyTwinkle will have some tips for programming a surface-mount package of the ATTiny85. That tutorial uses the Tiny AVR Programmer but you could theoretically use an Arduino as your programmer for that process as well. You will want to use something like the IC Test Clip recommended in that tutorial to connect to the pins on the ATTiny85.

The firmware for the Qwiic Joystick can be downloaded from the GitHub repository. As of this writing, it is still not updated but we will be pushing a commit to update it by the end of the day today (6/19).

Let us know if you have any questions about or issues with this process and we would be happy to help.
#205328
Hi,
Thank you for that information. It was very helpful. I used a Sparkfun Blackboard with the I/O set to 3.3v and went the Arduino as ISP route. I don't own a pogo connector or ATTiny85 Chip clip (yet), so I had to improvise a bit. I had to skip around between the various tutorials, so I'll document the steps I took below in case anyone else is interested.

I noticed in the schematic that the Qwiic connections ran straight to the same pins as four of the ICSP connections, so I used a Qwiic Breadboard Jumper cable to connect to 3.3v, Gnd, MOSI, SCK to their proper Arduino pins. I then used straight pins and IC hooks with jumper wires to connect MISO and RST to the Arduino. I found the straight pin in the ICSP hole trick in the comments for one of the tutorials. It worked well for the two ICSP connections that didn't feed in through the Qwiic cable.

My wiring was like this. Please note that I am not connecting through the Qwiic connector on the Arduino side. I'm using the Qwiic colored jumper breadboard wires to connect to the proper Arduino SPI pins.
Code: Select all
Arduino                 ICSP connection 
   3.3v                    Vcc (Qwiic cable Red wire)
   GND                     GND (Qwiic cable Blk wire)
    13                     SCK (Qwiic cable Yellow wire/SCL)
    12                     MISO (via straight pin in ICSP hole 1)
    11                     MOSI (Qwiic cable Blue wire/SDA)
    10                     RST (via straight pin in ICSP hole 5)
After loading the ATTinyCore boards with the Arduino board manager, I opened the Example > 11. ArduinoISP sketch.
I un-commented the line #define USE_OLD_STYLE_WIRING and uploaded the ArduinoISP sketch to the Arudino Uno.

Then I switched the target board to "ATTiny 25/45/85 in the Arduino IDE. I downloaded the firmware files from github and, after installing the pin change interrupt library required by the firmware, I was able to compile the firmware and upload it through the Arduino and into the Joystick ATTiny85.

Now I'm at version 2.6 now, and all is well.

Thanks for all your help.
Gaston aka fourstix
#205364
Awesome! I'm glad everything is up and running and these tips will surely help others who want to update the firmware on their Qwiic Joysticks. If you run into any other issues or have any other questions about the Qwiic Joystick, let us know and we would be happy to help.