Atmel's ugly example code

Go To Last Post
19 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A bit of a rant here... but I'm getting tired of Atmel's buggy bloated example code. Mostly I've used their usb framework and examples, and for the most part its horrible.

I've found 6 pretty serious bugs, all of which have been reported and acknowledge. None of which have been fixed (I should probably post a summary of them here somewhere).

I routinely rewrite or reorganize their code and making it 10 to 50 percent smaller and *much* easier to read. The source is full of "helpful" comments like:

wVal = Usb_read_byte() //! read a byte

Maybe that comment is needed in case we get confused by the incorrectly applied 'w' hungarian notation. ;)

Beggars can't be choosers I guess, and I do like Atmel's hardware. Except for the bugs, the example code does speed things up. But you would think that code meant for wide distribution and potentially wide use would get a little bit more love.

Is code from other vendors like this? I've only worked with Atmel so far.

-Brad

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think the guy writing the sample code is the same guy trying to shorten the Xmega errata. Even a better font would do much to improve its presentation.

A

AVR Studio 4 Ver. 4.18 684
avr-gcc Ver. 4.3.0
ISIS 7
ELECTRA

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Microchip's code is pretty good, as is TI's for the MSP430.

Leon

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

...of course...

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I must agree with the OP about the poorly-written Atmel code examples - meaningful comments are conspicuous by their absence, and I find the code very difficult to follow in a lot of cases.

Microchip's software examples definitely are far better written than Atmels, see for yourself:

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2121

Plenty of (useful) comments are provided, and I don't remember seeing many people complaining of bugs in the various support forums.

Microchip also has very useful peripheral libraries for their various compilers. They work very well, and are cleverly written so that the correct code is automatically included for every chip.

TI's code for the MSP430 is equally good:

http://focus.ti.com/mcu/docs/mcuprodcodeexamples.tsp?sectionId=96&tabId=1468

The vast amount of good quality application and example code is one reason why Microchip's devices are so popular. It works "straight out of the box", and saves designers a great deal of time.

Leon

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

;-)

Attachment(s): 

There are pointy haired bald people.
Time flies when you have a bad prescaler selected.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

LOVL
Brilliant, David

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nobody seems to have refuted my claims, though. 8-)

I still maintain that Microchip and TI have excellent code examples, on the whole, unlike Atmel.

The OP complained about Atmel's USB examples. Here is the Microchip equivalent for comparison:

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2651&param=en534494

Why can't Atmel do something similar?

I can't even download the AVR USB code examples, I get this for the two I tried:

"The requested page cannot be found. Please try using the search function."

Having to register for each download is something of a turn-off, as well.

I think that most people will probably give up and try Microchip instead!

Leon

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can only agree with the OP. I have also spent many hours rewriting the USB code. Much much worse was the code for the Ethernet board, the EIT. That had what was probably the worst code I've ever seen.

Most of Atmel's sample code is written in Rousset, France. I'm pretty sure the lack of useful comments can be contributed to the language barrier.
No offense to the French, blame their government for dubbuing the movies and still hoping French will be the next global language. (Maybe that's why they're trying to shut down the internet).

/Jesper
http://www.yampp.com
The quick black AVR jumped over the lazy PIC.
What boots up, must come down.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think that the French have given up on Franglais; it's quite ubiquitous in Paris, and everyone speaks it. The French TV news transmissions are spoken in excellent French, though, with very few, if any, anglicisms.

There is a rule in translating that the work should be done by a native speaker of the target language, perhaps Atmel should adopt it for program code.

Leon

Leon Heller G1HSM

Last Edited: Sat. May 2, 2009 - 11:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try my LUFA stack instead:

http://www.fourwalledcubicle.com...

It supports the entire USB AVR range, uses a permissive MIT open source licence, and comes with several boatloads of included device/host/OTG examples.

Hopefully you won't find too many bugs in it ;).

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dean, would you port that to a PIC for us?

Chuck Baird

"I wish I were dumber so I could be more certain about my opinions. It looks fun." -- Scott Adams

http://www.cbaird.org

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What's the point? The Microchip code is widely used, and works very well.

Leon

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

What's the point? The Microchip code is widely used, and works very well.

What's more it's self powered - if you ask it to bend over the sun shines out of its backside :lol:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> The Microchip code is widely used, and works very well.

On an AVR? Or what's the reason you're posting this in the AVR
forum?

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Chuck asked Dean to port his AVR code to the PIC, which seemed to be a strange request. I pointed out that it would be a waste of time, given that there is nothing wrong with the Microchip code. What is wrong with that?

Leon

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jesper wrote:
Most of Atmel's sample code is written in Rousset, France.
I always thought it was done by some interns. But that might explain it, too.

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
seemed to be a strange request

Or, it could have been a joke. A poke at a PIC, as it were.

Chuck Baird

"I wish I were dumber so I could be more certain about my opinions. It looks fun." -- Scott Adams

http://www.cbaird.org

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ArnoldB wrote:
jesper wrote:
Most of Atmel's sample code is written in Rousset, France.
I always thought it was done by some interns. But that might explain it, too.
Perhaps it's written by the interns in Rousset. :-)

/Jesper
http://www.yampp.com
The quick black AVR jumped over the lazy PIC.
What boots up, must come down.