-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathraspbiansetup.txt
321 lines (261 loc) · 9.84 KB
/
raspbiansetup.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
#Begin Installing Raspbian
#Download Raspbian Buster with desktop and recommended software from the following link
https://www.raspberrypi.org/downloads/raspbian/
#Go to the directory where the raspbianxx.zip image is downloaded and unzip. You should now have a raspbianxx.img file
#Assuming that you have a usb sdcard reader, find the mount location of your card reader
sudo fdisk -l
#If the location of your usb sdcard is /dev/sdX,
sudo dd bs=4M if=xxxraspbianxxx.img of=/dev/sdX conv=fsync
##Plug the sdcard into your rpi and power up. Make sure that you are connected to the internet.
#Enabling ssh
https://www.raspberrypi.org/documentation/remote-access/ssh/
#Enabling VNC
https://www.raspberrypi.org/documentation/remote-access/vnc/
#Installing package
sudo apt install tightvncserver
#Configuring vnc
#On terminal
vncserver
vncserver -kill :1
nano .vnc/xstartup
#paste the following
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startlxde
#save and exit
#This has to be done only once
nano ~/vncstart.sh
#!/bin/bash
vncserver :1 -geometry 1200x700 -depth 16 -pixelformat rgb565
#save and exit
#This has to be done only once
#Start the vncserver
bash ~/vncstart.sh
#This has to be done everytime the pi reboots
#End Installing Raspbian
#Begin Python Installation
#Python configuration
#Open a terminal and type the #following commands
sudo apt update && sudo apt upgrade
#Install subversion
sudo apt install subversion
#Check python3 version
python3 --version
sudo update-alternatives --list python
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
pip install --upgrade pip
#Installing python for math computing
sudo apt-get install libatlas-base-dev gfortran python-pybind11
sudo pip install setuptools numpy scipy matplotlib mpmath sympy cvxpy
sudo pip install cvxopt
#if cvxopt fails, then
sudo pip install -Iv cvxopt==1.1.8
#End Python Installation
#Begin latex installation
sudo apt install texlive-full texmaker okular
#End latex installation
#Begin Latex and Python Testing
#Download Test Directory for LaTeX and Python
svn co https://github.com/gadepall/school/trunk/training
#Testing python installation
#Open geany and execute the following file for numpy
training/math/codes/tri_sss.py
#by pressing F5
#and the following file for scipy
training/chemistry/codes/chembal.py
#Testing Latex Installation
#For latex document, open
training/chemistry/gvv_eq_balance.tex
#and press
F2, F4, F8 and F7
#For latex slides, open
training/presentation/example.tex
#and press
F2, F4, F8 and F7
#For latex figures, open
training/math/figs/tri_sss_alone.tex
#and execute
#For including figures in a latex document, open
training/math/gvv_math_eg.tex
#and execute
#End Latex and Python Testing
#Begin AVR installation
#Installing Arduino and AVR toolchain
sudo apt install arduino avra
sudo usermod -a -G dialout $USER
kill -9 -1
#login again
#Test Arduino IDE by following the instructions in
https://github.com/gadepall/arduino/blob/master/ide/setup/gvv_ard_ide_setup.pdf
#to execue the blink program
#AVR Assembly
#Download the following codes
wget https://raw.githubusercontent.com/gadepall/arduino/master/assembly/setup/m328Pdef/m328Pdef.inc
wget https://raw.githubusercontent.com/gadepall/arduino/master/assembly/setup/codes/hello.asm
#Configure geany and test AVR-Assembly by following the instructions in
https://github.com/gadepall/arduino/blob/master/assembly/setup/gvv_ard_assembly_setup.pdf
#AVR-GCC
#Download relevant codes from
svn checkout https://github.com/gadepall/arduino/trunk/avr-gcc/setup/codes
#Follow instructions in
https://github.com/gadepall/arduino/blob/master/avr-gcc/setup/gvv_avrgcc_setup.pdf
#for executing the codes
#End AVR installation
#Begin Wiring Pi Installation
git clone https://github.com/WiringPi/WiringPi.git
cd WiringPi && ./build
cp examples/blink.c ~/
cd ~/
#RPi has 3 types of pin numbers
#Normal numbering from 1-40
#BCM pio pin configuration which can be obtained by typing
pinout
#on the terminal and
#The wiring pi pin numbers can be obtained from
https://pinout.xyz/
#Connect wiring pi GPIO pin 0 (normal pin 11) of the pi to an LED
#This
#and execute the following code
gcc -Wall -o test blink.c -lwiringPi
sudo ./test
#The led should blink now.
#End Wiring Pi Installation
#Begin ARM-GCC Installation
#Arm Toolchain
#Base packages
sudo apt-get install git autoconf libtool make automake texinfo pkg-config libusb-1.0-0 libusb-1.0-0-dev gcc-arm-none-eabi libnewlib-arm-none-eabi telnet
#Create working directory
cd ~
mkdir -p ~/sandbox
cd sandbox
#Download Openocd
git clone git://repo.or.cz/openocd.git
#Download Example files
git clone https://github.com/gadepall/STM32F103C8T6.git
#Install openocd
cd openocd
./bootstrap
./configure --enable-sysfsgpio --enable-bcm2835gpio
make -j4
sudo make install
#SWDIO, SWCLK and RESET Pins for RPi-STM32 connection
#On the RPi, type
pinout
#This will give the GPIO pin configuration on the RPi. Now open
nano /usr/local/share/openocd/scripts/interface/sysfsgpio-raspberrypi.cfg
#and verify that the file contains the lines (at
#different locations)
# Each of the SWD lines need a gpio number set: swclk swdio
# Header pin numbers: 23 22
sysfsgpio_swd_nums 11 25
# Header pin numbers: TRST -26, SRST -18
sysfsgpio_srst_num 24
reset_config_srst_only srst_push_pull
#End pin configuration for SWDIO, SWCLK and RESET Pins for RPi-STM32 connection
#Pin Connections from RPi to STM
#Connect according to Table III in the following manual
https://github.com/gadepall/arm-embedded/blob/master/setup/gvv_stm32_tinker_setup.pdf
#sysfsgpio configuration for communication
cp ~/sandbox/STM32F103C8T6/refs/openocd.cfg ~/sandbox/openocd
nano startocd.sh
#Copy the following line
#!/bin/bash
sudo openocd -f /usr/local/share/openocd/scripts/interface/sysfsgpio-raspberrypi.cfg -c "transport select swd" -c "adapter_khz 1000" -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg
#save and exit
bash startocd.sh
#Open one more terminal and do the following
telnet localhost 4444
cd ~/sandbox/STM32F103C8T6/
#Open the makefile
nano ~/sandbox/STM32F103C8T6/Makefile
#Ensure that the make file configuration has the following
CC=arm-none-eabi-gcc
OBJCOPY =arm-none-eabi-objcopy
OBJDUMP = arm-none-eabi-objdump
arm-none-eabi-size $(PRJ NAME).elf
#at the appropriate locations
#Generating the bin file
cp ~/sandbox/STM32F103C8T6/examples/blink.c ~/sandbox/STM32F103C8T6/src/main.c
cd ~/sandbox/STM32F103C8T6/
make clean
make bin
#Flashing the bin file
#Go to the telnet terminal
reset halt
flash write_image erase main.bin 0x08000000
reset run
#A yellow LED on the stm32 board should start blinking
#End ARM-GCC Installation
#BEGIN ICOBOARD Installation
#Icestorm toolchain for ICOBOARD
#WiringPi is required, which is already installed earlier
#Base packages
sudo apt install build-essential clang bison flex libreadline-dev gawk tcl-dev libffi-dev mercurial graphviz xdot pkg-config libftdi-dev
#Icoprog
#On termuxarch run as root user
#With termuxarch and pizero, this is the only tool required at the pi
svn co http://svn.clifford.at/handicraft/2015/icoprog
cd icoprog && make install
#Icestorm
#On termuxarch run as normal user without sudo
git clone https://github.com/cliffordwolf/icestorm
cd icestorm && make -j4 && sudo make install
#arachne-pnr
#On termuxarch run as normal user without sudo
git clone https://github.com/cseed/arachne-pnr
cd arachne-pnr && make -j4 && sudo make install
#Yosys
#On termuxarch run as normal user without sudo
git clone https://github.com/cliffordwolf/yosys
cd yosys && make -j4 && sudo make install
#ICOBOARD Programming
#Download codes from
svn co https://github.com/gadepall/EE5811/trunk/icoboard_fpga/codes
#and connect pins according to Table 2 in
https://github.com/gadepall/EE5811/blob/master/icoboard_fpga/gvv_hemanth_icoboard.pdf
#Execute the code as
make v_fname=blink
#End ICOBOARD Installation
#Begin ESP32 Installation
#Install latest arduino
#Download the 32-bit arm version from
https://www.arduino.cc/en/main/software
cp ~/Downloads/arduino-x.x.x-tar.gz ~/
tar xf arduino-x.x.x-tar.gz
cd arduino-x.x.x
sudo ./install.sh
#End installation of latest arduion
#Espressif Board manager
#Follow instructions in
https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/boards_manager.md
#so that the ESP32s board appears in the boards option in the Arduino IDE
#Select your ESP32 board. In our case it is MH-ET Live
#Download the example file
wget https://github.com/gadepall/EE1320/raw/master/esp32/setup/codes/hello/hello.ino
#and execute. The onboard led should blink
#LED control using Wifi and ESP32
https://randomnerdtutorials.com/esp32-web-server-arduino-ide/
https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/SimpleWiFiServer/SimpleWiFiServer.ino
https://github.com/pavan1827/ESP-32/blob/master/esp32.ino
#LED control using Bluetooth and ESP32
https://circuitdigest.com/microcontroller-projects/using-classic-bluetooth-in-esp32-and-toogle-an-led
#End ESP32 Installation
#Begin I2C installation
https://github.com/gadepall/EE1320/blob/master/pi/i2c/gvv_pi_i2c.pdf
#End I2C installation
#Begin RS485 installation
#Install modbus on RPi
sudo pip install minimalmodbus
#Download the following and copy to the libraries folder in the sketchbook directory of Arduino.
git clone https://github.com/smarmengol/Modbus-Master-Slave-for-Arduino
# Make connections according to Table 2 and Fig. 2.1 in the document below
https://github.com/gadepall/EE1320/blob/master/pi/rs485/gvv_odroid_rs485.pdf
#Download the following code and run it from the arduino
https://github.com/gadepall/EE1320/blob/master/pi/rs485/codes/ard_slave/src/main.cpp
#Download the following python code and execute
https://github.com/gadepall/EE1320/blob/master/pi/rs485/codes/one_slave.py
#This configures the pi as master and arduino as slave
#The following code is for using two Ardunio saves
https://github.com/gadepall/EE1320/blob/master/pi/rs485/codes/two_slave.py
#End RS485 installation