Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The Vent project was based on the Arduino Nano [...]

That's an ATmega328, 5 V, 16 MHz, 32 KByte Flash ROM, 2 KByte RAM, 8 bit AVR core. It's a nice microcontroller, and it once was impressive.

Compare to the Arduino Zero:

ATSAMD21G18, 3.3 V, up to 48 MHz, 256 KByte Flash ROM, 32 KByte RAM, 32 bit ARM Cortex M0+.

It easily runs circles around the AVR at less power, and you really don't have to worry about memory or CPU speed as much as you have to do with AVR processors.

Note: This microcontroller was not designed to be fast. It was designed to be cheap and low-power, for battery-powered gadgets, probably running directly from a lithium primary cell (CR2032 or similar). And still, it runs circles around the AVRs. Of course, if you let it run at 48 MHz with no strict power management, it will drain a CR2032 quite fast. But as long as you have a battery pack or mains power, you don't have to worry about power management. It won't get warm or even hot. Your peripherals will most likely need much more power than the SAMD21.

One obvious problem when migrating projects are the voltage levels: AVRs on Arduino usually run at 5 V. They could run on 3.3 V and even lower, but the AVR core can't run at full speed with lower supply voltages. Or at least, that's what the datasheet said. Maybe it will run at full speed at 3.3 V, but that is out of spec. The SAM needs 3.3 V I/O voltage, the core runs on a much lower voltage (using an integrated LDO regulator). Interfacing CMOS components (any of the 4000 and 4500 series) is usually a no-brainer, they just work as well on 3.3V. The same is true for many I²C and SPI components (EEPROMs, ADCs, DACs, port multiplier). When driving bipolar transistors, you may need to reduce the base resistor a little bit. Driving MOSFETS is again often a no-brainer, they are voltage-driven, not current-driven. But you may have to check if the MOSFET actually switches with a gate voltage of only 3.3 V. Some don't.

Another, closely related problem is the current sink and source capability of the microcontroller. The AVRs can sink or source 40 mA, depending on the Model. The SAMD21 can sink or source only 2 mA, switchable to 7 mA. So if you drive "high" current components directly from AVR pins, you will need some kind of amplification - a transistor, a logic buffer, or (for analog pins) a voltage follower. If you drive an LED directly from a pin, you need to change the series resistor and perhaps have to change the LED for a low-current, high efficency one.

The SAMD21 does not have an integrated EEPROM. There are some few models that can transparently emulate an EEPROM using a part of the internal flash, but none of them can be found on an Arduino board. But it should be possible to use the self-programming capability of the SAMD21 to manually emulate an EEPROM in the internal flash.

Comparing the prices:

At work, we really like the SAMD21, it has retired the ATmega series within weeks. No new project uses ATmegas any more. The SAMD21 needs less power, is faster, has more resources, more peripherals build-in, more I/Os, has up to six highly flexible SERCOMs offering I²C, SPI, and USART in a single peripheral, and is cheap. Less than €3.00 for the top-model SAMD21J18A, less than €1.50 for smaller ones.

Plus, the big Sparkfun breakout board linked above is a really cheap way to prototype a new device, as almost all controller pins are available on pin headers. At less than €30.00 delivered, we even don't care if we kill one of those boards during development. (So far, we have not managed to kill one.) Yes, it lacks the EDBG. But we have plenty of ICE programmers available, so not having an EDBG blocking pins is actually an advantage for us. The smaller Sparkfun board does not bring out all processor pins. Not a big deal for most projects, but sometimes you really want all pins. So we prefer the larger board.


See also:

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re^6: Call function no more than every 0.1 seconds by afoken
in thread Call function no more than every 0.1 seconds by zapoi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (8)
As of 2024-04-23 17:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found