📜 ⬆️ ⬇️

Tips for novice microcontroller programmers

For a long time I wanted to share my experience with novice radio amateurs, because they write very little about this and separately. My experience is not good, not bad, it is what it is. With some statements, you have the right to disagree, and this is normal, because everyone has their own vision of the situation. The purpose of this material is to draw the reader’s attention to certain things, take note and form your own opinion and vision of the situation; in no case can you take this as truth.

1. Many novice electronics engineers do not know where to start , so they ask for advice. Most seasoned radio amateurs will answer that start collecting some kind of scheme. Naturally in the head of any beginner immediately flashes an LCD display with jpeg pictures, some kind of mp3 player or clock, without the slightest thought that having no basic knowledge is an impossible task.

I am totally against this approach. Usually it all ends - either with nothing, or clogged forums with pleas to help. Even if they help someone, then in 90% he will never come up again on electronic sites. In the remaining 10%, he still continues to flood the forums with pleas, he will be kicked first, then poured with mud. Of these 10%, another 9% are eliminated. Then there are two options: either it’s still goto to the beginning, or in especially neglected versions, it is up to him to copy other people's constructions, without a single thought about how it works. Of the latter, arduinschiki are often born.

The path from scratch in my opinion is to study the periphery and features, if it is a microcontroller. Correctly, first deal with how to jerk legs, then with timers, then interfaces. And only then try to raise your FAT. Yes, it is not fast, but it will take time and effort, but practice shows that no matter how you try to shorten this path, problems will still come up that will have to be solved and you will spend much more time without this base.
')
Just do not confuse warm and soft. The first is that there are exceptions from all the rules, I personally saw people who did not hold microcontrollers in their hands before, but in a very short time were able to get around experienced and experienced radio amateurs, we don’t take them into account. Secondly, I came across individuals who started by copying the schemes and understood right away, but rather this is also an exception to the rules. Thirdly, experienced programmers among the arduinschiki come across, it’s just a platform, but this is more of an exception.

If we talk about the total mass, then things are exactly as I described at the beginning: unwillingness to deal with the basics, at best, delays the moment when you have to return to these issues. In the worst case, you will quickly fall into the ceiling of your knowledge and all the time blame someone else for your problems.

2. Before solving the problem, crush it to the point of absurdity up to “solder a resistor”, this helps, is checked. Small tasks are much easier to solve. When a big task is broken into a bunch of small actions, then all that remains is to do them. I can give you another good advice, even though it may seem crazy to you - get a notebook and write everything you are going to do to it. You think so remember, but no. Suppose today I have a good mood and think about how to collect a fee. Write a plan of action: go buy a resistor, prepare the wires, make the display mount. Then you will forget everything, open the notebook and look - aha today mood drank and shred, I will make a mount. Or you collect a fee and it is already left to solder the last component, but it was not there that the resistors ran out, I would have written it down before soldering, I remembered.

3. Do not use code-generators, non-standard features and other simplified, at least in the first stages. I can give you a personal example. During the active use of AVR, I used the CAVR codeod. He completely arranged for me, although everyone said that he was like that. The calls rang constantly, there were problems with libraries, with syntax, with porting, but it was hard to refuse. I did not understand how it works, I just knew where and how to tick.

A count in my coffin was hammered in with the advent of the STM32, it was imperative to crawl on them, and that was when problems arose. The problems put it mildly, in fact, I had to master microcontrollers and C language from scratch. I never repeated past mistakes. I must say it has already come in handy more than once. Since then I have had the opportunity to work with other platforms and have not experienced any difficulties, the approach is justified.

With regard to all improvers and simplists, there was one very good comparison, that they are like wheelchairs that ride on rails, you can go and enjoy, but you can not get up, where you are going - you will go there.

4. Learn C language. Eh, how often do I hear novice radio amateurs boast that they know sishka well. For me, it has become food, I always love to consult with such interlocutors. Usually it immediately turns out that they do not know the language at all. I can say that in spite of the seeming simplicity, there are not so many people who would really know him well. Basically, everyone knows him as much as he needs to solve problems.

However, the problem in my opinion is that without knowing the possibilities, you limit yourself greatly. On the one hand, there are not optimal solutions that will require more powerful hardware, on the other hand, code that is not readable and difficult to maintain. In my opinion, the readability and maintainability of the code occupies one of the most important places and it is difficult for me to imagine how this can be achieved without using all the features of the C language.

Very many beginners disdain learning the language, so if you are not like everyone else, you will immediately become two steps above the rest of the newbies. It also makes no difference where to learn a language. In my opinion, the microcontroller is not very suitable for this. It is much easier to put some kind of Visual studio or Qt Creator and solve puzzles on the command line.

A good help will be also the study of any tests on the language, which are given during interviews. If you dig, you can learn a lot of new things.

5. Learning assembler? It is not necessary to be afraid of it, as well as to idolize. No need to think that knowing how to write a program in assembler, you will immediately become a guru of microcontrollers, for some reason this is a common misconception. First of all, it is a tool. Even if you do not plan to use it, I would still strongly recommend writing at least a couple of programs. This will greatly simplify the understanding of the microcontroller and the internal structure of programs.

6. Read the datasheet. Many developers neglect this. By studying the datasheet you will be two steps higher than those developers. It is extremely useful to do this, firstly this is the source, no matter what sites you read, in most cases they repeat the information from the datasheet, often with errors and inaccuracies. In addition, there may be information about which you are not thinking now, but which may be useful in the future. It may happen that some kind of error will come out and you will remember that yes, this was said in the datasheet. If your goal is to become a good developer, then this stage cannot be avoided, you will have to read datasheets, the sooner you start doing this, the faster the growth will be.

7. Often people ask to send datasheet in Russian. Datashit - this is what should be perceived as the truth, the most accurate information. Even there errors are not excluded. If errors of the translator are added to this, he, too, is a man, maybe not even on purpose, just to be sealed. Either he has his own vision, he may miss something, which, in his opinion, is not important, but perhaps extremely important for you. Especially funny is the situation when you need to find documentation on not very popular components.

In my opinion, it is much easier to eliminate in advance the whole layer of these problems than to catch them later. Therefore, I am categorically against translations, the only sure advice is to learn English to read the datasheets and manuals in the original. You can understand the meaning of a phrase with the help of translator programs, even if the level of your language is a complete zero.

I conducted an experiment: there was a student available, a datashit and google translator. Experiment No. 1: the student was handed a datasheet and was given the task to independently find the necessary values, the result is “yes, how can I”, “yes, I don’t know English”, “I didn’t find anything / I didn’t understand” typical phrases that say he didn't even try. Experiment number 2: the same student was handed the same datasheet and also the task, with the difference that I sat down next. The result - after 5 minutes, he himself found all the necessary values, absolutely without my participation, without knowledge of English.

8. Invent the bicycle. For example, you are studying some kind of new thing, let's say a transistor, Uncle Horowitz authoritatively declares from the pages of his book that the transistor amplifies, always say - DO NOT TRUST. We take the transistor in our hands and include it in the circuit and make sure that this is indeed the case. There is a whole layer of problems and subtleties that are not described in the books. You can feel them only when you pick up and try to collect. At the same time we get a bunch of passing knowledge, we learn the subtleties. In addition, any theory without practice will be forgotten much faster.

At the initial stage, one method helped me a lot - first you collect the scheme and watch how it works, and then you try to find a rationale in the book. It is the same with the program part, when there is a ready program, it is easier to understand it and correlate pieces of code which one is responsible for.

It is also important to go beyond what is permitted, apply more / less voltage, make more / less resistors and monitor changes in the operation of the circuit. In the brain, all this remains and it will be useful in the future. Yes, it is fraught with the consumption of components, but I think it is inevitable. The first time I sat and scorched everything, but now, before putting this or that value, I always remember those funny times and the consequences of putting the wrong value.

9. How would I do it if I were on the site of the developers? Can I do better? Ask yourself these questions every time; it helps to advance in learning very well. For example, study the interfaces 1wire, i2c, spi, uart, and then think about how they differ, whether it was possible to do better, it will help to understand why everything is so, and not otherwise. Also, you will be aware of when and which is better to apply.

10. Do not be limited to technology. It is important that this advice has a very fine line. There was a stage in life when from every gateway it was heard "it would be necessary to know the FPGA", "but on the FPGA you can do it." Formally, I did not have goals to study PLISINs, but it was impossible to pass by. This issue was given a little time for familiarization. Time did not pass in vain, I had a number of questions related to the internal structure of microcontrollers, it was after communicating with the plisins I received the answers to them. There are many similar examples, all the knowledge that I acquired in one form or another, sooner or later came in handy. I have not a single useless example.

But as mentioned, the issue of technology has a fine line. No need to grab at everything. There are many directions in electronics. Maybe you like the analogue, maybe the figure, maybe you are a specialist in power supplies. If it is not clear, try yourself everywhere, but practice shows that at first it is better to concentrate on something specific. Even if you need to press in several directions, it is better to do it in steps, first push something one.

11. If you ask a novice radio fan that he likes programming or circuitry more, then with a probability of 99% the answer will be programming. Moreover, most of the time these programmers spend on the manufacture of boards LUT / photoresist. The reasons are generally clear, but quite often it turns into a kind of insanity, which consists in making boards for the sake of making boards.

On the Internet, virtually the only trash way to programming is to become a Jedi for the manufacture of printed circuit boards. I also went through this path, but every time I ask myself the question why? Since I bought myself a couple of boards for all occasions, I think every time that I could live quietly all this time without homemade boards. My advice, if there is any doubt, it is better not to bother and take a ready-made debug board, and it would be better to spend time and money on programming.

12. The next advice, especially painful, I really do not want to discuss it, but it is necessary. Often they write to me, they say xxx rub for uuu expensive, where it would be cheaper to get. It seems to be a simple question, but usually I immediately get strained from him, as he often goes into endless complaints about the lack of money. I always have a question: why not tear off the fifth point and not go to work? Although on the same McDuck, at least for a construction site, suffer a month, but then you can buy a couple of boards, which will be enough for the next year. Yes, I know that in small towns and villages it is difficult to find a job, move to a big city. Work on the remote, in general you need to spin. There is no point in just complaining;

13. In the same piggy bank I will bring a very painful question of the tool. The tool should allow you to develop devices as quickly as possible. For some reason, so many developers do not value their time. A typical example, a cheap crimp for terminals, on which so many employers like to save. The problem is that it does not even crimp correctly, because of this wire fall out. We have to produce a bunch of additional manipulations, respectively, to spend time. But as you know, the fool pays three times, so the low price of the crimper will increase many times, due to the time spent and the poor quality of crimping.

Not saying that cheap = bad, no - it all depends on the situation. I’ll come back to the example of the crimper, there was a time when it was crimping anything, so there were often problems. It is especially unpleasant when you start a board and it does not work, after a long search for errors you understand that because of the poorly compressed wiring, it's a shame. Since there was no normal crimping of these problems. Yes, the internal toad and the squalor, and suffocated from its value, but never regretted this decision. All I want to say is that after working with a normal tool, I absolutely don’t want to go back to the bad, I don’t even want to discuss it. As practice shows, it is better not to save on tools, if in doubt - take someone to potestit, read reviews, reviews.

14. Start a site, you can write on it, anything, just as a note. Practice shows that employers do not read it anyway, but the fact itself has a great effect.

15. The subtle question: the profile of higher education, is it necessary? I am not aware of isolated cases when people worked absolutely without education and, by experience and knowledge, they could give a cigarette to any graduate. Actually, I do not have specialized education, do I feel discomfort from this? To a certain extent, yes.

At the very beginning, when microcontrollers were a hobby for me, I helped a lot with coursework and diplomas from different universities, just to evaluate my level. I can say with confidence that the level as a whole is low, regardless of the name of the university. It is absolutely not necessary to study for several years in order to write such a diploma. This can be achieved independently in a very short time. And yet, there were often times when students knew some subject matter that they took in a 2-3 year course, but I did not know that. Although all this knowledge was compensated for by self-education, it would still be better not to waste time on it.

University for the sake of paper. I can say that there were such situations when they offered a job that required compulsory education and it was a shame that at that very moment there was no paper. But in general, history shows that most employers do not care about your paper.

The next moment is often not taken into account, this environment. Do not forget that the people with whom you study this generation of yours, it is possible that you work with them. The number of firms operating in one industry is very limited. Practice shows that even in large cities, everyone and everyone about each other know, even intimate details.

Another point is the opportunity. Often, universities have their own opportunities - equipment, maybe some sections, some programs of work abroad, you need to use this, if there is even the slightest opportunity. If you don’t see prospects at a university, go to another, the world doesn’t end at some one.

If you summarize the advice is: if there is even the slightest opportunity - you need to go to study, be sure to follow the profile, if there is any chance, then climb everywhere, and not sit out your pants at the back row. To make acquaintances, to practice at home in parallel, to develop.

16. Is it too late to start programming at 20, 30, 40, 50 years? The practice of other people shows that age is not a hindrance at all. Many for some reason do not take into account the fact that there is a whole layer of work that young people, by virtue of their ambitions, do not want to do. Therefore, employers prefer to take those who will drag her.This is your chance to catch on, and then everything depends on you.

And the last tip. Many hams are unsociable, angry and irritable - consider this to be the specificity of the work. Radiate good and positive, be a good person.

Source: https://habr.com/ru/post/274601/


All Articles