# Configure Xilinx SmartLynq for Eth. programming & GPIO ## 1 Connect power, RJ45 cable If success, you may see: ![](https://i.imgur.com/AN4plbV.png) Above red ip address please **remember this IP address as *\<init-ip-addr\>*** ## 2 Ensure path of vivado has exist your EnvVar Append path of vivado *bin* into `.bashrc` or `.tclshrc` or `.zshrc` For examle, I place my path of vivado *bin* to `.zshrc` ``` bash $ echo "export PATH=$PATH:"/tools/Xilinx/Vivado/2020.1/bin" >> ~/.zshrc ``` and run ``` bash $ vivado -version ``` You should get message similar to: ``` Vivado v2020.1.1 (64-bit) SW Build 2960000 on Wed Aug 5 22:57:21 MDT 2020 IP Build 2956692 on Thu Aug 6 01:41:30 MDT 2020 Copyright 1986-2020 Xilinx, Inc. All Rights Reserved. ``` ## 3 First Connect to SmartLynq with vivado via Eth. Run vivado with command mode: ``` $ vivado -mode tcl ``` Open hardware manager of vivado ```tclsh vivado% open_hw_manager ``` Connect to **\<init-ip-addr\>** of Xilinx-SmartLynq ``` tclsh vivado% connect_hw_server -url TCP:<init-ip-addr>:3121 ``` If you success, you could get message similar to ``` INFO: [Labtools 27-2285] Connecting to hw_server url TCP:<init-ip-addr>:3121 INFO: [Labtools 27-3415] Connecting to cs_server url TCP:localhost:3042 INFO: [Labtools 27-3417] Launching cs_server... INFO: [Labtools 27-2221] Launch Output: ****** Xilinx cs_server v2020.1.0 **** Build date : May 14 2020-09:10:29 ** Copyright 2017-2020 Xilinx, Inc. All Rights Reserved. <init-ip-addr>:3121 ``` ## 4 Update firmware for Xilinx SmartLynq When you 1st connect to SmartLynq via Eth. you could get this message ``` INFO: [Labtools 27-2285] Connecting to hw_server url TCP:xxx.xxx.xxx.xxx:3121 INFO: [Labtools 27-3350] There is an update available for the SmartLynq Data Cable cable. Call 'update_hw_firmware -reset' TCL command to update. ``` Yes, If you'd like to programming to FPGA with SmartLynq, you need to update firmware. Use this command ``` bash %vivado update_hw_firmware -reset ``` **After Update successful,** **Unplug power and re-start SmartLynq** After restart, you should see firmware version (as following pcture red) same to your version of vivado ![image alt](https://i.imgur.com/C6IGkuT.png) ## 5 Assign static(fixed) IP for SmartLynq Open vivado with command mode ``` bash $ vivado -mode tcl ``` Open hardware manager of vivado ```tclsh vivado% open_hw_manager ``` Connect into hardware manager ``` tclsh vivado% connect_hw_server -url TCP:<init-ip-addr>:3121 ``` Request IP/Mask/Gateway from your network administrator , write this file *Config.ini* ``` # File Name: Config.ini set always-open-jtag 1 set ip-address 192.168.10.55 set ip-netmask 255.255.255.0 set ip-gateway 192.168.10.254 ``` Regarding above example, my ip address of SmartLynq is `192.168.10.55` others information I request from by our network administrator. Now, we're updating firmware of SmartLynq with command in vivado-tcl ``` Vivado% update_hw_firmware -skip_update -config_path <path to file of Config.ini> -reset ``` If you get this message ``` INFO: [Labtoolstcl 44-645] SmartLynq successfully updated. Disconnect from the hw_server and power cycle the SmartLynq before reconnecting. INFO: [Labtoolstcl 44-658] Smartlynq cable has reset. Disconnecting from Smartlynq server. Reconnect to Smartlynq to continue session. ``` update should be successful. **Unplug power and re-start SmartLynq** After SmartLynq boot, you should see new ip address has been upated ![image alt](https://i.imgur.com/n34VLQ5.png) ## 6 Programming with SmartLynq via Eth. ### 6.1 Configure(find) SmartLynq in your vivado project ![](https://i.imgur.com/gio8UjZ.png) ![](https://i.imgur.com/nDz3miC.png) ![](https://i.imgur.com/EYd8D4B.png) ### 6.2 If configure is successful, you can start to program ![](https://i.imgur.com/GfJlOz5.png) ## 7 GPIO ### 7.1 Prepared for configure GPIO Open vivado with command mode ``` bash $ vivado -mode tcl ``` Open hardware manager of vivado ```tclsh vivado% open_hw_manager ``` Connect into hardware manager ``` tclsh vivado% connect_hw_server -url TCP:<init-ip-addr>:3121 ``` ### 7.2 Configure state of GPIO for each I/O port When preceding operation (7.1) finished, run ``` tclsh vivado% update_hw_gpio <direction byte> <Assigned values of out> ``` For \<direction byte\>, where: * 0 defines the pin as an input pin * 1 in the direction byte specifies the pin in that bit position as an output pin. For \<Assigned value of out\> : if \<direction byte\> assert to '1', (this port is assigning \<out state\> now) assing this port '0' or '1' as output value ### 7.3 A example ``` tclsh vivado% update_hw_gpio 1A 2B ``` 1A meaning I/O direction is 1A: 0001_1010 -> in/in/in/out _ in/out/in/out 2B meaning 2B: 0010_1011 -> x/x/x/1 _ x/0/x/0 where x is input value ### 7.4 Note Input values seems can't be monitor by computer directly ![](https://i.imgur.com/Vlxs5NR.png) ###### tags: `TechReport` `DeWei`