Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I suggest you try programming the AVR chips directly. I use Atmel studio to compile, notepad++ to edit , and the following to burn a chip:

https://www.amazon.com/High-speed-TL866CS-Universal-Programm...

Tutorial :

http://www.avrfreaks.net/forum/programmer-minipro-tl866-howt...



I've just started out with Arduino. What's the advantage of programming the AVR directly? I guess there's a bit more overhead you can remove? What are the cheaper options? That programmer you linked to seems like a fairly expensive option for someone just looking to get started — can you still use the Arduino board as an interface to program the chip?

Edit - Bonus question: when you use something like that programmer doesn't the code/write/move-chip-into-circuit cycle become really laborious?


I've been programming microcontrollers my entire programming career and now do a fair amount of work with Arduino.

The only advantage I've found to not using the Arduino libraries is when I need raw speed. e.g., a few months ago I had a project where I needed to read an analog input, calculate/lookup sine & cosine, do some math, and generate an output all within 300 uS.

At first glance, it seems trivial, but there was no way the Arduino libraries were fast enough. They are optimized for ease of use, not speed.

However, remember that in most modern programming, the programmer time is the most expensive variable. Using the Arduino libraries keeps that cost in check.


We often prototype and evaluate new hardware peripherals via Arduino. Once that's done, it's easy enough to port over to a bare AVR.


Two reasons for me:

Real product versus toy: The arduino libraries are not the standard AVR libraries you would use to program a real product. In a real product you would also never use an arduino, too expensive and bulky.

Also, the arduino ties up a bunch of pins and space compared to just the chip, for not much payoff in a typically sharp focus microcontroller use case.

I think the cost for a programmer is a wash when you consider that you only need to buy bare chips after you learn how to use the programmer.


Real products absolutely do use Arduino libraries, it's not a toy. They are just embedding the AVR directly for cost (and using an external programmer), but there's no reason the Arduino libraries don't work for products that ship. Arduino only eats two pins for serial - I suppose you could drop that if you wanted, but in practice most commercial products have a debug serial port anyway.


As I understand it the Arduino libraries are big, but I have never tried. What are the advantages to not just using the AVR libraries if you are embedding the chip in the circuit and using the programmer?


Functions you don't call get stripped out of the final binary. The advantage is you get a bunch of high level functions like analogRead() that do all the setup for you. avr-gcc/avr-libc mostly just provides register definitions, so it's likely you're going to duplicate most of the code inside analogRead() anyway if you roll it yourself.

That said, I've done plenty of projects with bare avr-gcc (especially for chips not supported by Arduino at the time) and it's not terribly onerous, but often you don't need that level of control for every little thing.


As an embedded developer, I would agree that there is this sentiment that arduino is somehow inferior, bigger code sizes, worse code quality, training wheels, etc.

However, I've recently used a couple different Teensy boards in some personal projects, which are a line of 3 or 4 different freescale kinetis cortex M0-M4 parts that have their own plugin for the arduino IDE. I've been very impressed with the breadth of libraries, and how well it all works and integrates between different boards. The code is well written, and looks like it could easily be dropped into arm-gcc. Maybe Teensy is the exception, but there are some high quality Arduino codebases out there.

Not being able to use in circuit debug tools is a huge pain, however.


A Pro Mini is 0.8 inch by 1.3 inch. What size do you consider not too bulky?


You can use avr-gcc, no need for a heavy ide.


I always found it odd that one "needed" a large amount of software (Windows, IDE) to program something so small.

Additionally, the IDE is often under the control of the manufacturer. I understand there are good reasons why this means there will be "bloat". Manfacturers are acting sensibly in their own self-interest.

As a hobbyist, I prefer chips that I can program using a UNIX-like OS that I can compile from source.

I prefer to program from VGA textmode, i.e., no GUI. I am not going to run Windows just to program a tiny microcontroller.

I am grateful for projects such as avr-gcc.


IIRC the avrasm2.exe assembler, when plucked from an Atmel Studio installation, also works surprisingly well being run via WINE on Unix.


I heartily recommend PlatformIO. It makes hardware programming much, much easier by handling dependencies, compilation, etc.


"Handling" dependencies automatically is fantastic when it works. But it reaches varying degrees of anarchy and hopelessness when it doesn't.

The more ambitious the framework, the more you have to wade through to figure out what it's actually doing when something breaks...I'd much rather have to deal with some cross-compilation headaches and dependencies than to be at a dead end when the 'black magic' stops working.


Or, I assume, when the company behind the service goes out of business or shifts focus...


That is a risk when you use any service, even if it is open source.


What kind of dependencies are we talking about? Compiler, BSP, peripherals?


Libraries, mostly:

https://platformio.org/lib

And yes, it handles compilation/flashing/etc automatically.


Yes, but there is less install with the IDE




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: