Getting started with ARM micros on Linux

Description of your first forum.

Getting started with ARM micros on Linux

Postby ghost » October 19th, 2012, 9:00 am

I'm looking to step up in power from my AVRs into some ARM hacking. Unlike AVR stuff, I'm not really sure of everything that's out there, so I thought I'd list what I'm looking for and see if anybody knows something that matches.

I'm hoping to find:

-Something that works with Linux. Something like the AVR-GCC/AVRDude combo for AVRs would be perfect (command-line, free, open-source, works with Linux). I like being able to use my own text editor and flash from the command line (and not being restricted to one IDE/GUI flasher/whatnot)

-Something that I can get in non-devboard form. Meaning I'd like to have chips I can stick on a PCB and build standalone circuits after I've designed them. So it's all good to have a devboard for easy prototyping, but I need chips that I can use in permanent projects. SMD is OK, so long as the pin pitch isn't insanely small.

-Not too expensive would be a plus, but not strictly required. On the same order as AVRs would be fantastic ($xx for a programmer, $x for each chip)


So basically something in ARM form that I can use like I have my atmega328p's. The Cortex-m[01234] series looks good, though I'm not limiting myself to just that line if something else works really well.

Anything out there that meets that criteria?

The following threads have a few ideas:

viewtopic.php?f=4&t=2175
viewtopic.php?f=4&t=892
viewtopic.php?f=4&t=428&p=3071

From those, it's looking like the NXP LPC1343 (or whatever is similar that I find on their site) is good, though I don't know if the nice USB programming is just that one board, of if one can get plain chips that can be programmed similarly.

Sorry if the above paragraph has some glaring oversight/errors/misunderstanding. I haven't actually looked at said product yet (short on time right not)....

Thanks in advance!
ghost
 
Posts: 11
Joined: October 19th, 2012, 8:42 am

Re: Getting started with ARM micros on Linux

Postby UAirLtd » October 19th, 2012, 11:03 am

The LPC1343 (and newer LPC134x series) has the USB programming built-into ROM, so you can just get a bare chip and program over USB without having to mess around with bootloaders. Though you do need to have an external 12MHz crystal connected, because the USB stuff is the only thing that won't work off the internal crystal (I made that mistake the first time while designing the Forebrain - the internal 12MHz IRC oscillator is fine for taking the chip up to its maximum of 72MHz, but apparently isn't accurate enough to do USB stuff).

And as previous thread posts intimated, our Forebrain dev boards has the LPC1343, and we now have guides and instructions for getting it working on Linux, including an easy way to get around the ROM bug that affects drag & drop on linux and mac. And of course there's our easy-to-use LPC1343 library exclusive to Forebrain (though you could use it with any LPC1343 project)

As for compiler, it's based on GCC, and you'll be happy to know that we just use a Notepad++ text editor with a plugin that shows a console window at the bottom, and run the compiler through that (we provide a Makefile and everything so it's just "make all" once you've got the compilers installed).

Unfortunately it's an odd time for us, we had to rush to get our new website up and running for our quadrotor kickstarter project, and that meant that we didn't have time to grab all the Forebrain library reference and guides, and also the web shop. New website's here: http://www.uair.co/ but I'll be sorting out the Forebrain library reference and guides this weekend (hopefully).

Since we don't have a shop running you can't actually buy a Forebrain from us, and since we're lowering our prices after the Kickstarter, I'm feel it would be unfair for me to try to sell you Forebrain at its current price. So I'll tell you what, since you obviously know what you're doing, and you're exactly the kind of person Forebrain is designed for, and for this one-time only offer, I'm going to send you one for free. PM me, or use one of the email contact addresses on our website and we'll arrange things from there.

Also worth reading, we did similar for this individual: viewtopic.php?f=5&t=2268 and he has kindly provided a bunch of stuff for Linux on there as well.

Oh, also might be of interest is the LPC1347, has some REALLY neat features and improvements over the LPC1343 especially on the USB side of things (build in FULL USB stack!), we're working on libraries right now, and in the future might upgrade Forebrain to use that, but that's a few months away. Good luck to you.
User avatar
UAirLtd
 
Posts: 629
Joined: July 19th, 2011, 10:32 pm

Re: Getting started with ARM micros on Linux

Postby ghost » November 16th, 2012, 9:42 pm

As a follow-up, I just got my board today (thanks UAir!), and wrote up steps to get it working under Linux. It's not terribly difficult, fortunately, but there are some tricks. Anyway, in the hope of saving somebody some trouble, I've done a writeup (attached, with code). It's probably pretty rough, but I hope it gets the message across.

This how-to uses the GNU toolchain, and should work on any Linux setup, regardless of distro.

If people have comments/suggestions/improvements, I'd like to hear them.



Keywords: lpc13xx lpc14xx lpc1343 linux how-to forebrain arm gcc
Attachments
lpc1343_linux_example.tgz
How-to doc, example code
(31.3 KiB) Downloaded 52 times
ghost
 
Posts: 11
Joined: October 19th, 2012, 8:42 am

Re: Getting started with ARM micros on Linux

Postby ghost » November 18th, 2012, 8:54 pm

I've realized that the code provided in the previous post is somewhat incomplete. It'll work to some degree, but I've found at least the UART to be broken. I think it has to do with the clock not getting configured correctly (quick tests indicate it's running at 12 MHz, though I don't think that's the whole issue). I'm in the process of fixing it, and generally polishing up my package. When it's done, I'll post the new version.

Anyway, just a heads up that things might not work 100%.
ghost
 
Posts: 11
Joined: October 19th, 2012, 8:42 am

Re: Getting started with ARM micros on Linux

Postby UAirLtd » November 19th, 2012, 12:45 am

you should probably take a look at our Forebrain firmware libraries: http://www.universalair.co.uk/control/forebrain that has easy-to-use functions for doing all these things, it has some functions for switching the clock between 12Mhz and 72MHz. For example for the UART, it has some presets for common baud frequencies that use the fractional baudrate generator to get you bad rates up to 4Mbaud (4000000 baud) with <0.125% error.

You should be able to just drop everything in.

Using the library, your blink code looks like:

Code: Select all
#include "uafunc.h"

int main(void) {
    LEDInit(ALL);

    while(1) {
        LEDToggle(ALL);
        Delay(500);
    }
}


And in fact, the default code in the template has this (or something like this using setup() and loop() instead of main()).

The library is fairly complete, for example the LPC1343 has five 32-bit (actually the fifth is only 21-bits long) registers whose data survives soft-resets, the library has functions to read and write to these registers: WriteBootData#() and ReadBootData#() which lets you easily make use of this. Functions for setting brownout thresholds, function to return reset status (returns whether the last reset was caused by hardware rest, brownout, watchdog, software, or simply a clean power-up), functions for setting hysteresis and pull-up/down resistors on GPIO pins, individually configurable pin interrupts (and ISRs) for rising/falling edge or high/low level, USB HID and MSC functions, you name it, we have it. There is only one major pieces of functionality of the LPC1343 that we haven't mapped to easy-to-use functions, that's SPI slave mode (something we're working on).
User avatar
UAirLtd
 
Posts: 629
Joined: July 19th, 2011, 10:32 pm

Re: Getting started with ARM micros on Linux

Postby ghost » November 19th, 2012, 7:46 am

It actually occurred to me after posting this that I shouldn't be re-inventing the wheel... Yes, things seem to work fine when I use the UAir template (go figure... people who know what they're doing produce better results than somebody hacking something together). It took a tiny bit of tweaking to get it to work (replacing '#include "lpc13xx.h"' with '#include "LPC13xx.h"' and '#include "FatFs\diskio.h"' with '#include "FatFs/diskio.h"'.

In any case, I still intend to post updated directions and whatnot... they'll just include using the UAir template.
ghost
 
Posts: 11
Joined: October 19th, 2012, 8:42 am

Re: Getting started with ARM micros on Linux

Postby UAirLtd » November 19th, 2012, 10:56 am

I'm going to be honest with you, we didn't know what we were doing when we started writing that library, and we WERE hacking things together (we're hackers-turned-entrepreneurs remember). But by the time we finished with that library, we were quite good at it. So there IS value in reinventing the wheel, and that's to learn things by doing. We had to do this as we weren't happy with the way other libraries were written, and we needed to know the hardware inside-out anyway.
User avatar
UAirLtd
 
Posts: 629
Joined: July 19th, 2011, 10:32 pm


Return to General Talk

Who is online

Users browsing this forum: No registered users and 3 guests