ES Praktikum Tipps
Hier findet ihr Hinweise und Tipps für die Durchführung der Aufgaben im ES Praktikum
Chapter 9 - Interfacing to Handheld Devices
Exercise 9.2
Preparation: NutSleep(500)
is more reliable.
Exercise 9.3
You can copy-paste a code template incorporating steps 1-4 here. If you do steps 1-3 by yourself, observe the following hints.
Step 3: You can copy-paste the code for step 3 here.
Step 4: Don't forget to insert NutSleep
statements after every command issued to the mobile phone. For NutSleep
, you need to #include <sys/timer.h>
.
For writing a terminal function use:
void myfunc(char* arg){ ... }
and
btn_terminal_register_cmd("mycmd", myfunc);
Hard-coding a Bluetooth address:
// bt-address of the phone (reverse order !) bt_addr_t BTaddr = {0x9f, 0xef, 0x61, 0xde, 0x0f, 0x00};
Optional Exercise 9.4
You can copy-paste the required code from here.
If you do not want to solve optional exercise 9.4, you can hard-code a PDU message using the following template. Modify the phone number according to the tutorial.
Template
sends "Greetings from the BTnode." to the number +41765700723
u_char line1[] = "AT+CMGF=0\r"; u_char line2[] = "AT+CMGS=36\r"; u_char line3[] = "0025000b911467750027f300001a4779b94c4fbbcf739059fe6e83e8e832484875bfc96517\x1a"; ... bt_rfcomm_send(handle, line1, strlen(line1)); ...
Exercise 9.5
If you're stuck, you can take a glimpse at an example solution.
General Problems
- On some mobile phones you have to connect to channel 2 (dlci 4) or even channel 3 (dlci 6).
AT Command Reference for Sony Ericsson: http://developer.sonyericsson.com/getDocument.do?docId=65054 Bluetooth Developer Kit for Lego Mindstorms NXT: http://mindstorms.lego.com/Overview/nxtreme.aspx
Chapter 7
Exercise 7.2 and 7.3
Understand the HCI Command packet structure, and run the inquiry command using the following template. Play with the packet structure and try for instance to find up to 8 devices instead of 5. Try to understand the code, to see what is going on.
Copy paste code from here: Attach:inquiry.zip
Chapter 8
Sensor boards
You will have to share one sensor board with another group. You can still prepare compile and upload the exercises without the sensors.
Exercise 8.1
Templates:
- You can download the templates here: Attach:mhop-sensor-template2.zip
- Extract the
mhop-sensor-template
directory to the/btnut_snap/app/
directory.
Exercise 8.2
For these exercises you need to use a more complete extras
directory than the one provided in the btnut_snap distribution.
- Download the zipped complete version from here: Attach:extras-trace.zip
- Extract the
extras-trace
directory to the/btnut_snap/
directory. - You can then edit the Makefile under the
/btnut_snap/app/mhop-sensor-template/sensornode
directory by setting to use theextras-trace
instead of theextras
directory in theSRCS
section
Exercise 8.3
Add the following statement before the btn_terminal_run()
in your main()
routine:
btn_hardware_io_power(1);
Exercise 8.5 b)
Access-nodes: 00:04:3f:00:00:25
you must define it with big endian notation (reverse order)!
Chapter 6 - Embedded Debugging
Optional Exercise 6.1
Das AVRStudio Tool läuft nur unter Windows, kann also nicht auf den Praktikumsrechner gestartet werden. Ziel dieser Aufgabe ist jedoch lediglich sich einen Überblick über verfügbare Tools zu machen. Googeln Sie sich durch. Folgende Webpages helfen weiter:
- http://www.atmel.com/dyn/products/tools.asp?family_id=607
- http://en.wikipedia.org/wiki/In-circuit_emulator
- JTAG ICE User Guide
Exercise 6.3
Punkt 2: Nach dem -I kann auch ein Leerzeichen eingefügtwerden. Damit kann man den Pfad einfach mittels TAB-completition eingefügt werden.
Optional Exercises 6.4 & 6.5
Diese Aufgaben können nicht auf den Praktikumsrechner ausgeführt werden.
Preparation for Exercise 6.6
You have to download and install the btnut_system (not btnut_snap). Only the btnut_system contains all the required sources. You can redo exercise 2.2 for setting up a project.
Exercise 6.6
Punkt 4. Matlab
- Entpacken (unzip) Sie folgendes Archiv mit Matlab-Files in ein Verzeichnis, von wo aus Sie Matlab starten: es-matlab.zip
- Das Tracefile erstellen sie am bessten indem sie
- im minicom
CTRL-A L
druecken und ein neues trace-file wählen (nicht ein bestehendes verwenden, da minicom die Daten hinten anhängt), trace print
ausführen,- mit
CTRL-A L
(close) das capture-file wieder schliessen
- im minicom
Hinweise:
- Falls es nur einen Trace-Eintrag gibt, wurde die App nicht mit den richtigen (mit dem -DNUTTRACER Flag kompilierten) Bibliotheken gebuildet.
- Das Matlabscript kann Threadnamen mit Leerzeichen z.B. "My Thread" nicht richtig parsen.
Chapter 2 - First Steps
Exercise 2.2
- Aktueller Snap Shot (precompiled binary vers. 1.8) von hier herunterladen.
- 'btnut_snap/include' mit Hilfe von 'Add include Path from Workspace'
Exercise 2.3
- Alle Referenzen suchen funktioniert nicht. Alternativ kann mit 'Search Text -> Workspace' gesucht werden
Exercise 2.12
- /var/log/messages funktioniert nicht. Teste Seriellen Port mit:
avrdude -pm128 -cavrispv2 -P/dev/ttyS0 bzw. S1...
Exercise 2.13
- hex-file von hier herunterladen.
Exercise 2.15
Minicom (Linux)
Auf den Tardis Rechnern sollte minicom bereits richtig Konfiguriert sein, um mit den BTnodes zu kommunizieren. Benutze dazu den version 2.1
minicom-2.1 usbX (X steht für den benutzten COMPORT)
Ansonsten kann minicom auch manuell konfiguriert werden:
- minicom /dev/ttyUSB0 (or whatever COMPORT you are using)
- Type Ctrl-A followed by O (the letter, not the number) for configuration
- Choose Serial port setup
- Choose E for communication parameters, then select H and Q (i.e., 57600 8N1)
- Use F and G to disable all flow control
- Hit Return/Enter
- Save settings (Ctrl-A Save as..)
- Choose Exit
- For help, type Ctrl-A followed by Z.
- To exit minicom, type Ctrl-A followed by X
- You can also save default settings. See man minicom for details.