You are here

PSoC 6 and PDL 3.0 – Designed for Flexibility | Cypress Semiconductor

PSoC 6 and PDL 3.0 – Designed for Flexibility

[re-printed from Cypress Developer Community by Jim Trudeau - to learn more about PSoC 6 join the Cypress PSoC 6 EAP Community]

The Peripheral Driver Library v3, for PSoC 6, is more than a driver library. It’s a complete software development kit. I talked about what the PDL is in Software Enablement for PSoC 6 – What to Expect. In this article I want to give you some insight into the very high level design of the PDL drivers. I’ve seen a lot of code in my time, and the PDL is really well designed.

Although this article is about the PDL, just as a teaser, in a coming post or two I'll talk about how PSoC Creator and PDL are integrated. They work together seamlessly. But I get ahead of myself. Back to PSoC 6 and PDL.

The underlying hardware capabilities of the PSoC 6 present unique challenges. For one thing (and it’s a big thing), PSoC 6 is a dual-core architecture, with both a Cortex® M4 and a Cortex M0+ device. Among the many complications you might have to deal with are:

  • Different cores with different instruction sets
  • Drivers for each core
  • Inter-processor communication
  • Sharing resources between the cores

The PDL makes a lot of the complexity go away, from a software perspective. We’re doing our best to make this as easy as possible.

The first big design choice is that the cores use the same register and memory maps for all peripherals. The PDL source code takes advantage of that choice. With very few exceptions, either core can use any peripheral driver. For example, if you want to implement a real-time clock in your design, you create a single RTC driver, not separate CM4 and CM0+ RTC drivers. Write once, use for either core.

It gets better.

The set of available peripherals varies per device. In some cases there are multiple instances of the same peripheral; for example, there are multiple Serial Communication Blocks (SCB). On top of that, each peripheral instance may itself operate on multiple instances of user data.

Imagine if you will (because this is in fact how it works), a platform where you create a peripheral driver used by either or both cores. Where you configure and customize each peripheral. Where you have multiple instances of peripherals, each configured differently. Where each of those peripherals can operate on multiple instances of data. Imagine multiple SCBs, each operating on multiple data buffers, with status and indices into each buffer. All of this happening in a dual-core environment with all the corresponding issues involving potential resource and timing conflicts.

There are many, many ways to make this complicated. The PDL is designed to make it easy. The PDL implements a simple, consistent design based on three fundamental concepts.

Base Hardware Address: At the hardware level, peripheral features and behavior are controlled by registers. Each peripheral instance has its own base hardware address that points to the registers for that instance. The PDL uses this base address to access the necessary registers. Constants for each base address are defined in device-specific header files. It’s easy to find what you need.

Configuration Structure: Each peripheral instance is configurable. You modify values in a PDL configuration structure to change behavior to fit your requirements. When you initialize, enable and use a peripheral, the PDL manages register access using the base hardware address.

Context Structure: A single peripheral instance (however configured) may work on multiple instances of data. For example, an SCB configured as a UART operates on data buffers, and maintains status information about those buffers. The peripheral does not allocate this memory. The PDL defines the necessary data structure on which the peripheral operates. You allocate the structure in memory and provide it to the peripheral.

Many PDL API function calls require a parameter representing one or more of these three concepts. The precise details vary per peripheral, but the design is consistent throughout the PDL. When you look at the actual wording of function prototypes, you will discover that not only is the design consistent, so are the parameter names. The base hardware address is always called base. The configuration structure is always called config.

It’s a little thing, name consistency. Someone new to PDL 3.0 may not even notice. But it has a big impact. Once you get it, you’ve got it! There is no need to figure out, ok, so how is this driver put together? Of course each driver is functionally different, with its own API. But each uses the same parameters for the same things. And that will make your life as a developer a lot easier.

 

Comments

EmmaGSherman_2469596's picture

Very useful article. Thank you for providing more insight into this subject. I really hope that this will make my life as a developer a lot easier. Best regards, do my hw expert

jordanss123 jordanss123's picture

fake yeezy boost 350 Thanks for providing such a nice article and now i am searching for clash royale ios cheats to hack clash royale gems and golds so that i play clash royale game freely.

 

sumitsmith050_2593806's picture

Many PDL API function calls require a parameter representing one or more of these three concepts. The precise details vary per peripheral, but the design is consistent throughout the PDL. When you look at the actual wording of function prototypes, you will discover that not only is the design consistent, so are the parameter names. The base hardware address is always called base. The configuration structure is always called config.

jamesmoliver_2597751's picture

I am also studying software engineering in UK some time we facing lots of bug during the connectivity from hardware we made a basic robot recent i have submit my project in my university but  i was taking help from Essay Writing Service UK for project documentation.

destinyljw5eking_2645546's picture

very useful information, my man! tycm for sharing. if you will ever need custom research papers i can help you with! I garantee you best qulity and fastest decisions for your papers!

taylorshaw151_2687531's picture

The features of the PSOC 6 AND PDL 3.0 mentioned here looks promising. I haven’t used these before but I think it would be a better alternative to what I have been using presently. It will offer better flexibility than the one I use now. the triple play internet providers

hellenjos99_2633671's picture

I am a regular visitor of your site and like all the updations in the site. Your site always shares latest news and these news articles are very informative. So share more news articles on the site if possible. So that I can read them. www.photoeditingindia.com

BobythEdwin4135233_2718091's picture

I would want to say that you are a very talented writer. I suppose you have never had problems with writing essays when you analyzed. Your article contains the proof that is true and h AS out most of the points plainly together. I recommend to you personally to come on a critical analysis paper I accept you!

l371467_2687626's picture

Your post has given me a good idea on the high level design of the PDL drivers. It is really interesting to know about the techniques for combining the hardware and software capabilities of devices. I want to know more about this. Please share the details. topline performance oil change

WastlesPeterallye000_2801151's picture

Your post left a deep and lasting impact on me. Your details were extremely convincing and you operated with verified facts regarding such a vital issue. Everything was clarified by you. It seems to be an argumentative essay from coursework help service Of a class that is top.

hksj989_2814661's picture

Your post left a deep and lasting impact on me. Your details were extremely convincing and you operated with verified facts regarding such a vital issue. Everything was clarified by you. I removed Sina Weibo from my computer for better performance

hksj989_2822936's picture

Your post has given me a good idea on the high level design of the PDL drivers. It is really interesting to know about the techniques for combining the hardware and software capabilities of devices. Are you looking for 55 gallon fish tanks? We have prepared a list of some most popular 55 gallon fish tank for you to chose the most suitable tank.

Stricko's picture

You might want to check the accounts of the posters, I think they are all bots.

reddyarjun323_2857666's picture

yeah may be true. bots are ruthless. even i faced few spam attacks on my website

jiyakj123_2889706's picture

We might have studied about PDL in our college days also the basic function of this entire software development kit. The PDL is very well designed and the hardware features of this are very exciting. This will be very flexible for the users. Top Builders in Kochi

anu.varghese660_2921096's picture

Your post is really an informative one. It helped me to refresh the basics of PDL which I have studied during my college days. I think it is flexible for users. Am I right? If so, I would like to know more on this. Please update more details. consumer triple play cheap internet

r143011_2835121's picture

Hope it developed in such a way that supple for the users. I think the modified features make the overall use easier for all. If possible please share the step by step working here. https://joyjolt.com

lincyrose90_2704921's picture

This article helps us to understand about the very high level design of the PDL drivers. This article act just like a teaser for PDL and we know some basics through this. Hope that you are updating more here and I am expecting that.https://www.healthyslumber.com/

stickwargames_2936571's picture

The site has been providing a lot of such interesting topics regarding PSoC and FreeRTOS. The codes offered here are very helpful in solving all the issues arising while operating. survival games online

ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.