UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor gabriele
Visitor
8,244 Views
Registered: ‎12-20-2014

Accessing SW12 from an ARM.

Jump to solution

The switch SW12 on the ZC702 is described as a "user 2-pole DIP switch". This suggests its meaning is user-defined and so can be used to control software, but I have been unable to find any documentation on the switch (other than references in circuit diagrams).

 

Can the state of this switch be read from software on the ARM?

 

If so, where is this documented or how can it be done (from the bare metal, not under Linux)?

If not, is there any way of passing 1 bit of information from the board into a program without user intervention each time?

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
Visitor gabriele
Visitor
14,275 Views
Registered: ‎12-20-2014

Re: Accessing SW12 from an ARM.

Jump to solution

I have found a solution. The following code accesses the switch SW15:

 

volatile unsigned int *DATA_0_RO = (volatile unsigned int *)0xE000A060;
// Bits 12 and 14 of GPIO register DATA_0_RO correspond to SW15:1 and SW15:2

main() {
   unsigned int x = *DATA_0_RO;
   printf("Switch sw15: %d%d\n", (x>>12)&1, (x>>14)&1);
}

 

Thanks to those who gave the clues.

 

I would have thought that the obscure way you have to access the board's switches should have been something worthy of documenting clearly, rather than requiring users to follow tortuous lines of reasoning.

0 Kudos
9 Replies
Xilinx Employee
Xilinx Employee
8,243 Views
Registered: ‎08-02-2007

Re: Accessing SW12 from an ARM.

Jump to solution

hi,

 

you can refer to this BIST example design http://www.xilinx.com/support/documentation/boards_and_kits/zc702_BIST_pdf_xtp180_14.1.pdf

 

this does control the LED's using GPIO using PL.

 

--hem

----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Visitor gabriele
Visitor
8,240 Views
Registered: ‎12-20-2014

Re: Accessing SW12 from an ARM.

Jump to solution

Thank you for your reply, but the document you refer to mentions SW12 once and gives no details of accessing it.

I assume that SW12 is actually formally documented somewhere. Do you have a reference to THAT document?

0 Kudos
Xilinx Employee
Xilinx Employee
8,232 Views
Registered: ‎08-02-2007

Re: Accessing SW12 from an ARM.

Jump to solution

hi,

 

the design files are available at this link.

 

if you are using a different version of refer to rdf0166 zip for the respective version that you are using in this link

http://www.xilinx.com/products/boards-and-kits/ek-z7-zc702-g.html#documentation

 

--hem

----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Visitor gabriele
Visitor
8,228 Views
Registered: ‎12-20-2014

Re: Accessing SW12 from an ARM.

Jump to solution

Perhaps I am not making myself clear.

 

I have no interest in (or knowledge of) changing any of the firmware in the FPGA.

 

Is SW12 visible from a C program running on the ARM on a ZC702 straight out of the box?

 

To be even more explicit, is it possible to write a program on the ARM something like this:

 

#define SW12_ADDRESS 0x????????

 

main () {

   int sw12 = *(int *)SW12_ADDRESS;

   printf("SW12 is %d\n", sw12);

}

 

0 Kudos
Instructor
Instructor
8,220 Views
Registered: ‎08-14-2007

Re: Accessing SW12 from an ARM.

Jump to solution

No.

 

SW12 connects to the fabric (PL) I/O so you need to go through the fabric to access it.  However DIP switch SW15, which wires in parallel with the pushbittons SW13 and SW14 can be accessed by the ARM directly.

-- Gabor
0 Kudos
Visitor gabriele
Visitor
8,218 Views
Registered: ‎12-20-2014

Re: Accessing SW12 from an ARM.

Jump to solution

Thank you - that is exactly what I'm looking for.

 

All that remains is to discover where SW15 and accessing it is documented.

 

All I can find are references stating that it's wired to the push buttons. The documentation that actually gives the required information to get the value is well hidden.

 

 

 

0 Kudos
Instructor
Instructor
8,206 Views
Registered: ‎08-14-2007

Re: Accessing SW12 from an ARM.

Jump to solution

I just found it on the schematics.  On page 8 it shows that SW15 pin 1 is the same as pushbutton SW13, signal PS_DIP_SW0, and pin 2 is the same as SW14 signal PS_DIP_SW1.

 

PS_DIP_SW0 goes to PS MIO14

PS_DIP_SW1 goes to PS MIO12

-- Gabor
0 Kudos
Visitor gabriele
Visitor
8,204 Views
Registered: ‎12-20-2014

Re: Accessing SW12 from an ARM.

Jump to solution

We seem to be creeping towards an answer. Now the question becomes, how do I access MIO 12 and MIO 14?

I can see MIO registers in the SLCR, but these seem to be purely control values. Where are the data values?

 

 

0 Kudos
Visitor gabriele
Visitor
14,276 Views
Registered: ‎12-20-2014

Re: Accessing SW12 from an ARM.

Jump to solution

I have found a solution. The following code accesses the switch SW15:

 

volatile unsigned int *DATA_0_RO = (volatile unsigned int *)0xE000A060;
// Bits 12 and 14 of GPIO register DATA_0_RO correspond to SW15:1 and SW15:2

main() {
   unsigned int x = *DATA_0_RO;
   printf("Switch sw15: %d%d\n", (x>>12)&1, (x>>14)&1);
}

 

Thanks to those who gave the clues.

 

I would have thought that the obscure way you have to access the board's switches should have been something worthy of documenting clearly, rather than requiring users to follow tortuous lines of reasoning.

0 Kudos