Programming microcontrollers of the Cypress family

    Hi, Habrauser!
    This article was asked to publish by my friend, Eugene, who does not yet have an account on habrahabr. Therefore, below I present to your attention his article.

    Recently, at work, I quite often had to deal with such a family of microcontrollers as PSoC Cypress ( http://www.cypress.com) Before that, I had never once worked with this MK family; to be honest, I had not even heard of them. Actually, the first thing, as usual, I started by studying all the documentation, reading articles, searching for examples, etc., I think everyone does it. And I came across such a problem as a catastrophic lack of Russian-language material on this topic. In my opinion, this is a pretty serious gap. That is why I would like to try to write an article or even a series of articles on this topic. I’d like to say right away that writing articles is something new for me, so please do not be angry for the submission of the material and other flaws, I hope that I will fix this over time. So let's go ...

    What is PSoC and what does it eat?


    PSoC - Programmable System-on-Chip, this is hidden behind the abbreviation. A programmable system on a chip, in microelectronics - an electronic circuit that performs the functions of an entire device (for example, a computer) and is placed on one integrated circuit, the final configuration of which is programmed by the user himself. Cypress Semiconductors was one of the pioneers in this area on the MK market. At the moment, Cypress is one of the leaders in this field. There is a huge line of MK for solving a wide variety of tasks. You can read more about that on the manufacturer’s website.
    We proceed directly to the design. We will need the PSoC Designer software package (latest version 5.2).



    I want to immediately pay attention to the image, as we see, it presents the "designer". And not just like that, because the highlight of Cypress is precisely the approach to connecting various digital and analog units. This allows even beginners to work in this environment. Everything is intuitive and this can not but rejoice.
    Let's move on to creating the project itself. After the usual new project and selecting the desired directory, the following menu appears:



    We see that you can select the desired Device (this is MK) and select the writing language.
    By the way, here I must remember that the product is distributed on a free basis, but in order to remove various restrictions on the amount of code for language C, you need to register your version. For example, I chose Device CY8CLED04-68LFXI, language C. Press ok and see:



    In area 1, we have settings for global MK parameters (timers, operating modes, power, etc.).
    Area 2 is the setting area of ​​the Pin. Choose a leg and customize it as you like. All possible options are written in advance and immediately visible.
    Region 3 is the module connection area; it contains all available modules for this MK.
    Well, and finally, 4 area, in it we see a certain number of blocks that can be connected. Also in this area, the switching of various elements is configured. Each module takes a certain number of blocks. Here you can meet the problem of their shortage. Unfortunately, nothing can be done except to choose another MK in order to increase the number of available blocks. Now we have connected the Cap Sensors (touch panel) and LED (led diode) blocks.



    All blocks after insertion are connected as needed themselves.
    Programming is easy in itself, since libraries of these blocks are automatically connected with the blocks, which describe many different functions for working with them. If you study these libraries well, the programming process is very, very much simplified.

    The disadvantages of all this include the lack of tools for software debugging. More precisely, they are, but all the functions for debugging are enabled after the purchase of various emulation tools (СY3215-DK (ICE-Cube)).
    The process of sewing up the program itself is carried out using Mini Prog and the PSOC Programmer.

    For the first article, I think is enough. If there is interest, then I will analyze in detail many modules and various examples. Thank you all for your attention.

    PS All comments on this article will also be given by Eugene on my behalf, so you can ask him questions.

    Also popular now: