Author Topic: Getting started with microcontrollers  (Read 7650 times)

0 Members and 2 Guests are viewing this topic.

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11550
  • Country: ch
Re: Getting started with microcontrollers
« Reply #100 on: March 19, 2024, 09:42:44 pm »
Yep it is much the same. The main processor is the ATmega328P and that is what is needed.

The bonus on this one is the 16U2 MCU they use for the communication with the PC. So yes you can save yourself some money.
Thanks. From some of the posts I had understood that the Arduino includes some kind of boot firmware or something like that which makes it work with the IDE on the computer and I want to make sure this will also work. If it works exactly the same then I will get it but if I need to tinker with it before I even get started then I would rather pay $10 more and save myself the trouble.
Having the bootloader is a key element of an Arduino board. They’re never intended to ship out without one.


The only complication clone boards have over the genuine Arduinos is the USB-serial bridge: genuine ones (which use a second Atmega MCU with custom firmware as the bridge) don’t need any USB-serial driver on a Mac or Linux, and on Windows the driver is installed with the IDE if I recall correctly. The clones use one of a number of USB-serial bridge ICs (CH340, CP2102N, FT232, etc.), which all work fine, but typically require the user to install a driver manually. Once you’ve done that, the clones work identically to the originals.
 

Offline zilp

  • Regular Contributor
  • *
  • Posts: 206
  • Country: de
Re: Getting started with microcontrollers
« Reply #101 on: March 20, 2024, 12:22:28 am »
The only complication clone boards have over the genuine Arduinos is the USB-serial bridge: genuine ones (which use a second Atmega MCU with custom firmware as the bridge) don’t need any USB-serial driver on a Mac or Linux, and on Windows the driver is installed with the IDE if I recall correctly. The clones use one of a number of USB-serial bridge ICs (CH340, CP2102N, FT232, etc.), which all work fine, but typically require the user to install a driver manually. Once you’ve done that, the clones work identically to the originals.

Drivers for all the usual USB UARTs are in the vanilla Linux kernel, so that's a complete non-issue on Linux.
 
The following users thanked this post: tooki

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: nz
Re: Getting started with microcontrollers
« Reply #102 on: March 20, 2024, 12:52:46 am »
If I may interrupt for a moment....

I see ELEGOO UNO R3 Board ATmega328P with USB Cable(Arduino-Compatible) for Arduino which looks exactly the same and is $10 cheaper. Is it a clone that I can use exactly the same? Can I get this Elegoo board and use it just the same?

https://www.amazon.com/ELEGOO-Board-ATmega328P-ATMEGA16U2-Compliant/dp/B01EWOE0UU/ref=sr_1_2_sspa

The ELEGOO stuff is great. I have a number of their Uno and Mega2650 boards, in preference to official Arduino. They also have very good bundles with sensors and servos and misc electronic components for people who don't already have that stuff.

It works exactly the same as the official board in every respect. Will take 2 minutes to make it work.
 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: ua
Re: Getting started with microcontrollers
« Reply #103 on: March 20, 2024, 04:26:37 am »
You clearly don’t see or understand the value of getting a beginner going with a low barrier to entry. Early successes are encouraging, and make the learner experience that they can get it to do something.

Yes, I don't see any barriers here to entry for beginners. The only barrier here is a mind lock like "it looks unclear and not familiar for me, so I don't  want to look into it and don't want to learn it". This is not a barrier, but just an unwillingness to learn something new.
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1440
Re: Getting started with microcontrollers
« Reply #104 on: March 20, 2024, 05:30:08 am »
Yep it is much the same. The main processor is the ATmega328P and that is what is needed.

The bonus on this one is the 16U2 MCU they use for the communication with the PC. So yes you can save yourself some money.
Thanks. From some of the posts I had understood that the Arduino includes some kind of boot firmware or something like that which makes it work with the IDE on the computer and I want to make sure this will also work. If it works exactly the same then I will get it but if I need to tinker with it before I even get started then I would rather pay $10 more and save myself the trouble.
Having the bootloader is a key element of an Arduino board. They’re never intended to ship out without one.


The only complication clone boards have over the genuine Arduinos is the USB-serial bridge: genuine ones (which use a second Atmega MCU with custom firmware as the bridge) don’t need any USB-serial driver on a Mac or Linux, and on Windows the driver is installed with the IDE if I recall correctly. The clones use one of a number of USB-serial bridge ICs (CH340, CP2102N, FT232, etc.), which all work fine, but typically require the user to install a driver manually. Once you’ve done that, the clones work identically to the originals.

Hi,

This isn't the same thing, but I've gotten Nano's with bad boot loaders.  One time I could program the boot loader in myself over the old one and it worked after that, but one never worked so I had to use the miniUSB programmer to program that one board, but only that one.
The miniUSB programmer is not expensive either and it's good to have one, or another Arduino set up to program another Arduino.

On the topic of the Arduino itself again...
I think the boards like the Uno and Nano have a really nice number of i/o pins which makes them quite useful
I was really surprised at the number of i/o pins on the Mega, quite a board!
I was a little disappointed that the Due only works on 3.3 volts.  Most of the stuff I had at the time was 5 volts so it takes a lot more to get the i/o pins to interface with 5 volts using a Due.  Since there are a lot of i/o pins on that board too, it takes a lot of logic level shifters.  I did not like that idea because it detracts from the simplicity of the Arduino concept.
 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: ua
Re: Getting started with microcontrollers
« Reply #105 on: March 20, 2024, 07:00:03 am »
I would suggest to use STM32 board with SWD in-circuit debugger, it allows to program the chip and debug it inside circuit step-by-step with no need to have some bootloader in the microcontroller.

For example, this board supports SWD: https://www.aliexpress.com/item/1005006110046576.html
You're don't needs bootloader and serial port to program it. Just use some cheap Chinese ST-LINK USB-SWD interface.

With using SWD you can stop your program in microcontroller at any moment of time and discover it's state (registers/memory/peripherals) in debugger. It don't needs bootloader. This is very useful, especially if you're newbie and want to discover what happens inside microcontroller when you run your program.
« Last Edit: March 20, 2024, 07:58:53 am by radiolistener »
 

Offline xrunner

  • Super Contributor
  • ***
  • Posts: 7518
  • Country: us
  • hp>Agilent>Keysight>???
Re: Getting started with microcontrollers
« Reply #106 on: March 20, 2024, 11:27:28 am »
I would suggest to use STM32 board with SWD in-circuit debugger, it allows to program the chip and debug it inside circuit step-by-step with no need to have some bootloader in the microcontroller.

Baloney. That's like telling a newly licensed driver that they need to buy a OBD scanner to be able to analyze what's going on with their car if something confusing happens while driving.

Newbies - please don't listen to this person. Get an Arduino UNO and try some basic setups like lighting some LEDs or reading a temperature sensor. I've used them for more then ten years - Nano, Uno, Due, and the new Uno R4 and I've never once needed to debug any program step-by-step.

Just get one and have fun.  :-+
I told my friends I could teach them to be funny, but they all just laughed at me.
 
The following users thanked this post: tooki, pqass, pcprogrammer, Aldo22

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: ua
Re: Getting started with microcontrollers
« Reply #107 on: March 20, 2024, 12:30:29 pm »
Baloney. That's like telling a newly licensed driver that they need to buy a OBD scanner to be able to analyze what's going on with their car if something confusing happens while driving.

No. That's like telling a newly licensed driver that they need to buy parking radar for better learning to parking. Yes, they can do that without parking radar, but it will be much more complicated for them, because they don't get enough feedback what is going on around vehicle while they trying to parking in a limited space with poor visibility.

The same thing with in-circuit debugging for microcontrollers. It allows newbies to see what is going on in the microcontroller when they trying to do something. And it helps to understand it more easy why something going wrong and how to fix it. It will helps newbies a lot.

Newbies - please don't listen to this person. Get an Arduino UNO and try some basic setups like lighting some LEDs or reading a temperature sensor. I've used them for more then ten years - Nano, Uno, Due, and the new Uno R4 and I've never once needed to debug any program step-by-step.

In my opinion this is bad recommendation.
Well... I didn't wanted to talk my thoughts about arduino due to my negative attitude towards their libraries and IDE, but it appears that it needs to be explained.

Arduino is a bloated and very expensive marketing platform. When you use it, you're paying ten's times higher price and get very slow and very expensive MCU with a small features. Yes, they provide you with their branded IDE and libraries designed for noobs which allows to simplify copy-paste coding with no knowledge at all. But when you use it, you will not learn microcontrollers and you will get stick with arduino market. That's the issue.

I know guys who using arduino for about 10 years and still don't know how to deal with microcontrollers with no arduino platform (to be clear I'm talking not about you or someone in this thread). They are ready to pay hundred dollars for arduino development board just because they don't know how to deal with non arduino boards which cost just ten dollars and can provide you 100-1000 times higher performance, much more hardware features. This looks like crazy for me.

They are not newbie, but they stuck with these arduino products and don't know how to deal with non arduino boards at all. And they even don't want to learn something else. That's looks like some kind of disease, and I often see the same symptoms from many peoples, and they all have one thing in common - they started with arduino... :) 

This is not a joke, I really see that behavior, even in this thread several peoples demonstrated that "arduino" symptom... And this is not only my discovery. All my colleagues who professionally working with MCU also had exactly the same opinion about arduino...

I think the root of cause for that is that they started with a wrong way. In my opinion their main mistake is using arduino as a first platform. They started with arduino and this formed in them an attraction to this arduino market and a reluctance to learn anything else.

This is some kind of fast food, there are some peoples who like to eat fast food and just don't want to eat healthy and delicious food. They prefer to eat some fast food which cause cancer simply because it is full of chemical flavor enhancers... It become so crazy, that people consciously refuses healthy food and voluntarily eating fast food... And the things are even worse many of them well understand that this is bad for their health, but no longer able to abandon the chosen path...

Exactly the same issue with arduino. Of course this is your choice, but note, if you start with arduino it will learn you how to use arduino products, but not how to use microcontrollers.  ;)

Note that the faster way to code something and the best way to do it are different things.

PS: in my opinion spending money on Nano, Uno, Due and other marketing arduino stuff is a big waste of money. It's better to spend a little bit more time to learn with some STM32 board. You will get much faster MCU and much more hardware features at much cheaper price and you will not be tied to the arduino market platform.

If you're planning to learn microcontrollers for professional use, I strongly don't recommend to start with arduino.
But if you're don't planning to code for microcontrollers professionally, and just want to play with some electronic stuff for a short period of time, arduino platform may be the best solution for you, because it allows to use it with no knowledge at all, but at the price of much higher cost.
« Last Edit: March 20, 2024, 01:13:33 pm by radiolistener »
 
The following users thanked this post: BILLPOD

Offline zilp

  • Regular Contributor
  • *
  • Posts: 206
  • Country: de
Re: Getting started with microcontrollers
« Reply #108 on: March 20, 2024, 01:10:32 pm »
They are not newbie, but they stuck with these arduino products and don't know how to deal with non arduino boards at all. And they even don't want to learn something else.

There you have the reason why. People who don't want to learn, won't learn. I doubt that that has much to do with arduino, other than that arduino allows people to get things done to some degree without learning much.

And that especially so given that arduino has very little actual lock-in. I mean, it's all Free Software anyhow, and the hardware can be used just fine without an arduino specific software, too, so there really aren't any barriers to learning more, other than that people just don't want to.

PS: in my opinion spending money on Nano, Uno, Due and other marketing arduino stuff is a big waste of money.

Now, that might be true for genuine arduino boards, but especially for the ones you mention the market is flooded with clones, so those really don't have to be expensive. I mean, really, the arduino nano ist just the small-ish AVR equivalent of a blue pill for STM32: A standardized pinout board that is breadboard-compatible and that is cheap and convenient, if you buy clones, and that is perfectly usable without any of the arduino software (and on the flip side, my understanding is that you can use blue pill boards with the arduino IDE/framework stuff, too ...).
 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: ua
Re: Getting started with microcontrollers
« Reply #109 on: March 20, 2024, 01:26:01 pm »
A standardized pinout board that is breadboard-compatible and that is cheap and convenient, if you buy clones, and that is perfectly usable without any of the arduino software

that is also true for external modules, I'm often using arduino format sensors and modules with STM32 microcontrollers and with no arduino software.

But STM32 dev boards also compatible with breadboard. For example, bluepill with STM32F103C8T6 well fit on breadboard.

So, this is not unique specific of arduino dev boards.

And I don't see any advantage of using arduino dev boards with no arduino software.
Their microcontrollers are slower and had less hardware features than STM32 dev boards.
« Last Edit: March 20, 2024, 01:38:05 pm by radiolistener »
 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: ua
Re: Getting started with microcontrollers
« Reply #110 on: March 20, 2024, 01:48:11 pm »
I mean, really, the arduino nano ist just the small-ish AVR equivalent of a blue pill for STM32

No, that is mistake.

Arduino Nano uses ATmega328P which is 8-bit 16 MHz MCU with 32k FLASH and 2k RAM.

While bluepill uses STM32F103C8T6 which is 32-bit ARM core running at 72 MHz with 64k or 128k FLASH and 20k RAM.

In addition, STM32F103C8T6 has SWD interface and a lot of peripherals, include 12-bit ADC, PWM, CAN, I2C,SPI,Serial, etc.

This is like attempt to compare ZX Spectrum with Raspberry Pi  :D


Someone may say that ZX Spectrum is better for newbie than Raspberry Pi because Basic-48 is more easy to learn and newbie don't needs so many features from Raspberry Pi, but I would recommend to use Raspberry Pi for learning computers...  :)
« Last Edit: March 20, 2024, 02:00:09 pm by radiolistener »
 

Online dobsonr741

  • Frequent Contributor
  • **
  • Posts: 674
  • Country: us
Re: Getting started with microcontrollers
« Reply #111 on: March 20, 2024, 01:55:04 pm »
+1 for debugging in the Arduino IDE.

It was missing for a long long time, now it’s there. It’s there for a reason, and because it’s valuable. Printf/println debugging is a huge waste of time.

So the recommendation in year 2024, IMO, is to start with an Arduino supported M0 CPU, that has debugging support. Not for the first led blinky, but down the road it will save time and allows OP to make better progress and understanding.

A perfect example if $47 is not upsetting: https://store-usa.arduino.cc/products/arduino-zero?selectedStore=us

There are alternatives at lower cost, just not that neat single package as Zero.
« Last Edit: March 20, 2024, 01:59:18 pm by dobsonr741 »
 

Offline Picuino

  • Frequent Contributor
  • **
  • Posts: 730
  • Country: 00
    • Picuino web
Re: Getting started with microcontrollers
« Reply #112 on: March 20, 2024, 02:14:50 pm »
Setting up an 8-bit peripheral usually takes no more than a setup to 2 or 3 8-bit registers. It is relatively simple to understand and memorize so that you know what you are doing.

In the case of 32-bit microcontrollers it is a very different story. The number of bits to set is multiplied several times to make it quite difficult for someone who is just starting out.

The memory of the Arduino Uno R3 is more than enough to do all kinds of projects that someone starting out might need.
If at some point you want to upgrade to a more powerful board (for the same price as the UNO R3), you can switch to the Arduino UNO R4, with a 32-bit microcontroller, much more memory and input/output pins running at 5V.

I see that this topic is being completely ignored and it is fundamental. It has nothing to do with working with 5V or 3.3V. All external boards have to change to adapt to different working voltages.

 
The following users thanked this post: tooki

Offline Picuino

  • Frequent Contributor
  • **
  • Posts: 730
  • Country: 00
    • Picuino web
Re: Getting started with microcontrollers
« Reply #113 on: March 20, 2024, 02:21:14 pm »
https://store.arduino.cc/products/uno-r4-minima
Price: €18,00
Clock speed    48 MHz
Memory    256 kB Flash, 32 kB RAM
Circuit operating voltage    5 V
Input voltage (VIN)    6-24 V
DC Current per I/O Pin    8 mA       <--- much less than Atmega328P (typical for 32-bit microcontrollers)
 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: ua
Re: Getting started with microcontrollers
« Reply #114 on: March 20, 2024, 02:34:30 pm »
Setting up an 8-bit peripheral usually takes no more than a setup to 2 or 3 8-bit registers. It is relatively simple to understand and memorize so that you know what you are doing.

I don't agree. Most of usual arithmetic operations requires to work with 32 integers. It's not easy for newbie to do 32-bit arithmetic with several 8-bit operations in a row and using carrier flag. It's much more easy to do it with a single 32-bit operation, like it happens on STM32.

In the case of 32-bit microcontrollers it is a very different story. The number of bits to set is multiplied several times to make it quite difficult for someone who is just starting out.

No, this is not difficult. When you needs to add two 32-bit integer on 32-bit MCU, you're just use one add operation, it is much more easy to understand than a sub-routine which consists of several 8-bit operations in a row which is required on 8-bit MCU.

The memory of the Arduino Uno R3 is more than enough to do all kinds of projects that someone starting out might need.

ZX Spectrum had 48K memory which was more than enough for 3D games like Elite or Saboteur with a huge map. But this doesn't means that ZX Spectrum is better for newbie than Raspberry Pi for learning computers and programming languages.

If at some point you want to upgrade to a more powerful board (for the same price as the UNO R3), you can switch to the Arduino UNO R4, with a 32-bit microcontroller, much more memory

With STM32 you can more easy switch to more powerful core like STM32F7 which can run at 216 MHz with 462 DMIPS and use external 8MB RAM and 16 MB FLASH with graphics display support, hardware floating point and many other things.

and input/output pins running at 5V.
I see that this topic is being completely ignored and it is fundamental. It has nothing to do with working with 5V or 3.3V. All external boards have to change to adapt to different working voltages.

Regarding to 5V GPIO, bluepill already has a lot of 5V tolerant pins and can work with 5V signals with no issue.
For example, I control 2x16 LCD with 5V interface directly connected to STM32 bluepill with no issue.

As you can see 5V tolerant GPIO is not an issue for STM32 boards.
 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: ua
Re: Getting started with microcontrollers
« Reply #115 on: March 20, 2024, 02:50:56 pm »
https://store.arduino.cc/products/uno-r4-minima
Price: €18,00
Clock speed    48 MHz
Memory    256 kB Flash, 32 kB RAM
Circuit operating voltage    5 V
Input voltage (VIN)    6-24 V
DC Current per I/O Pin    8 mA       <--- much less than Atmega328P (typical for 32-bit microcontrollers)

https://www.aliexpress.com/item/1005005303669884.html
Price: 3.39 USD
Clock speed: 170 MHz
Memory: 128kB FLASH, 32kB RAM

Note that this is full 32-bit ARM core running at 170 MHz with hardware multiplier and floating point support, hardware DSP acceleration, 2 x 12-bit DAC and 12-bit ADC.

It has USB OTG FS port and 18 GPIO pins, more than in your example... ;)

https://www.aliexpress.com/item/1005006632336183.html
Price: 12.40 USD
Clock speed: 480 MHz
Memory: 2048kB FLASH, 1MB RAM

2 x 12-bit DAC, 3 x 16-bit ADC, FPU floating point unit, USB OTG and 82 GPIO



« Last Edit: March 20, 2024, 02:59:31 pm by radiolistener »
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: nz
Re: Getting started with microcontrollers
« Reply #116 on: March 20, 2024, 02:52:26 pm »
Setting up an 8-bit peripheral usually takes no more than a setup to 2 or 3 8-bit registers. It is relatively simple to understand and memorize so that you know what you are doing.

I don't agree. Most of usual arithmetic operations requires to work with 32 integers. It's not easy for newbie to do 32-bit arithmetic with several 8-bit operations in a row and using carrier flag. It's much more easy to do it with a single 32-bit operation, like it happens on STM32.

A newbie?  They are going to write "a = a + b" and a thing called a C compiler will turn that into the necessary four AVR instructions. Instructions which the newbie will never see or be aware of.

I don't know what to make of you. Maybe you're a troll. Or maybe you're special. Either way, newbies should be paying zero attention to you.
 
The following users thanked this post: tooki, pcprogrammer

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: ua
Re: Getting started with microcontrollers
« Reply #117 on: March 20, 2024, 03:04:39 pm »
A newbie?  They are going to write "a = a + b" and a thing called a C compiler will turn that into the necessary four AVR instructions. Instructions which the newbie will never see or be aware of.

Yes, C compiler hide it, but if you attach with debugger you will see that STM32 doing it with a single instruction, while 8-bit CPU requires several instructions to calculate 32-bit integers.

And you will need to know it in order to understand why 32-bit MCU do it much faster even if you configure both 32-bit and 8-bit MCU for the same clock frequency...
 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: ua
Re: Getting started with microcontrollers
« Reply #118 on: March 20, 2024, 03:17:06 pm »
I don't know what to make of you. Maybe you're a troll. Or maybe you're special. Either way, newbies should be paying zero attention to you.

There is nothing special. I just wonder why you're stick with these old very outdated and slow MCU for a high price, while there is much more cheap, much more fast and much more easy to debug MCU are available.

This is I would ask if you're a troll, but I understand that you seriously believe in this nonsense that these ancient and very expensive 8-bit controllers with no in-circuit debugging are better than modern 32-bit ARM cores... So, I just smile when someone trying to prove that this ancient 8-bit junk is better than modern 32-bit ARM controllers "because 8-bit is more easy for newbie"...  :D

As I mentioned before, this is the same as to saying that ZX Spectrum is better for newbie than Raspberry Pi, because ZX Spectrum has 8-bit registers, while Raspberry Pi has 64-bit registers which "is quite difficult for someone who is just starting"  :-DD To be clear, that is complete bullshit...  :)


For newbie STM32 will be more easy, because it allows him to easy debug the code inside the chip and it helps a lot even for professional developers to investigate what is going wrong and quickly fix it.

Much more fast core of STM32 and more memory also helps newbie, because it don't require to spend time on code optimizations, which definitely requires more knowledge and experience.
« Last Edit: March 20, 2024, 03:38:35 pm by radiolistener »
 
The following users thanked this post: dobsonr741

Offline aliarifat794

  • Regular Contributor
  • *
  • Posts: 50
  • Country: bd
Re: Getting started with microcontrollers
« Reply #119 on: March 20, 2024, 03:43:38 pm »
Starting with ARduino Uno will be better.
 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: ua
Re: Getting started with microcontrollers
« Reply #120 on: March 20, 2024, 04:01:24 pm »
Starting with ARduino Uno will be better.

Yeah, that's what I'm talking about...  :horse:  The mice wept, pricked themselves, but couldn't stop eating the cactus  :-DD

« Last Edit: March 20, 2024, 04:13:00 pm by radiolistener »
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: nl
Re: Getting started with microcontrollers
« Reply #121 on: March 20, 2024, 04:20:34 pm »
A newbie?  They are going to write "a = a + b" and a thing called a C compiler will turn that into the necessary four AVR instructions. Instructions which the newbie will never see or be aware of.

Yes, C compiler hide it, but if you attach with debugger you will see that STM32 doing it with a single instruction, while 8-bit CPU requires several instructions to calculate 32-bit integers.

And you will need to know it in order to understand why 32-bit MCU do it much faster even if you configure both 32-bit and 8-bit MCU for the same clock frequency...

A proper IDE with debugging also hides it. It just shows you the C code being debugged and you can look at the variables. Only when you use command line debugging in gdb you can see that, but that is not for newbies.

I have to say you are full of bullshit blurting in this thread about what a newbie should learn right away. Some can and will. Others take it slow and may go further and some will just stick with Arduino. Let them be.

Yes an ARM32 based MCU is faster than an AVR based MCU, but most of the time you don't need that speed.

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: ua
Re: Getting started with microcontrollers
« Reply #122 on: March 20, 2024, 04:51:11 pm »
A proper IDE with debugging also hides it. It just shows you the C code being debugged and you can look at the variables. Only when you use command line debugging in gdb you can see that, but that is not for newbies.

if you hide it completely, you will be unable to see that modifying 32-bit variable is not atomic operation on 8-bit MCU. So, you will not realize why accessing it from second thread or from interrupt with no synchronization can lead to incorrect value. While on 32-bit MCU such operation will be atomic (if stored at aligned address). So, hiding these details is a trap for you.

I have to say you are full of bullshit blurting in this thread about what a newbie should learn right away. Some can and will. Others take it slow and may go further and some will just stick with Arduino. Let them be.

This is okay if you have personal preference to use ancient and expensive MCU.
But please don't talk that using them is more easy.

If you're think that I didn't worked with old MCU, you're wrong. I wrote code in C/asm for very different platforms include 8080, Z80, 8048, 8051, PIC, AVR, MSP430, STM8, STM32, x86/x64, etc. Some of them had JTAG/SWD and some don't, so I know what I'm talking about and can compare which one is more easy.

Yes an ARM32 based MCU is faster than an AVR based MCU, but most of the time you don't need that speed.

They are not only much more faster, but they also much more easy to debug with JTAG/SWD.
And they provide you with much more features.
And they are much more cheap.

But some peoples still using old ancient MCU and still believes that it is better and more easy  :)
That is what I'm talking about.
« Last Edit: March 20, 2024, 05:54:20 pm by radiolistener »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Getting started with microcontrollers
« Reply #123 on: March 20, 2024, 06:34:09 pm »
You won't have to chase bugs if you don't put them in to start with.

I tend to use printf() or equivalent for debugging.  On any bare hardware project, the first thing I do is get the UART working.  Next, I add conversion functions like itoa() and a few string functions.

By all means, start with the Arduino UNO R3 and one of the Starter Kits at Amazon.  Like this one:

https://www.amazon.com/ELEGOO-Project-Tutorial-Controller-Projects/dp/B01D8KOZF4
« Last Edit: March 20, 2024, 06:39:06 pm by rstofer »
 
The following users thanked this post: tooki

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: nl
Re: Getting started with microcontrollers
« Reply #124 on: March 20, 2024, 07:08:46 pm »
This is okay if you have personal preference to use ancient and expensive MCU.
But please don't talk that using them is more easy.

I did not say that the AVR based MCU's are my personal preference. They are simpler in many ways than ARM, or other newer more fancy MCU's, and they all have there usage.

For a newbie learning to understand the AVR based ones definitely is easier just because the core is simpler and the peripherals are simpler. You yourself state to have learned it on the old 8 bit processors, and so do a lot of us here on the forum. These processors where and are simple to understand, even though math with bigger numbers is more complex. But we learned from them because most of us started using assembler. All the high level languages hide all of that. Take Basic, a very simple and easy to learn language, A = B + C could be done with big or even fractional numbers and it just works. The same applies for C, it hides stuff for you and in most cases there is no need to debug, because it just works. For many this is enough.

And that is what Arduino brings to a lot of people, and as said before that is good for them. Lets them play with fun stuff. For the more complex projects it might not suffice, for the more experienced programmer it might feel restrictive, but that is not the issue here.

This is about Soldar who wants to play with microcontrollers and does not want a big hurdle in front of him to keep him from doing so. And sure a bluepill board or an ESP32 can just as easily be used with the Arduino IDE, but might be more problematic for a beginner.

And the cost of it all is not your problem. If a person feels fine with a more expensive board that is his prerogative. True real Arduino boards are expensive and so are ST discovery boards. Fortunately there are many clones available, but they may have their pitfalls with cloned MCU's that do not function completely the same. And that is something you don't want as a beginner.

So lets just leave it at that and stop polluting this thread with personal believes about what you think he or any other newbie should do.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf