====== Serial module setup ====== ===== Linux ===== Tested on Ubuntu 8.04.01 desktop.\\ Works with [[http://gollem.science.uva.nl/cgi-bin/nph-download/SWI-Prolog/binaries/pl-5.4.7-190.i586.rpm|SWIPL 5.4.7-190]]. See [[http://www.swi-prolog.org/download/old?show=all|SWI-Prolog old binaries]]. ==== 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: * the appropriate device number (here 0 – rfcomm0), * the MAC address of the set instead of MAC_ADDRESS. 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, the device is paired and a PIN fixed. ==== Pairing ==== In Ubuntu, on which the configuration has been tested, there is applet bt bluez 0.25 available.\\ NXT main unit asks to enter the PIN. Then, the same PIN has to be reentered in the mentioned applet, which ends pairing. Previously paired devices can be seen by right-clicking the blue BT icon → Preferences → Bonded devices.\\ If the device is on the list, pairing should not take place. It is enough to set port parameters.\\ However, if the whole process of setting up the port and the possible pairing does not take place properly, please: * remove the device from the mentioned list, * you may also need to remove the entry in the NXT brick (please select in the menu → Bluetooth → My contacts {device} → Delete). Then re-set the port parameters, please. After a successful setup, you can proceed with the [[start#first_steps|first steps]].