Enabling SSH and WiFi dongle on Raspberry Pi

This was done from a fresh RPi, therefore the first thing we do is updating all the applications, then upgrading. Following step we enable the SSH and then we install the application that manage the wifi conection. Finally we enable the wifi con conect automatically once power has come up, therefore enabling an SSH conection after a remote reboot.

  1. Follow this video tutorials for SSH

    apt-get update
    apt-get upgrade
    reboot
    sudo raspi-config
    

    select from menu : "expand filesystem" then "Advanced Options" and then "SSH" --> Enabled --> "Finish"

    reboot
    sudo ip addr show
    

    Now you should be able to SSH to you RPi using the IP address shown in the line that starts with "inet 192.168.X.Y ....."

    On your computer do:

    ssh pi@192.168.X.Y         # Y is your wired address
    

    type password for "pi" user (Note the default is "raspberry")

  2. Now we want to plug out Wifi Dongle and have it wirelessly connected, following this tutorial do:

    sudo apt-get install wicd-curses
    sudo wicd-curses
    

    Select your wifi network, if it doesn't show then hit the key "P" (preferences) and type "wlan0" in the field "wireless interface" hit F10 to save

    Select your Wifi network, hit the right arrow to configure: check static IP type the IP address following the same skim as your router gateway: i.e: IP: 192.168.X.Z (Z is going to be your static wireless address- pick any number) Mask: 255.255.255.0 Gateway: 192.168.X.R (R is the ip address of your router) at the bottom on key type your wifi password hit F10 to save

    After some seconds it will connect, you can unplug the wired cable and verify a remote SSH to the new wireless IP address

    ssh pi@192.168.X.Z
    

    type password

  3. Now to allow the wifi conection to come up automatically after a remote reboot do:

    sudo nano /etc/network/interfaces
    

    Change it to this:

    auto lo
    iface lo inet loopback
    #Remove the wired network because it
    #slows down boot if it's not connected.
    #auto eth0
    #iface eth0 inet dhcp
    allow-hotplug wlan0
    auto wlan0
    iface wlan0 inet static
    address 192.168.1.20 #(IP address of RaspyFi)
    netmask 255.255.255.0
    gateway 192.168.1.2 #(IP of router)
    wpa-ssid MyWirelessNetwork
    wpa-psk MyPassword
    
  4. You are all done, SSH to your wirelessly connected RPi and reboot to test the feature of auto connection after booting.

  5. To disable the power saving feature of the wifi module we follow this page

    The problem seems to be that the adapter has power management features enabled by default. This can be checked by running the command:

    cat /sys/module/8192cu/parameters/rtw_power_mgnt
    

    A value of 0 means disabled, 1 means min. power management, 2 means max. power management. To disable this, you need to create a new file:

    sudo nano /etc/modprobe.d/8192cu.conf
    

    and add the following:

    # Disable power management
    options 8192cu rtw_power_mgnt=0
    

    Once you save the file and reboot your RPi, the WiFi should stay on indefinitely.

Compiling xilinx simulation libraries for modelsim

We will use Simulation Library Compilation Wizard for compiling the libraries, this method is highly recommended because library compilation can be performed for more than one device family and/or language.

  1. Open the Simulation Library Compilation Wizard. This can be accessed from Start Menu!Programs!Xilinx ISE Design Suite 13.x!ISE Design Tools!32-bit Tools. Note: If you are using 64-bit version of ModelSim use the Simulation Library Compilation Wizard from 64-bit Tools. ModelSim PE Student Version 10.x is only available in the 32-bit version.

  2. The Select Simulator window opens up. Select the appropriate simulator (For Student Edition select ModelSim PE), enter c:nmodeltech64 10.0cnwin64 for executable location, compxlib.cfg for Compxlib Con guration File and compxlib.log for Compxlib Log File.

  3. Next select the HDL used for simulation. If you are unsure select Both VHDL and Verilog. However, this will increase the compilation time and the disk space required.

  4. Then select all the device families that you will be working with. Again the more number of devices, more the compilation time and the disk space required. Remember that you can always run the compilation wizard at a later time for additional devices.

  5. The next window is for Selecting libraries for Functional and Timing Simulation. Di erent libraries are required for di erent types of simulation (behavioral, post-route, etc.). We suggest that you select All Libraries as the default option. Interested users can refer to Chapter 6 of the Xilinx Synthesis and Simulation Design Guide for additional information.

  6. Finally the window for Output directory for compiled libraries is shown. We suggest to leave the default values that Xilinx picks. Then select Launch Compile Process.

  7. Be patient as the compilation can take a long time depending on the options that you have chosen.

  8. The compile process may have contain a lot of warnings but should be error-free. We have not explored the reasons behind these warnings, but they do not appear to a ect the simulation of any of our designs.

  9. Once the process is completed, open c:nmodeltech64 10.0cnmodelsim.ini and verify if there are libraries pointing to the output directory entered in step 6. This will happen only if you have set the environment variables.

    Library compilation is now complete. If you have not set the environment variables then the wizard creates a modelsim.ini in the output directory entered in step 6. By default this location is c:nXilinxn13.xnISE DSnISE. Open this le and verify that it contains the location of the libraries that were just compiled. This le should be copied into every project you create.

For more info, take a look at this pdf

put custom template format into xilinx autogenerated files

If you have your own installation of the software you could hard code your changes into the Tcl scripts that control this.

For example, the company name could be entered for VHDL modules and VHDL TBs in the following files.

– VHDL Module - line 713
C:\xilinx\13.1\ISE_DS\ISE\data\projnav\scripts\dpm_sourceTasks.Tcl
– VHDL Testbench
C:\xilinx\13.1\ISE_DS\ISE\data\testbnch2.tcl

I modified my file like this: (however I had some issues later and it wasn't doing anything, just creating blank files, If you have a solution for this please let me know, if not try this under your own risk.)

set _t [clock seconds]
set _ts [clock format $_t -format "%H:%M:%S %m/%d/%Y"]
set _date_stamp [clock -format "%m/%d/%Y"]
global xilinx::Dpm::INewSourceHdlDataID
set _iHdlData [$iNewSourceComp GetInterface $INewSourceHdlDataID]
if { $_iHdlData == 0 } {
return [dpm_Fail "interface passed to Create New Source code hook is invalid."]
}
set _entityName ""
dpm_returnOnFail { $_iHdlData GetEntityName _entityName }
set _archName ""
dpm_returnOnFail { $_iHdlData GetModuleName _archName }
dpm_Debug 11 "architecture returned is $_archName"
set _portIter 0
$_iHdlData GetPorts _portIter
puts $hFile "----------------------------------------------------------------------------------"
puts $hFile "-- Company: LBNL"
puts $hFile "-- Engineer: Luis Ardila (luis.ardila@bozica.co)"
puts $hFile "-- "
puts $hFile "-- Create Date: $_ts "
puts $hFile "-- Design Name: "
puts $hFile "-- Module Name: $_entityName - $_archName "
puts $hFile "-- Project Name: "
puts $hFile "-- Target Devices: "
puts $hFile "-- Tool versions: "
puts $hFile "-- Description: "
puts $hFile "--"
puts $hFile "-- Dependencies: "
puts $hFile "--"
puts $hFile "-- Revision: "
puts $hFile "-- Date Version Author Description"
puts $hFile "-- $_date_stamp 1.0 Luis Ardila File Created"
puts $hFile "-- Additional Comments: "
puts $hFile "--"
puts $hFile "----------------------------------------------------------------------------------"
puts $hFile "LIBRARY IEEE;"
puts $hFile "USE IEEE.STD_LOGIC_1164.ALL;"

Cygwin custom prompt

The next information is taken from here it is not mine. I am trying to fix my prompt in a new machine that doesn't show up anything, not even the folder where it is i found this:

Prompt is control via a special shell variable. You need to set PS1, PS2, PS3 and PS4 variable. If set, the value is executed as a command prior to issuing each primary prompt.

  • PS1 - The value of this parameter is expanded (see PROMPTING below) and used as the primary prompt string. The default value is s-v$ .
  • PS2 - The value of this parameter is expanded as with PS1 and used as the secondary prompt string. The default is >
  • PS3 - The value of this parameter is used as the prompt for the select command
  • PS4 - The value of this parameter is expanded as with PS1 and the value is printed before each command bash displays during an execution trace. The first character of PS4 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is +

How do I display current prompt setting?

Simply use echo command, enter:

echo $PS1

output:

\\u@\h \\W]\\$

How do I modify or change the prompt?

Modifying the prompt is easy task. Just assign a new value to PS1 and hit enter key: My old prompt --> [vivek@105r2 ~]$

PS1="touch me : "

output: My new prompt

touch me :

So when executing interactively, bash displays the primary prompt PS1 when it is ready to read a command, and the secondary prompt PS2 when it needs more input to complete a command. Bash allows these prompt strings to be customized by inserting a number of backslash-escaped special characters that are decoded as follows:

  • a : an ASCII bell character (07)
  • d : the date in "Weekday Month Date" format (e.g., "Tue May 26")
  • D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
  • e : an ASCII escape character (033)
  • h : the hostname up to the first '.'
  • H : the hostname
  • j : the number of jobs currently managed by the shell
  • l : the basename of the shell’s terminal device name
  • n : newline
  • r : carriage return
  • s : the name of the shell, the basename of $0 (the portion following the final slash)
  • t : the current time in 24-hour HH:MM:SS format
  • T : the current time in 12-hour HH:MM:SS format
  • @ : the current time in 12-hour am/pm format
  • A : the current time in 24-hour HH:MM format
  • u : the username of the current user
  • v : the version of bash (e.g., 2.00)
  • V : the release of bash, version + patch level (e.g., 2.00.0)
  • w : the current working directory, with $HOME abbreviated with a tilde
  • W : the basename of the current working directory, with $HOME abbreviated with a tilde
  • ! : the history number of this command
  • # : the command number of this command
  • $ : if the effective UID is 0, a #, otherwise a $
  • nnn : the character corresponding to the octal number nnn
  • \ : a backslash
  • [ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
  • ] : end a sequence of non-printing characters

the SP1 value is stored in /etc/bash.bashrc at first i didn't have that file so I just copy the one in my other machine and it worked perfect. here is the file:

# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any warranty.
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software.
# If not, see .

# base-files version 4.1-1

# /etc/bash.bashrc: executed by bash(1) for interactive shells.

# The latest version as installed by the Cygwin Setup program can
# always be found at /etc/defaults/etc/bash.bashrc

# Modifying /etc/bash.bashrc directly will prevent
# setup from updating it.

# System-wide bashrc file

# Check that we haven't already been sourced.
([[ -z ${CYG_SYS_BASHRC} ]] && CYG_SYS_BASHRC="1") || return

# If not running interactively, don't do anything
[[ "$-" != *i* ]] && return

# Set a default prompt of: user@host and current_directory
PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '

# Uncomment to use the terminal colours set in DIR_COLORS
# eval "$(dircolors -b /etc/DIR_COLORS)"

Enabling DISPLAY environment variable for X11 forwarding from cygwin

I want to do this so I can forward commands to gnuplot from a shell script I have on cygwin, the steps where taken from here and there

Make sure you have the x11 packages installed in your cygwin and go to step 3, if not start from 1

  1. Run the Cygwin installer (You can obtain cygwin from here: http://www.cygwin.com/setup.exe

  2. At the package list, select to install all packages that are under the X11 category. Click next, accept all the dependencies, and install

  3. In the Cygwin shell,

    run startxwin
    
  4. In your Cygwin shell,

    run export DISPLAY=:0.0.
    

You'll need to repeat step 3 every time you reboot your computer, and step 4 every time you open a new Cygwin shell, or just do

echo "export DISPLAY=:0.0" >>~/.bash_profile

to have it run automatically whenever you create a new shell