Archive for the ‘embedded’ Category

Building a working toolchain for AVR and Arduino development using Gentoo Linux

Wednesday, November 23rd, 2011

Problem:

Gentoo‘s crossdev is not able to compile a toolchain with one command in one process. Since I am using Ardunio for embedded prototyping I really needed to fix this!

If you don’t have crossdev installed just execute:

emerge crossdev

Here you find more information about crossdev

crossdev is modifying /etc/portage/package.use while compile time… :/ Before stage2 it adds the obsolete USE=”nocxx” flag to cross-avr/gcc. If you have USE=”cxx” flag set in /etc/make.conf or when USE=”cxx” is not set in make.conf it will fail to build; I think it is a default value. So you need to add USE=”-cxx” in /etc/make.conf at the beginning of the process. When crossdev reaches stage2 it removes USE=”nocxx” in /etc/portage/package.use and expects USE=”cxx” and not USE=”-cxx” in /etc/make.conf. If the compile error rises up, simply change USE=”-cxx” to USE=”cxx” in /etc/make.conf. Then execute the crossdev command again. Since everything before gcc stage2 is compiled already, crossdev is not doing it again and continues at gcc stage2 with the USE flag changes set.

Solution:

  1. /etc/make.conf: USE=”-cxx”
  2. crossdev -t avr
  3. Compile error at stage2
  4. Change USE=”-cxx” to USE=”cxx” in /etc/make.conf
  5. crossdev -t avr
  6. Installation complete! :)
  7. ln -s /usr/i686-pc-linux-gnu/avr/lib/ldscripts /usr/avr/lib/ldscripts

    This is filed in Gentoo bug #147155.

  8. For each AVR MCU you are using you need to do this:

    ln -s /usr/avr/lib/avr5/crtm168.o /usr/avr/lib/crtm168.o

    The Arduino IDE gives an error if the library for the used MCU is not found! Simply create a symlink for it and everything works… :/

  9. All done!

After all this pain in the last two days I have decided to build my own AVR toolchain in the future. I will never again go through this evil process of installing all this with packages provided by a Linux distribution regardless of Gentoo…

More about:

For Arduino users this solution does not fix the following problem:

https://wiki.archlinux.org/index.php/Arduino#delay.28.29_function_doesn.27t_work

It seems Gentoo is using a broken version of the avr-gcc toolchain. I have tried installing older versions of gcc, binutils and libc for AVR but with no luck. It took hours trying this out… :/

All the time I am getting problems related to the error described in the link from Archlinux above or much more complex problems I don’t wanna talk about. I am using the workaround described above for now but I think there must be a solution for these problems in the future.

I think this does not only happen for Arduino users because the compiled file implies the broken data and when writing it to an AVR using avrdude your program is broken regardless of Arduino. This is a problem for all people trying to use Gentoo for AVR development. After talking to some people on the Arduino develper list it seems not only Gentoo is broken at this place. Many distributions are shipping the latest avr-gcc version, utterly unaware how broken the most recent versions usually are.

I hope this information is helpful to someone and I wish good luck… ;)

BTW: I am using the wonderful GNOME based Arduino IDE called Gnoduino which I found by researching my problems today… ;) Give it a try! I love it because it natively runs on my Desktop, not GNOME but Xfce, without the use of JAVA.

Just ask me if you have questions!

Posted in: arduino, avr, cross, embedded, gcc, gentoo, gnoduino, howto, toolchain

Arduino Motion Sensor Server

Wednesday, May 25th, 2011

I tinkered a little bit this evening and I have added a motion sensor to the Arduino platform. After that I added a network shield and have coded a small HTTP server… This server provides just a 0 or an 1. 0 if I don’t have moved around; 1 if I am dancing on the desk… ;) The sensor works with a radius of about 5 to 7 meters and it is really a lot of fun. You could get such sensors very cheap at ebay, just search for “arduino motion sensor”.

Arduino Motion Sensor Server

I am getting the status every second using wget and are displaying the output in xterm. It looks nice to see how much I am moving when writing this Blog post:

Arduino Motion Sensor Server

Posted in: arduino, board, circuit, electronics, embedded

Arduino LM35 temperature sensor

Monday, April 11th, 2011

I am ill today and needed to distract me some bit.

I added a LM35 temperature sensor to my Arduino. Since someone did the work already, I only needed to copy some code and setup the wiring on a breadboard. I used the same wiring like in the link. Below is an image of the wiring made with Fritzing. I am using a LM335 for this because there where no LM35 as a Fritzing part available…

Arduino LM35 Wiring

I changed some parts of the code to only print the temperature as String to serial. In the original code the data was sent as (byte) over serial to read the value with an application created using Processing. Feel free to change this again… ;) This is the code I used:

float temp;
int tempPin = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  temp = analogRead(tempPin);
  temp = temp * 0.48828125;
  Serial.println(temp);
  delay(1000);
}

My output in the serial monitor of the Arduino IDE looks like this:

Arduino LM35 output

Posted in: arduino, avr, circuit, device, diy, embedded, fun, opensource, programming, sensor, wiring

Alex’ Tiny2313 Header Board

Sunday, April 10th, 2011

I got this nice Tiny2313 header board on Friday from Alex. Thanks for that nice piece of work!

It seems that I bought the last ones because there are currently no more of them in his shop available… :( But I think you could get one in the near future again. If not take a look at his site. All code and schematics are freely available there.

Tiny2313 header board

Soldering was a lot of fun and very easy to do. After successful soldering I build the small circuit at the end of the howto and flashed the microcontroller using the Makefile provided by Alex. I needed to change some things to make it work right on my Linux box using avrdude and the Atmel AVRISP mkII.

I changed the PROGRAMMER line to:

PROGRAMMER = -P usb -c avrispmkII

If you even get errors, try to add the parameters “-F” and “-D” to $PROGRAMMER. Call “avrdude –help” to get a description of these parameters… ;)

Don’t forget to add an external power supply to the header board since the AVRISP not seems to provide enough power. I got strange errors in the output of avrdude. After adding more power everything worked as expected.

The result: A blinking LED. Yeah! :)

Posted in: avr, board, circuit, device, diy, electronics, embedded, fun, header, opensource, programming

Arduino & Netduino synced communication and LCD animation

Saturday, March 12th, 2011

The Arduino and the Netduino are communicating over two digital IO lines. The animation is being synced over these lines. Rafel an I wanted to make the displays run. With success… but what next? Syncing both devices!

Since Rafael is developing on the Netduino platform and I am using the Arduino as platform, we had much fun putting these two devices together and let them talk to each other. This communication is used to keep the animation on both LCD displays in sync. There is a video below but it has a really bad quality. Focus your eyes on the LCD devices when watching it.

More information will follow in the next hours… ;)

Posted in: arduino, arm, device, dotnet, embedded, fun, lcd, netduino, opensource, programming

Pages

<<

Categories

account acta amsterdam android app arduino arm attiny automation avr beach board book circuit code community cross cyanogen denhaag denmark desaster deutsch device distribution diy dotnet electronics embedded extension firefox foo fosdem freedom freifunk friends fun games gcc gentoo german gnoduino hamburg header holiday host howto httpd internet irc jabber keitum kernel language lcd led lego leiden leo leo-search life linux madurodam mariadb matrix mindstorms minimal mobile monitoring moon music mysql nagios nas netduino netherland network news nxt ooc openmediavault opensource openwrt pcsc photos php politics programming question recovery robotics rsync sabayon scm sensor server service shell simulation smartcard snow soap space sun sweden sylt techno telemichel toolchain translation vpn website wine wiring wsdl xmpp zsh zynk

$Date: 2011-03-12 05:24:41 +0100 (Sat, 12 Mar 2011) $