Arduino IDE

From Attie's Wiki
(Difference between revisions)
Jump to: navigation, search
m
m
Line 43: Line 43:
 
   bool use_u2x;
 
   bool use_u2x;
  
   // ATTIE!
+
   // **** Attie's Hack! - Start ****
 
   baud = 57600;
 
   baud = 57600;
 +
  // **** Attie's Hack! - End ****
  
 
   // U2X mode is needed for baud rates higher than (CPU Hz / 16)
 
   // U2X mode is needed for baud rates higher than (CPU Hz / 16)

Revision as of 17:26, 27 March 2010

To use the Arduino IDE on Fedora 12 you must do a few things:

$ 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

Then put the following in ./avrdude and give it execute permissions

#!/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

If you are programming wirelessly and using serial comms, for some reason you MUST select the same baud rate as the arduino bootloader. ATmega168 uses 9600 ATmega328 uses 57600

Feel free to use this hack:

...
 
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)));
 
...

See also: http://www.arduino.cc/playground/Linux/Fedora

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox