Arduino IDE

From Attie's Wiki
Revision as of 00:03, 18 November 2010 by Inumitope (Talk | contribs)

Jump to: navigation, search

>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">

  1. !/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



UNDER COSTRUCTION, PLEASE SEE THIS POST IN RESERVE COPY


CLICK HERE


Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox