-
Notifications
You must be signed in to change notification settings - Fork 0
/
beagleboneAI.txt
325 lines (212 loc) · 9.46 KB
/
beagleboneAI.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
322
323
324
325
flashing image:
http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Flashing_eMMC.
this time.....
usb connection:
http://192.168.7.2/
wifi: board does not have wifi built in. use usb wifi dongle
https://linuxcommando.blogspot.com/2013/10/how-to-connect-to-wpawpa2-wifi-network.html
https://www.linuxbabe.com/debian/connect-to-wi-fi-from-terminal-on-debian-wpa-supplicant
/sbin/iw dev
ip link show wlan0
sudo ip link set wlan0 up
ip link show wlan0
/sbin/iw wlan0 link
iwconfig
wpa_passphrase xxxxxxx >> /etc/wpa_supplicant.conf
cat /etc/wpa_supplicant.conf
sudo wpa_supplicant -B -Dnl80211 -i wlan0 -c/etc/wpa_supplicant.conf
/sbin/iw wlan0 link
enable wifi at boot
/sbin/iw wlan0 link
root:
sudo -i
edit interfaces
sudo nano /etc/network/interfaces
add:
auto wlan0
iface wlan0 inet dhcp
wireless-essid 444
pre-up wpa_supplicant -B -Dnl80211 -i wlan0 -c/etc/wpa_supplicant.conf
#post-up route add default gw 192.168.88.1 wlan0
post-down killall -q wpa_supplicant
sudo beagle-version
sudo beagle-version | grep
pip3 updates:
pip3 install --upgrade pip
pip3 install --upgrade setuptools
Configuring pins
https://forum.beagleboard.org/t/bb-ai64-gpio-basics/36032/8
In directory /opt/source/dtb-5.10-ti/
/opt/source/dtb-5.10-ti/src/arm64/overlays
run:
sudo make clean
sudo make
sudo make install_arm64
reboot
for uart and i2c add thes lines to your custom overlay dts file.
&bone_uart_1 {
/* tested with sudo agetty 115200 ttyS4 */
status = "okay";
};
&bone_i2c_2 {
status = "okay";
};
Adafruit gpio doesnt work with AI64 yet.
gpiod library.
https://pypi.org/project/gpiod/
https://forum.beagleboard.org/t/bb-ai64-gpio-basics/36032
https://github.com/brgl/libgpiod/blob/master/bindings/python/examples/watch_multiple_line_values.py
gpiodetect
gpioinfo
gpiofind P8_28
gpioset 1 72=0
uart and i2c
to check if ports are open
tree /dev/bone
screen /dev/ttyS4 9600
screen crtl+a . letter command D D quit
https://aperiodic.net/screen/quick_reference
or minitab -D /dev/ttyS4 (turn off hw / sw bit control)
BLINKA
pip3 install Adafruit-Blinka
pip3 install adafruit-circuitpython-lsm303agr-mag
pip3 install adafruit-circuitpython-lsm303-accel
pip3 install adafruit-circuitpython-lis2mdl
pip3 install adafruit-circuitpython-mma8451
Getting addafruit Blinka to work. (blinka 8.43.0)
currently AI64 is broken in the distribution.
it tries to read the nvmem to get the id, but that doesnt quite work and the pin map is not for ai 64.
need to fix it manually.
I suggest setting the chmod -R 777 to the dist-packages directory and sub directories
this will allow for editing of the .py files via winscp while logged in as debian.
reference instructions for setting up a "new board"
/usr/local/lib/python3.9/dist-packages
https://learn.adafruit.com/adding-a-single-board-computer-to-platformdetect-for-blinka/environment-setup
this is how i did it (its not clean, sorry its been over 30 years since i've been in a programming class)
the adafruit attempt piggybacks on DRA74X chip id (BBAI?) to attempt to keep this open for use i created pinai64.py instead of editing the pin.py files.
Under /usr/local/lib/python3.9/dist-packages
edit digitalio.py and add the following elif statement. (I put it under the DRA74X elif entry)
elif detector.chip.TDA4VM:
from adafruit_blinka.microcontroller.dra74x.pinai64 import *
edit board.py and add the following elif statement. (I put it under the BBAI elif entry)
elif board_id == ap_board.BEAGLEBONE_AI64:
from adafruit_blinka.board.beagleboard.beaglebone_ai64 import *
print("bbai64 select") #comment to troublshoot
under /usr/local/lib/python3.9/dist-packages/adafruit_platformdetect
edit board.py and add the following elif statement. (I put it under the BBAI elif entry)
there is a a try: statement near the bottom for the ai-64, this is trying to read 2-00500/nvmem this isn't right.
# try:
# # Special Case for AI64
# with open("/sys/bus/nvmem/devices/2-00500/nvmem", "rb") as eeprom:
# eeprom_bytes = eeprom.read(16)
# except FileNotFoundError:
# return None
instead use the get_device_model() method to obtain the board.
# beagle,j721e-beagleboneai64^@ti,j721e^@
I added following abothe the memory read try: statements.
board_value = self.detector.get_device_model()
if "BeagleBone AI-64" in board_value:
return boards.BEAGLEBONE_AI64
print ("board detected: ",board_value)
under /usr/local/lib/python3.9/dist-packages/microcontroller
edit pin.py and add the following elif statement. (I put it under the DRA74X elif entry)
elif chip_id == ap_chip.TDA4VM:
from adafruit_blinka.microcontroller.dra74x.pinai64 import *
edit __init__.py and add the following elif statement. (I put it under the DRA74X elif entry)
elif chip_id == ap_chip.TDA4VM:
from adafruit_blinka.microcontroller.dra74x import *
under /usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/dra74x create(copy) pinai64.py
https://github.com/adafruit/Adafruit_Blinka/issues/687
pinai64.py probably needs work, but it is corrected for the Ai64 gpio address (ex. 1, 20 for P8.3) refer to
https://docs.beagleboard.io/latest/boards/beaglebone/ai-64/04-expansion.html#bbai64-expansion
I couldn't find the address for the AI64 USRx LED's so they are not used.
pin.py under dra74x is for something else and all adresses are wrong.
I will link or past ai64.py separately.
# I2C2
I2C2_SCL = P9_19 # was i2c4_scl
I2C2_SDA = P9_20 # was i2c4_sda
under /usr/local/lib/python3.9/dist-packages/adafruit_blinka/board/beagleboard
edit beaglebone_ai64.py
change the from statement to:
from adafruit_blinka.microcontroller.dra74x import pinai64
instead of changing pin.xx_x 90 times i just added the following under the from statement: (i was tired)
pin=pinai64
I tested this for digital outputs seems to work. i2c was created successfully but not tested yet need to check uart/spi/i2c yet.
i2c
check i2c
ls -lah /dev/bone/i2c/
should see
lrwxrwxrwx 1 root root 11 Jun 18 2023 2 -> ../../i2c-5
scan devices
i2cdetect -r 5
the 5 is significant.
make sure under /usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/dra74x
pinai64.py
order port for i2c2-5 has to match 5, I2C2 (not 3, i2c4)
i2cPorts = (
(5, I2C2_SCL, I2C2_SDA), # default config
(5, I2C2_SCL, I2C2_SDA), # roboticscape config
(3, I2C5_SCL, I2C5_SDA), # roboticscape config
)
###################SHOW-pins##################################
https://github.com/kevinacahalan/bbai64_sketch_dt_setup_5_10?tab=readme-ov-file
sudo git clone https://github.com/kevinacahalan/bbai64_sketch_dt_setup_5_10.git
./show-pins.pl
PRU's
https://forum.beagleboard.org/t/ai64-pru-basics-very/32288
https://github.com/gitklindsayjr/Beaglebone_AI64_PRUS/blob/main/pru0_motor_control.tar.xz
state
echo 'stop' > /sys/class/remoteproc/remoteproc0/state
cp /home/debian//prumemtest.out /lib/firmware/prumemtest.out
cp /home/debian//Steppercontrolpru2.out /lib/firmware/Steppercontrolpru2.out
echo 'Steppercontrolpru2.out' > /sys/class/remoteproc/remoteproc0/firmware
echo 'prumemtest.out' > /sys/class/remoteproc/remoteproc0/firmware
echo start > /dev/remoteproc/j7-pru0_0/state
echo 'start' > /sys/class/remoteproc/remoteproc0/state
*************************************************************************overlay
need toi creat an overlay stepper.dts
cd /boot/firmware/extlinux/
add it to extlinux overlay
label BeagleBone AI-64 eMMC (default)
kernel /Image
append root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait net.ifnames=0 quiet
fdtdir /
#fdtoverlays /overlays/<file>.dtbo
#fdtoverlays /overlays/J721E-PRU-UIO-00A0.dtbo
fdtoverlays /overlays/steppercontrol.dtbo
initrd /initrd.img
dmesg | grep pru
ls -l /lib/firmware
head /sys/class/remoteproc/remoteproc*/name
cat /boot/firmware/extlinux/extlinux.conf | grep fdtoverlays
to tell what kernel is running
uname -srm
find -name "uEnv.txt"
search for memory location of pru
dmesg | grep remoteproc0
0b022000-0b0220ff : b034000.pru control
0b022400-0b0224ff : b034000.pru debug
0b034000-0b036fff : b034000.pru iram
remoteproc remoteproc0: b034000.pru is available
sudo k3conf dump processor
https://github.com/loic-fejoz/beaglebone-ai64-tutorial/tree/main/example-00-pru
echo 'stop' > /sys/class/remoteproc/remoteproc0/state
cp /home/debian//squarewave.out /lib/firmware/squarewave.out
echo 'squarewave.out' > /sys/class/remoteproc/remoteproc0/firmware
echo 'start' > /sys/class/remoteproc/remoteproc0/state
echo 'stop' > /sys/class/remoteproc/remoteproc0/state
cp /home/debian//Steppercontrolpru2.out /lib/firmware/Steppercontrolpru2.out
echo 'Steppercontrolpru2.out' > /sys/class/remoteproc/remoteproc0/firmware
echo 'start' > /sys/class/remoteproc/remoteproc0/state
Steppercontrolpru2.out
echo 'stop' > /dev/remoteproc/j7-pru0_0/state
cp /home/debian//squarewave.out /lib/firmware/squarewave.out
echo 'squarewave.out' > /dev/remoteproc/j7-pru0_0/firmware
echo 'start' > /dev/remoteproc/j7-pru0_0/state
/dev/remoteproc/j7-pru0_0/state
journalctl -b -1
journalctl --list-boots
ls -l /var/log/{boot.log,dmesg,kern.log}
sudo beagle-version | grep UBOOT
indigo_server -v -v
indigo_server -b -v -C -i