Going from Arduino to ARM
HTML-код
- Опубликовано: 10 сен 2024
- This video will show how to make the transition from Arduino to ARM using Forth as a tool to communicate with the on board peripherals. This method will drastically reduce the learning curve.
Forth in Space:
www.forth.com/...
Who uses Forth:
www.forth.com/...
An electrical or computer engineer will pick the best part suited for the task. There are times when a high computational load means an ARM or DSP is more appropriate than an 8 or 16 bit controller. A DSP will likely outperform ARM when it comes to complex math, but that's what it's made for. The way to transition from Arduino to ARM would be using a standard UNO board and to start relying less on the Arduino libraries to abstract how things work. Instead of using digitalWrite() start manipulating the registers directly. It's about 10 times faster and it's an essential skill. Part of that is also reading and understanding the datasheet. It lists all the registers and has the info needed to work with the chip. Even in the Arduino IDE you don't have to use the Arduino libraries. If you don't know how you set up the ARM correctly you'll never get the power efficiency. The ATMEGA328P chip on the Arduino is capable of getting power draws down in microamps if you know what you're doing, but you can't get the best performance using the Arduino libraries.
In Part 1, we have soldered our Special Arduino board. In this video, I am going to show you how I upload my first code and what is the difference between ICSP and Bootloader methods?
The video link: ruclips.net/video/d7NEwXBQuNY/видео.html
Noob here and that's exactly what I plan to do. Watched EEvlog's video on the stm32l and there's no way I can handle that now. Greatscott and Joop Brokking have good videos on getting more advanced with the arduino and "stm32duino" software. Also I downloaded atmel studio and got a 8051 dev board so hopefully I can get started with that soon
Not necessarily true, most of the time in the industry engineers will stick with what they are trained and comfortable with, not neccessary the cheapest or most suited. Remember we do have time constraints, if you have 3 weeks to design the system, and it would take you at least that to learn and optimize a new topology, you aren't gonna do it lol
Don't write off us Mechanical Engineers. We can convince the magical wire-pixies to do what we want too ;)
Arduinos are still valuable learning tools. A good exercise I found was to use comminication peripherals directly instead of libraries. For example, reading data from an AM2320 sensor. This will involve not only learning how the Wire library works, but also reading the AM2320's datasheet. And once you got it working, you just learned how to use I2C and you could easily use a device that has no library yet for it. That was a nice learning step for when I stepped into STM32's HAL I2C commands.
I enjoyed the video, and the technique shown. Thank you! I'm really not convinced that learning Forth reduces the learning curve, though. Probably most people who have any hope of using that are going from avr-gcc not arduino. :)
Have heard that the best way to learn µcontroller arm stm32 is buy studying datasheet but the standard peripheral libraries as well. In other hand I'm not sure what IDE could help in this way.
The problem is that there is no online course that is designed to teach arduino users how to use the "super IDEs"and the arm boards the same way we learned to use and program arduino.Until then we will punch in the dark to make the led blink however we now have the stm32 cores library and stms Programer so we can make the led blink and many other things using the arduino IDE and using a "waveshare open board we now have all the outputs brought out in an organized fashion so in the end I am pretty sure arduino will WIN.
FORTH... wow... takes me back to my youth!
Takes me back to the 80's.
I have this eval board. I got a simple STM32F103 (blue pill) 2 or 3 bucks. Downloaded and flashed mecrisp-stellaris-forth. Arm cortex micros are complex. So I'm getting my chops down on the blue-pill. Forth is the way to learn the arm-cortex.
The only problem with going to Stm32 in any language is that you lose the libraries that have been written for the arduino. I think that is why the arduino is so popular.
Yeah not necessarily, I think the popularity of the arduino stems directly from the popularity of the arduino lol like the Kardashians, they're famous for being famous!
I believe many of the libraries still work, the pinouts are handled by a separate file, so the only thing that's broken is any flag related stuff I would think
Arduino Is so popular because it's so easy compared to ASM or real C
Arduino isn't really like programming MCUs is more like a non professional approach to what is really programming MCUs
If you really want to learn and know what you are doing first learn digital systems, then learn ASM so finally you understand what you are doing in C.
I'm in that position right now. I have been doing things into the Arduino ide and relying on the libraries written and I'm scared to transition off it. What's a decent way to go about it ?
@@kindaFunkyNGL you can program the arduino board in pure C using atmel studio.
@@noweare1 thank you I'll give it a try
Programming ARM in Forth! Great, I love it
Wow, I didn't know Forth was still alive.
Go Forth and multiply.. and divide, add, subtract, etc.
Sorry, but you don't really explain or give advice on how to learn the inside arm cortex and what IDE you actually used to program the code.
The main point I wanted to get across in the video was get to know the internal workings of the Arm micro and the best place to start is by reading the datasheets. Focus on the areas you will be working with, SPI, I2C, GPIO ..etc to get a general idea how they work. I then use FORTH and gain access to the Arm through the serial port where I can manipulate all the internal working of the Arm in real time using my keyboard. There is no IDE as all tools needed are running on the micro.
The Forth I am using is STMeforth720 available here: wiki.forth-ev.de/doku.php/projects:ting_s_electronic_forth_bookshelf
I hope that answers your question.
Ok I see. That's a good point to learn from the datasheet. I've learned micro from arduino and I'm now familiar with C programing. So I would prefer using C with IDE to learn ARM cortex with the mean of the Standard peripheral libraries (SPL). I'm not sure what "FORTH" actually is but it seems to be like a different way of programming more like binary language. am I right? Thank you anyway for your explanation.
Yes, Forth is very close to assembler language and for me it's a good learning environment because it's interactive.
After getting familiar with Arm, ST has a lot of free IDE tools available. Their newest tool STM32cubeMx is getting popular and C programmers would be right at home. www.st.com/en/development-tools/stm32cubemx.html
Yes stm32cubemx It's what I've been using for few months to learn stm32 micro along with SW4STM32 IDE. But I've discovered that even if this is an handy sw to set the peripheral devices , the "HAL" generated code is a bit heavy compared to arduino and I'm missing staying close to hardware. I finally learned that using the Low level libraries which used to be Standard peripheral libraries are more hardware oriented giving a better view over the registers. I don't undesrtand why there is an interactive needs for micocontroleur if you already have debugger tools and being able to read signals with some cheap analysers.
Yes I like the LL libraries also rather than HAL. I like to know the details and stay close to the hardware like yourself.
i can't believe how ancient this is, and it's only 3 years old :O i was looking at the STM32F722 it's incredible wow!
the two aren't mutually exclusive? You can use the Arduino firmware on many different platforms
Hahaha totally true
FORTH?
That's old school,like during my college years!!
Nice!!!
I was curious about the difference, thank you so much for explaining!
Well the mystery gage is over load the stm info into the arduino ide and yes we can now program this and many other stm boards using the arduino ide and if i am not mistaken the lib work too just insert the correct pin numbers so learning the hard way is over same for ESP32 boards.
My 2 cents as an recent EE grad: Forget about Arduino and it's IDE. Trying to program anything besides an 8bit Arduino or the Atmega328p with it is asking for trouble. The Arduino libraries aren't build for the blue pill board or any other chip. Secondly, download Atmel Studio and start programming 8bit AVR chips bare metal using your Arduino as a programmer. You'll learn the details of how the hardware works and won't be handicapped by the simplified Arduino language. Once you have mastered AVR and have built a few PCBs, you are ready to begin learning ARM. A good starting point is the STM32F0 either the board or baremetal with a STLink V2
that's fair, but i think learning C is a better long term investment than learning the arduino language if you ever want to make professional embedded products
my 2 cents as a EE for over a decade is your 2 cents is worthless. You do know arduino is based on avr-gcc compiler? so you can do direct port manipulation or if you know your stuff in line assembly as well. The best way to learn this stuff is stick with the IDE learn how to do something that you understand how it works Then rewite it so it works in AVR C you can even open an arduino project in Atmel Studio now and upload to it without a isp programmer.
Honestly I've never used arduino because I think the libraries are garbage, and I'm concerned with designing products, only rarely with 8-bit MCUs. Anyway programming 8 bit devices is a commodity skill and likely soon to be obsolete as the Arm Cortex cores start to be produced on fully deprecated fabs and drop in price. Of course I know it's based on GNU compiler, it's open source! Arduino was originally made for artists not engineers, and by the sound of things I really doubt you're an engineer. No one under deadline pressure has time to rewrite code because they were scared to take the training wheels off
Ya all of the 8-bit micros like the PIC family are going to disappear cause of the almighty ARM what is cost in mass production that's never a factor. I'm probably 10 years older then you. Our EE degrees will differ. mine was based strongly on Analog Circuit Design and only the last year was MCU based in assembly. Everything else ARM AVR PIC I Continue to learn on my own.
Understood, yea on balance I find the AVR Freaks forum to be of much higher quality than the Arduino forum, with more experienced users and more reliable information. I'd say it's be a tall order to improve the Arduino libraries as they accomplish their goal of abstracting away from the lowest levels of hardware and making C a higher level language. Notable faults include the delay function with monopolizes one of the three timers and the misleading analogwrite function which is simply generating a pwm signal with the same timer. Conflicts like these usually won't disrupt simple peripheral control programs, but If your already familiar with vanilla C you can avoid the risk. A friend of mine describes it as knitting with boxing gloves.
I also enjoyed the video, thank you.
Why not use cubeMX ide the way STM wants to teach us.???
Yes .. that is the final goal. Getting to know the working internals first makes it a lot easier. Free fall detection project was completed in 10 lines of code without libraries using direct register programming. ruclips.net/video/P6yNjAk0QUQ/видео.html
YES! I am ready to claw my way to the top of this learning curve :D
I don't want to use forth tho YUK ew i'll find something that platformio supports in vsc
After you get Platformio up and running write some code for Free Fall detection and send it to me for comparison. Platformio is getting quite popular and I would like to see some real world project code. The code written in Forth runs on F4 drone flight control boards for free fall detection. ruclips.net/video/P6yNjAk0QUQ/видео.html
(anyone) Is it possible/advisable to start out with just a basic stm32 board? Like "the blue pill", I think it's called? What's the advantage of the larger board like this vid shows, or something like the Nucleo board?
Either way thanks for this info, looking forward to doing some forth programming, it's a fun language. Any advice is appreciated.
The Blue Pill board would be the least expensive entry to Arm programming. The Discovery board has a built in ST-link programer and lots of peripherals to play with. You can download Mecrisp Forth for the blue pill here: sourceforge.net/projects/mecrisp/reviews
Here is a video on how to load Mecrisp on the Blue pill module.
ruclips.net/video/KgR3uM21y7o/видео.html
know how to tell me if it is possible to change the MAC of the ENC424J600
Each ENCX24J600 device has been factory programmed with a unique MAC address and is loaded into the MAADR registers after every Power-on and System Reset. The factory programmed MAC address is permanent but the address can be changed in the MAADR register after reset.
@@0033mer
is there a programmer for this?
@@0033mer but on this Enc424j600-lpt is it possible to change the mac? or only on the ENCX24J600?
You can write to the function register by using the SPI bus. Check the datasheet for more details.
I own a copy of Ting's eForth, do you have the source code for the words you use to access the gyro/accel. ? I would like to see it!
: X@ PE.3 LOW A900 SPI.DR ! PE.3 HIGH SPI.DR C@ ;
: Y@ PE.3 LOW AB00 SPI.DR ! PE.3 HIGH SPI.DR C@ ;
: GYRO
BEGIN
X@ 10 40 WITHIN IF LED5.ON ELSE LED5.OFF THEN
X@ C3 F6 WITHIN IF LED4.ON ELSE LED4.OFF THEN
Y@ 10 40 WITHIN IF LED3.ON ELSE LED3.OFF THEN
Y@ C3 F6 WITHIN IF LED6.ON ELSE LED6.OFF THEN
?KEY
UNTIL DROP ;
Thanks!
why are we moving back from arduino mcu to arm board?
Moving forward not back
what you call a mistake is for some a much better way. Different people have different learning styles. they tend to fall into similar types...but the point is there is more than one way to skin a domestic pet
I think his main point, which I agree with, is you can spend too much time installing and fighting with the dev environment that you don't start producing anything before frustration/time constraints, cut in. Then, when you get a possibly working environment you don't have full confidence in its functioning and each try/test/evaluate cycle is very long.
Using an embedded repl can speed up getting familiar with the hardware and is a very attractive idea. I'm not certain if Forth is that accessible to many. though (and its more than 25 years since I used it seriously :) ) so wonder if, at least for ESP and M4/7 series STM32s if micro python might be a better bet for most. Of course, no use on M0,M3, though. I believe there is a Lua for STM32F103 so that might also be an option.
I guess some poking around is in order :)
I don't agree at all. This is might make blinking a light easier, but it doesn't help when it comes to ARM development. Learning how to use the IDEs/Toolchains and programming in Assembly/C/C++ are transferable technical skills. This, however, is not used anywhere.
NASA and their military/aerospace contractors Rockwell and Harris have been using this technique in their space probes, satellites, Hubble, space shuttle, ISS ... etc for many years. The general public is unaware of this as these companies do not advertise how they develop their systems. www.forth.com/resources/space-applications/
Nice video
Thanks for the feedback.
Just do movies which show how to run it from clear assembler using GNU assembler and I'll love you.
I personally didn't have too much trouble doing that leap. Maybe using the blue pill with arduino first then moving to arm was cheating, hehehe. But I did studies in industrial electronics so I had a background to begin with.
It doesn't make much sense to me to learn another languaje to learn a bit about the ARMs. Just open the datasheet and learn how to use the registers. That's what a real engineer will do.
Forth is a "secret" that companies use to get their product to market very fast. Check out the Forth Inc website to see what companies use Forth. NASA is the main user in their space probes.
Time
love st32
Ouch... I'll stick with my Arduino (for now).
You never mentioned that most ARM STM32 boards can be programmed with the Arduino software - very small learning curve. You also said people who grab all the dev tools they can find are making it overly complicated for themselves. And Then: you went on to "install a third operating system", which is not a trivial thing, AND you used a Forth OS!?! Probably one of the most arcane languages ever made (versatile and powerful, yes, but...), even after people get used to stack-based programming. Talk about complicated...
The purpose of the video was to show another option for programming. NASA picked Forth to control their 3 billion dollar space probe Cassini to explore the planet Saturn. Versatile and powerful, but not the most arcane language. ruclips.net/video/WOjP63R2Hd8/видео.html
www.forth.com/resources/space-applications/
If you want subscribers you MUST add part names and links to the description. Says a lot how you care about your viewers.
arduino is for kids...stm32f4 is for Pro
Any part is for a pro. It depends on how you use it and how much you understand it.
no not really
Then i am pro without being kid.