Jump to content
  • 0

JSTK2 PMOD Using Zybo Board


jgoglio

Question

Hello all,

I'm getting started with my Zybo board and Vivado. I also purchased a  PmodJSTK2 PMOD.

 

Can anyone help me get going using this pmod? I'm eventually hoping to integrate this into a VHDL game (Just using simple up/down control from joystick).

More specifically, I'm hoping someone has a simple Vivado example using the JSTK2 PMOD that is compatible with my Zybo.
 

Thank you!

PS: I would like to clarify that I have already tried the below two examples (IP w/ C program and VHDL):

https://reference.digilentinc.com/learn/programmable-logic/tutorials/pmod-ips/start

https://reference.digilentinc.com/pmod/pmod/jstk/example_code

The IP example seems most promising, but I am not sure what to do with the JSTK IP output and errors fly. If someone could help guide me with this specific example, that would also be great!

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

Hi jgoglio,

Here is an instructable that uses the PmodJSTK that should help with the PmodJSTK2. Here is the reference page for the PmodJSTK2. Here is our Github for the Pmod JSTK2 IP. I have attached a project where I have used the PmodJSTK2 IP. I have not yet verified it with the Pmod at this time. Hope this helps!

cheers,

Jon

PmodJSTK2.zip

Link to comment
Share on other sites

On 11/28/2016 at 4:02 PM, jpeyron said:

 

On 11/28/2016 at 4:02 PM, jpeyron said:

Hi jgoglio,

Here is an instructable that uses the PmodJSTK that should help with the PmodJSTK2. Here is the reference page for the PmodJSTK2. Here is our Github for the Pmod JSTK2 IP. I have attached a project where I have used the PmodJSTK2 IP. I have not yet verified it with the Pmod at this time. Hope this helps!

cheers,

Jon

PmodJSTK2.zip

Thank you! I'm looking at p.2 of the Pmod datasheet -- Specifically the MISO. It seems like there are 2 bytes each relating to x & y position. Do you know how to interpret the various directions (e.g. Negative x axis of joystick is Byte 1, where 1024 corresponds to the 25 deg extension)?

I really appreciate your help!

Link to comment
Share on other sites

Hi jgoglio,

I have included the sdk files below. Most of the functions in PmodJSTK2.c are used in basic_example.c and calibrate_example.c. I would suggest to use a serial terminal(like tera term) and look at the output when using the PmodJSTK2 and you should be able to see how to interpret the output based on the joysticks position.

thank you,

Jon

PmodJSTK2.c

PmodJSTK2.h

basic_example.c

calibrate_example.c

Link to comment
Share on other sites

Hello,

The values you receive back from each axis can range from 0 to 1023 (unless you use a get position command, which returns a 8-bit version). For the x-axis, a value of zero corresponds to the joystick being fully tilted to the left (for the both the 8 and 10 bit versions). Similarlly, a value of 1023 (or 255) corresponds to the joystick being pushed all the way to the right.

The y-axis is slightly different. For the 10 bit value, all the way up is 1023 and all the way down corresponds to a value of 0. For the 8-bit version (by default), a value of 0 corresponds to the joystick being pushed all the way up and a value of 255 is it being pushed all the way down. This can be changed by enabling inversion on the y-axis. I'll update the reference manual to better explain this.

Let me know if you have any more questions.

Thanks,
JColvin

Link to comment
Share on other sites

Hi guys, I am running into one final issue.

 

Can the JSTK2 Pmod use any of the standard Pmod ports or does it require the XADC Pmod?
To be clear, I would like to use two JSTK2 Pmods for a 2 player game. Is this possible?

 

Thanks,

Josh

Link to comment
Share on other sites

@jgoglio,

The XADC is an internal analog to digital converter within the FPGA.  A Pmod wired to its inputs would allow the measurement of analog voltages.  These lines into the FPGA are unique in that they can be both digital or analog.  Hence, the XADC Pmod port is just a normal Pmod port with some added functionality, but able to handle normal signalling as well.

All that is to say that the Pmod JSTK2 uses normal digital signalling, not any analog signalling, so that any Pmod port you choose should work.  Any 6-wire Pmod port should be able to drive the Pmod JSTK2.  Indeed, any 12-wire Pmod port should be able to handle two  JSTK2s -- with an appropriate cable.

Dan

Link to comment
Share on other sites

Thank you Dan, that was very informative.

 

For anyone else reading this, note that the .xdc file for the Zybo has a different naming scheme for regular Pmods than for the XADC. This was the source of my problem (Tip: Never be careless about pin assignments). I'm thinking this is due to the differential option that comes with the XADC.


Again, thank you to this great community for your help!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...