This is an old revision of the document!
Serial module setup
Linux
MAC
It is necessary to determine the MAC address of a LEGO Mindstorms NXT set. This can be done by scanning BT devices (of course after the BT adapter is connected and the NXT brick turned on):
hcitool scan
Device binding
The device can be bound manually:
rfcomm bind rfcomm0 MAC_ADDRESS
An alternative solution is to edit the rfcomm.conf
file, which causes an automatic binding at system boot:
gedit _etc_bluetooth/rfcomm.conf
Please add an entry to the file containing:
Pattern:
rfcomm0 {
bind yes;
device MAC_ADDRESS;
channel 1;
comment "NXT";
}
After editing the rfcomm.conf file it is necessary to restart BT:
_etc_init.d/bluetooth restart
Verification of the device binding:
rfcomm
Port settings
A serial port bound to the device must be properly configured to work with the NXT set:
sudo stty -F /dev/rfcomm0 -echo -icanon -iexten -isig -icrnl -inpck -istrip -ixon -cstopb cs8 parenb parodd -opost ispeed 115200 ospeed 115200
After that the first connection takes place, device is paired and the PIN fixed.
Parowanie
W Ubuntu, na którym testowano konfigurację, mamy do dyspozycji aplet bt bluez 0.25.
Jednostka centralna NXT prosi o wprowadzenie PIN-u. Następnie ten sam PIN wprowadza się we wspomnianym aplecie, co kończy parowanie.
Urządzenia wcześniej sparowane można zobaczyć klikając prawym przyciskiem niebieską ikonę BT → Preferences → Bonded devices.
Jeżeli urządzenie znajduje się na tej liście, parowanie w ogóle nie powinno zachodzić. Wystarczy samo ustawienie parametrów portu.
Gdyby jednak cały proces ustawienia parametrów portu i ewentualnego parowania nie przebiegał poprawnie, proszę:
usunąć z wyżej wskazanej listy urządzenie,
konieczne może też być usunięcie wpisu w NXT brick (należy wybrać z menu Bluetooth → My contacts → {device} → Delete)
Następnie proszę ponownie przeprowadzić ustawienie parametrów portu.
Po udanej konfiguracji można przejsć do pierwszych krokow.