Arduino IDE
Line 1: | Line 1: | ||
− | To use the Arduino IDE on Fedora 12 you must do a few things: | + | >To use the Arduino IDE on Fedora 12 you must do a few things: |
− | + | <pre> | |
$ yum install uisp avr-libc avr-gcc-c++ rxtx avrdude | $ yum install uisp avr-libc avr-gcc-c++ rxtx avrdude | ||
− | $ cd | + | $ cd <path to arduino>/lib |
$ rm librxtxSerial.so RXTXcomm.jar | $ rm librxtxSerial.so RXTXcomm.jar | ||
$ ln -s /usr/share/java/RXTXcomm.jar | $ ln -s /usr/share/java/RXTXcomm.jar | ||
$ ln -s /usr/lib/rxtx/librxtxSerial.so | $ ln -s /usr/lib/rxtx/librxtxSerial.so | ||
− | $ cd | + | $ cd <path to arduino>/hardware/tools |
$ rm avrdude | $ rm avrdude | ||
$ ln -s /usr/bin/avrdude ./avrdude2 | $ ln -s /usr/bin/avrdude ./avrdude2 | ||
− | + | </pre> | |
− | Then put the following in | + | Then put the following in <code>./avrdude</code> and give it execute permissions |
− | + | <source lang="bash"> | |
#!/bin/bash | #!/bin/bash | ||
cd `echo $0|rev|cut -d / -f2-|rev` | cd `echo $0|rev|cut -d / -f2-|rev` | ||
cla=$@ | cla=$@ | ||
− | while [ | + | while [ "$1" != "" ]; do |
− | if [ | + | if [ "`echo $1|cut -b-2`" == "-P" ]; then |
serprt=$(echo $1 | cut -b3-) | serprt=$(echo $1 | cut -b3-) | ||
break | break | ||
Line 27: | Line 27: | ||
stty hup -F $serprt | stty hup -F $serprt | ||
./avrdude2 $cla | ./avrdude2 $cla | ||
− | + | </source> | |
− | If you are programming wirelessly and using serial comms, for some reason your 'sketch' | + | If you are programming wirelessly and using serial comms, for some reason your 'sketch' <font color="red">MUST</font> use the same baud rate as the arduino bootloader otherwise you will have to directly program the arduino after the first time (or you can press reset at the correct time)<br> |
− | ATmega168 uses 19200 | + | ATmega168 uses 19200<br> |
ATmega328 uses 57600 | ATmega328 uses 57600 | ||
− | Feel free to use this hack: ( | + | Feel free to use this hack: (<code><path to arduino>/hardware/arduino/cores/arduino/HardwareSerial.cpp</code>) |
− | + | <source lang="cpp"> | |
... | ... | ||
Line 47: | Line 47: | ||
// U2X mode is needed for baud rates higher than (CPU Hz / 16) | // U2X mode is needed for baud rates higher than (CPU Hz / 16) | ||
− | if (baud | + | if (baud > F_CPU / 16) { |
use_u2x = true; | use_u2x = true; | ||
} else { | } else { | ||
Line 58: | Line 58: | ||
... | ... | ||
− | + | </source> | |
See also: | See also: | ||
http://www.arduino.cc/playground/Linux/Fedora | http://www.arduino.cc/playground/Linux/Fedora | ||
+ | |||
+ | ---- | ||
+ | <div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;"> | ||
+ | ---- | ||
+ | =[http://ucatovo.co.cc UNDER COSTRUCTION, PLEASE SEE THIS POST IN RESERVE COPY]= | ||
+ | ---- | ||
+ | =[http://ucatovo.co.cc CLICK HERE]= | ||
+ | ---- | ||
+ | </div> |
Revision as of 00:03, 18 November 2010
>To use the Arduino IDE on Fedora 12 you must do a few things:
<pre> $ yum install uisp avr-libc avr-gcc-c++ rxtx avrdude
$ cd <path to arduino>/lib $ rm librxtxSerial.so RXTXcomm.jar $ ln -s /usr/share/java/RXTXcomm.jar $ ln -s /usr/lib/rxtx/librxtxSerial.so $ cd <path to arduino>/hardware/tools $ rm avrdude $ ln -s /usr/bin/avrdude ./avrdude2 </pre>
Then put the following in <code>./avrdude</code> and give it execute permissions <source lang="bash">
- !/bin/bash
cd `echo $0|rev|cut -d / -f2-|rev` cla=$@ while [ "$1" != "" ]; do
if [ "`echo $1|cut -b-2`" == "-P" ]; then serprt=$(echo $1 | cut -b3-) break fi shift
done stty hup -F $serprt ./avrdude2 $cla </source>
If you are programming wirelessly and using serial comms, for some reason your 'sketch' <font color="red">MUST</font> use the same baud rate as the arduino bootloader otherwise you will have to directly program the arduino after the first time (or you can press reset at the correct time)<br> ATmega168 uses 19200<br> ATmega328 uses 57600
Feel free to use this hack: (<code><path to arduino>/hardware/arduino/cores/arduino/HardwareSerial.cpp</code>) <source lang="cpp"> ...
void HardwareSerial::begin(long baud) {
uint16_t baud_setting; bool use_u2x;
// **** Attie's Hack! - Start **** baud = 57600; // **** Attie's Hack! - End ****
// U2X mode is needed for baud rates higher than (CPU Hz / 16) if (baud > F_CPU / 16) { use_u2x = true; } else { // figure out if U2X mode would allow for a better connection
// calculate the percent difference between the baud-rate specified and // the real baud rate for both U2X and non-U2X mode (0-255 error percent) uint8_t nonu2x_baud_error = abs((int)(255-((F_CPU/(16*(((F_CPU/8/baud-1)/2)+1))*255)/baud))); uint8_t u2x_baud_error = abs((int)(255-((F_CPU/(8*(((F_CPU/4/baud-1)/2)+1))*255)/baud)));
... </source>
See also: http://www.arduino.cc/playground/Linux/Fedora