We pass from STM32F103 to K1986BE92QI. Or the first acquaintance with the Russian microcontroller

Introduction


On the eve of the new year, I, like many Russians, actively monitored the state of foreign currency. But not just because of my own interest, but because at that time I was finishing my device, which was required to be shown at a school and district conference. Since the name of the work had such a word as “budget”, it was necessary to indicate the cost of each component in the presentation, including resistors and jumpers. Initially, when the dollar was worth about 30 rubles, the device was really budgetary. Both during home assembly and conveyor. But when the price of the dollar exceeded 100 rubles, I decided I need to look for an alternative to foreign components.

By this time, I had already been studying the operation of the STM32F100 and STM32F103 microcontrollers for several months, putting them into practice in a presentation device. Giants such as STM32F429, I had to refuse. Since the cost of 1800 rubles per case is sky-high for a "budget" device, the functionality of which has just begun to exceed the capabilities of the AVR Atmega32.

The choice


The task was clear. It was necessary to find the Russian analogue of STM32, not inferior to it in capabilities. And then I remembered that about a year ago on Radio Catopened a branch in which he asked for help with the choice of a Russian-made microcontroller. Then I was able to learn about the company Milander and its line of microcontrollers. Having asked for a price list, I was amazed at the prices. All of them were in the region of 10-30 thousand rubles per case. Depending on the model and military acceptance. But among all the microcontroller stood out, worth 400 rubles in a plastic case (K1986BE92QI). At that time, I decided that it was too expensive. But in this situation, it became as acceptable as buying the corresponding STM32, and I just wanted to look at the Russian microcontroller. I looked at its characteristics, I was very happy. The controller suited my needs
.


Expectation


Without hesitation, I wrote to tech support from where I was sent to the customer service department. After some conversation in which I described why I needed this kit, a company representative kindly agreed to provide me with a debugging complex, a programmer and a separate microcontroller case for free.

This conversation was at the end of December. Then the representative notified me that the controllers in the plastic case are not available. We'll have to wait until the beginning of February. I said that I was ready to wait and safely began to build up the project code for now under STM32, with more emphasis on the logic of the device. Since the hardware will still have to be completely rewritten for the new MK. Time passed, but there was no answer. And towards the end of February, I decided to write. The answer was that so far the controllers in the plastic are still out of stock. And at the end of March, when it was already necessary to demonstrate the device, I wrote to the representative to find out how my kit was. To which he received an unexpected response - "Available, please enter the address." Sent by urgent mail (as an interesting fact - not by Russian post, and by partner mail) and after 2 days he was already in my city. I refused courier delivery and went for the kit myself. But in vain ... I had to go far and to a very unusual place. Upon receipt, I was asked for a passport and painting, after which they successfully returned the box with the goods. Since before the trip to Moscow, for the sake of which the set was originally needed, only a few hours remained, we could not enjoy the set, but I managed to consider it.

The study


In the warehouse, I took a bag like this:



Unpacking it, I saw this box, on which lay the invoice with the list of issued:



Underneath the invoice was such an envelope with an advertisement for the courier company:



In which this miracle lay. Yes, yes ... A whole sea of ​​pieces of paper for one case ...



Separately, I was pleased with the description of the legs and the main parameters of the microcontroller. It may be so everywhere with us, but for me it was new.



Well, underneath all these papers was the controller itself:



Having set aside the envelope with its contents aside, I began to open the box. And here he is, the long-awaited moment ... Ahhh no. Another proprietary disc. What on it - I will tell later.



We remove the foam and here it is. The long-awaited set:



Debug board

Let's consider everything in detail. Let's start with the main thing. Debug board Immediately striking are the huge cable outlets on the left side of the board, as well as a massive “crib” for the microcontroller. The presence of a microSD card slot also pleased. Surprised by 2 JTAG ports. For what - I do not understand. The first time I see this. Also pleased with the presence of a minimal set of keys. After STM Discovery, where there was one user button, this is an incomparable plus. The battery socket is very massive. And indeed the whole board seems very reliable. At least due to the fact that the thickness of the PCB is more than two millimeters in appearance. Also, I can not help but notice the absence of several microcircuits for which the wiring was made. Apparently the board was made taking into account the fact that there may be various cases of the same chip (bottom of the board, in the same places, there are chips). The board also has a Jack connector with an amplifier chip. I definitely need this, so I'm really glad about it. The upper side, as you can see, is made without using polygons. I don’t understand just why. My guess is to reduce noise.



Here are the big jacks for wires:



And here is what really struck me. Crib under the SMD chip. Never seen anything like it before. And indeed I was very struck by the fact that such exist. I have never seen anything like this on a single debug board. I would know that such exist, would solder into each prototype. Since it very often happens to burn the legs of the controller with incorrect programming modes. And with frequent re-soldering, the STM32, like other controllers, dies over time.



There are also mode switches with signatures on the board. This pleased and allowed to begin the study without studying the Datasheet.



There are also 2 COM ports on the board. They are unnecessary to me, since there is no COM port on the laptop. But external power is very handy. And since the question of external power has already come up, then you need to choose it with the help of a jumper. Either from USB, or from an external source.



Now we can look at the bottom side of the board:




Here we already see the presence of polygons. As well as microcircuit interfaces and amplifier. Well, all the loose stuff. The only thing that caught my attention was the set of switches. This is exactly what was missing in STM Discovery. Here I can turn off all the extra peripherals if I need it and use the MK legs in my own way. And in STM Discovery, it often happened that various peripherals intercepted data and sent back messages, rendering the communication channel unusable.



I also liked the stoics on the board. If you want to use the board in the final device, you can remove them with bolts, through the holes under them, screw it to the right place.

With this review of the board, I think that's enough.

Other elements

Let's go through the rest of the kit. The kit also included COM-COM and USB-A - USB-B cables.



The JTAG MT-LINK programmer was also sent:





Again, a thick board in an even more toast “vest”. After connecting the programmer to the computer, the LEDs blink on the board. But you can see them only by looking through the slot near the USB port ... I did not dare to open the insulation. So be it. More reliable.

Well, it remains to mention the power supply:




Connection

Well, and I think it’s time to connect all this and connect it to the network. Speaking of nutrition. If you connect the JTAG, the screen starts dimly lit, but if you connect the power, the brightness becomes maximum. Also, when turned on, the red LED lights up. Near the LED and the lower COM port there is a jumper signed as “POWER_SEL”. To get power through the power supply, you must remember to switch it in the state of 2 right closed contacts. At first, I expected to see something like a greeting, but not fate ... Apparently, the controller was salted clean.



Customization

Next came what I spent about three hours. I should have patched the test program from the disk to MK using keil 5. For a long time I stubbornly searched for all the necessary files so that everything worked. Part of it had to be taken from the company’s server, since they were not on the disk that came in the kit.

1. First, we need to download from the official website : “Software pack for Keil MDK 5 (MDR32F9Qx, MDR1986VE1T, MDR1986VE3T)”, unpack and install. I say right away. With keil 4, this file does not take root. Only keil 5. Although the title says this, I had hope for compatibility ...
2. Next, you need to install 2 files: “Setup_JLinkARM_V468a” and “MT-Link”. These are the drivers for the MT-LINK programmer. They are not on the disk, so I uploaded them at the end of the article. They were provided to me by an official representative by e-mail.
3. After these steps, we connect MT-LINK to the computer, the device should be determined, but just in case, go to the device manager and check if the drivers are up.



4. On the disk that comes with the kit, in addition to a bunch of advertisements and documentation for the rest of the company's products, along with, of course, a demo clip, there is an archive “Software and Hardware” at the root of the disk. From it, along the path "Software and hardware \ Software and hardware \ Debugging and demo boards", you need to unzip the folder "Debug board 1986ВЭ92У, К1986ВЭ92QI (MDR32F9Q2I)".

Here is a list of all the files that were needed in the process:



In the unpacked folder we can see the following:



5. From here we should copy the “MDR32F9x.FLM” file to the “Flash” folder in the directory with keil 5. I have (by default) the path is “ C: \ Keil_v5 \ ARM \ Flash. "
6. From the software folder, copy the “Test Progs” folder to the root of the disk. As it turned out later, if there are Russian characters in the file path, the project does not compile and refuses to be sewn into the controller.
7. Connect the programmer to JTAG_A (the upper port) and set the corresponding position on the levers BOOT boot (the highest left, the bottom two - to the right). We connect the power. Do not forget to switch the power source selection lever.
8. Now go to keil 5.
9. Go to Project -> “Options for Target”



10. There we select the Debag tab, in it click on the circle next to “Use”, then select J-Link in the list next, and then click “Settings”.



11. Next, go to the Debag tab. I must say right away, in the “SN:” field, the programmer number should be immediately displayed. If not, then something is wrong with the drivers. Next, in the "PORT" list, you need to change the JTAG to SW and select the frequency in the list next to 1MHz. In theory, you can up to 3, but so far you can stay on one. After that, the microcontroller code should appear on the right, as in the picture. If nothing appears, then you need to check the correctness of the selected mode on the board, press the RESET button and select the frequency again. If this does not help, then check how the controller is installed in the crib. Often it is enough just to press on it so that the legs "move away" and "stand up" back. Then again press “RESET” to select the frequency.



12. After successful recognition of the controller - go to the tab "Flash Download". There we put a bird near the "Erase Full Chip", as in the figure, and click Add.



13. From this list, select our microcontroller and click OK. If there is no microcontroller, it means that you did not copy the FLM file to the Flash folder at the beginning.



This completes the setup. Now go to the folder “C: \ Test Progs \ EV1986BE92_Rev2_Test” and run the project. When turned on, 2 errors pop up. Just click OK.




14. Next, we will again come to make a little setup. Go to Project -> "Options for Target". And in the Device item, select our mk. Click OK and go there again.



15. Next, in the Debug tab, we verify that all the parameters that we set earlier match. If something is wrong - correct. Most likely you will have to reconfigure everything. But it will not be difficult. When setting up the programmer, such an error may occur. Just click No. Next, we configure everything according to the old scheme. Do not forget about the Flash Download tab. Then click "OK."



16. Next, go to the Utilities tab, put a dot to the left of Use Target Driver for Flash Programming, then select our J-LINK. Well, finally, click Settings. Everything should already be configured there as in the previous menu. But check it out anyway. Well, that's vsn.



Now we can sew the demo project into the controller. To do this, in the main window, translate into the Debug tab, and in it we select the topmost item Start / Stop Debug Session. Well, or just press Ctrl + F5.



After that, the program loading line should run in the lower left corner.



At the end, a warning will appear that this version is demo. Click OK and see.



This is a sign that everything went well. You can turn off debugging and look at the code execution. To do this, go to Debug -> Start / Stop Debug Session again. And we can take a look at what happened with us. The red LED near the JTAG cable should light up. Yes, yes) That's it. Nothing more can be seen. BUT! There is 1 more project in the folder. We launch it. We configure it like the previous one, BUT. For inexplicable reasons, DO NOT choose a controller. Where we chose MK from the list there is not a single company, not a single controller. Clear sheet. But in all the other tabs, everything is fine. We also configure J-LINK and enable / disable debugging. And we will see it. Further, by controlling the keys, various tests can be included in the menu. So far I have only checked LEDS.



Conclusion

In conclusion, I would like to say that in the future I plan to write a series of mini lessons on the development of this MK and its periphery. A kind of quick transition from STM32 to K1986.

In this repository, I collected all the files from the official representative of the company, necessary to get started.

Also popular now: