Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

66%
+2 −0
Q&A I have to choose: Arduino or Raspberry pi.

Rasp PI is a PC in disguise - it is a single-board computer. As such it runs Linux and like any Linux PC, it doesn't allow real-time execution, direct access to physical addresses, deterministic ...

posted 4y ago by Lundin‭  ·  edited 4y ago by Lundin‭

Answer
#2: Post edited by user avatar Lundin‭ · 2020-10-09T06:17:40Z (about 4 years ago)
  • - Rasp PI is a PC in disguise - it is a single-board computer. As such it runs Linux and like any Linux PC, it doesn't allow real-time execution, direct access to physical addresses, deterministic single-process execution etc etc.
  • Writing drivers yourself is a complex process where you must follow the kernel's preferred way of doing so, so that your drivers co-exists with a whole lot of things that you may or may not have any use for. Overall, it comes with a whole lot bloat and complexity.
  • So it's a pretty useless tool for leaning embedded systems programming in general and microcontroller programming in particular.
  • - Arduino is a hobbyist microcontroller board suitable for those who want to learn how to use specific drivers and libraries written by others, instead of learning how to make those themselves. It's suitable for quick & dirty low quality applications when you want to get something cheap and questionable up and running quick, without caring about how you got there. It's not suitable for the purpose of learning microcontroller programming.
  • Arduino is using an outdated 8-bit architecture called AVR, developed some decades ago. Like any 8-bitter, it is very slow and inefficient, poor code efficiency, can't handle 32 bit integers well, not to mention floating point.
  • As such, 8-bittes comes with high average current consumption per line of C code, since they must chew through hundreds of instructions where a modern CPU would handle the same code in a single instruction.
  • Writing C code for 8-bit microcontrollers is actually quite intrictate, because of all subtle crap that goes on between the lines in the C language: integer promotion, implicit signedness changes, numerous cases of poorly-defined behavior when doing various arithmetic etc etc. 32-bitters are far more C friendly because then you can use 32 bit types consistently without having to worry so much about all the above mentioned issues.
  • Arduino is per default using C++. Writing C++ for 8-bit microcontrollers is pure madness. The language isn't suitable for such low end systems. Things like vtables, RTTI, exceptions, implicit heap allocation, C++11 auto keyword, static storage object constructors etc etc will create complete havoc. It is arguable if C++ is at all suitable for any embedded system, but that's another story...
  • ---
  • So my advise is to not pick either of these hyped, dangerous and harmful hobbyist platforms. Instead, get an evaluation board for a "bare metal" microcontroller of whatever flavour you prefer, then learn how to actually write microcontroller programs from scratch.
  • Generally, older 8 or 16 bitters are more simplistic in themselves, easy to learn assembler on, but harder to code C for. Learning the basics of assembler is great for understanding how computers actually work, and how C code gets translated to machine code. So while nobody writes whole programs in assembler any longer, it is still useful to learn.
  • Modern 32 bit ARM Cortex M is what most professionals use nowadays, but those parts tend to be more complex overall. Still I usually recommend these over obsolete low-end ones, because you'll learn to use something that is actually modern and useful. I wouldn't recommend any particular ARM flavour over another, they all have their own quirks and strengths. It might be worth checking out the tool chain first of all, find one you like and take it from there.
  • - Rasp PI is a PC in disguise - it is a single-board computer. As such it runs Linux and like any Linux PC, it doesn't allow real-time execution, direct access to physical addresses, deterministic single-process execution etc etc.
  • Writing drivers yourself is a complex process where you must follow the kernel's preferred way of doing so, so that your drivers co-exists with a whole lot of things that you may or may not have any use for. Overall, it comes with a whole lot of bloat and complexity.
  • So it's a pretty useless tool for leaning embedded systems programming in general and microcontroller programming in particular.
  • - Arduino is a hobbyist microcontroller board suitable for those who want to learn how to use specific drivers and libraries written by others, instead of learning how to make those themselves. It's suitable for quick & dirty low quality applications when you want to get something cheap and questionable up and running quick, without caring about how you got there. It's not suitable for the purpose of learning microcontroller programming.
  • Arduino is using an outdated 8-bit architecture called AVR, developed some decades ago. Like any 8-bitter, it is very slow and inefficient, poor code efficiency, can't handle 32 bit integers well, not to mention floating point.
  • As such, 8-bittes comes with high average current consumption per line of C code, since they must chew through hundreds of instructions where a modern CPU would handle the same code in a single instruction.
  • Writing C code for 8-bit microcontrollers is actually quite intrictate, because of all subtle crap that goes on between the lines in the C language: integer promotion, implicit signedness changes, numerous cases of poorly-defined behavior when doing various arithmetic etc etc. 32-bitters are far more C friendly because then you can use 32 bit types consistently without having to worry so much about all the above mentioned issues.
  • Arduino is per default using C++. Writing C++ for 8-bit microcontrollers is pure madness. The language isn't suitable for such low end systems. Things like vtables, RTTI, exceptions, implicit heap allocation, C++11 auto keyword, static storage object constructors etc etc will create complete havoc. It is arguable if C++ is at all suitable for any embedded system, but that's another story...
  • ---
  • So my advise is to not pick either of these hyped, dangerous and harmful hobbyist platforms. Instead, get an evaluation board for a "bare metal" microcontroller of whatever flavour you prefer, then learn how to actually write microcontroller programs from scratch.
  • Generally, older 8 or 16 bitters are more simplistic in themselves, easy to learn assembler on, but harder to code C for. Learning the basics of assembler is great for understanding how computers actually work, and how C code gets translated to machine code. So while nobody writes whole programs in assembler any longer, it is still useful to learn.
  • Modern 32 bit ARM Cortex M is what most professionals use nowadays, but those parts tend to be more complex overall. Still I usually recommend these over obsolete low-end ones, because you'll learn to use something that is actually modern and useful. I wouldn't recommend any particular ARM flavour over another, they all have their own quirks and strengths. It might be worth checking out the tool chain first of all, find one you like and take it from there.
#1: Initial revision by user avatar Lundin‭ · 2020-10-08T15:08:43Z (about 4 years ago)
- Rasp PI is a PC in disguise - it is a single-board computer. As such it runs Linux and like any Linux PC, it doesn't allow real-time execution, direct access to physical addresses, deterministic single-process execution etc etc.

  Writing drivers yourself is a complex process where you must follow the kernel's preferred way of doing so, so that your drivers co-exists with a whole lot of things that you may or may not have any use for. Overall, it comes with a whole lot bloat and complexity.

  So it's a pretty useless tool for leaning embedded systems programming in general and microcontroller programming in particular. 

- Arduino is a hobbyist microcontroller board suitable for those who want to learn how to use specific drivers and libraries written by others, instead of learning how to make those themselves. It's suitable for quick & dirty low quality applications when you want to get something cheap and questionable up and running quick, without caring about how you got there. It's not suitable for the purpose of learning microcontroller programming.

  Arduino is using an outdated 8-bit architecture called AVR, developed some decades ago. Like any 8-bitter, it is very slow and inefficient, poor code efficiency, can't handle 32 bit integers well, not to mention floating point. 

  As such, 8-bittes comes with high average current consumption per line of C code, since they must chew through hundreds of instructions where a modern CPU would handle the same code in a single instruction.

  Writing C code for 8-bit microcontrollers is actually quite intrictate, because of all subtle crap that goes on between the lines in the C language: integer promotion, implicit signedness changes, numerous cases of poorly-defined behavior when doing various arithmetic etc etc. 32-bitters are far more C friendly because then you can use 32 bit types consistently without having to worry so much about all the above mentioned issues.

  Arduino is per default using C++. Writing C++ for 8-bit microcontrollers is pure madness. The language isn't suitable for such low end systems. Things like vtables, RTTI, exceptions, implicit heap allocation, C++11 auto keyword, static storage object constructors etc etc will create complete havoc. It is arguable if C++ is at all suitable for any embedded system, but that's another story... 

---

So my advise is to not pick either of these hyped, dangerous and harmful hobbyist platforms. Instead, get an evaluation board for a "bare metal" microcontroller of whatever flavour you prefer, then learn how to actually write microcontroller programs from scratch.

Generally, older 8 or 16 bitters are more simplistic in themselves, easy to learn assembler on, but harder to code C for. Learning the basics of assembler is great for understanding how computers actually work, and how C code gets translated to machine code. So while nobody writes whole programs in assembler any longer, it is still useful to learn.

Modern 32 bit ARM Cortex M is what most professionals use nowadays, but those parts tend to be more complex overall. Still I usually recommend these over obsolete low-end ones, because you'll learn to use something that is actually modern and useful. I wouldn't recommend any particular ARM flavour over another, they all have their own quirks and strengths. It might be worth checking out the tool chain first of all, find one you like and take it from there.