1 Reply Latest reply on Nov 8, 2019 5:25 AM by DheerajK_81

    Documentation, HAL vs PDL, Interrupts and MCWDT

    SuMa_296631

      (This is a follow-on from one part of a previous thread - I didn't want to expand tis part of that thread and so started this one. It should be 'stand alone' though.)

      I am trying to convert from PSoC Creator to Modustoolbox because the PDL for PSoC Creator is not going to be maintained (Pity!). Therefore I'm on the steep learning curve that this migration entails.

      I have a BLE application that I'm eventually wanting to bring over but I want to become  more familiar with Modustoolbox first. Therefore I've started with a very small application to use the MCWDT to wake the the PSoC 6 from deep sleep on my custom board so that I can make sure the deep sleep current is low (it wasn't in the BLE application I'm working on but that question is still unanswered in another forum here).

      In going through the documentation to try to see how to create this simple task, I have come up with a number of questions and comments:

       

      1) From a tutorial perspective, I find the documentation greatly lacking. I dd find that the PSoC 6 BLE videos and the associated code for the PSoC Creator by Alan Hawse to be very useful but the ones around ModusToolbox (currently) just show you the various features of the IDE and not really on how to actually do anything useful. For example:

       

      2) We now have the option of HAL and PDL. But how do we decide which to use? Do we have to decide on a project basis or can we mix and match them depending on the peripherals we want to use? Ditto examples that use both processors as most (at least the ones I looked at) seem to only be for CM0?

       

      3) I want to use the the MCWDT module as an interrupt source but the only example I could find for the MCWDT module polls it based on when a button is pressed. The HAL and PDL both seem to have peripheral-specific ways of connecting the interrupt to the ISR and the 'Interrupt' documentation simply lists the API with (I think) only 1 code example for a GPIO port - and even then it does not explain how to work out what to put into the various config fields [example: for the 'IntrSrc' field, the documentation simply says 'Interrupt source'!!!]. And how to I do this for the CM4 - do I just ignore the fields that have 'CM0' in the name - I can't find anything that *explains* these things

       

      4) I did eventually find the 'Find Me' example that uses the MCWDT as an interrupt source (because I remembered it did on the PSoC Creator example). It uses the HAL but why, oh why is the MCWDT interrupt API labelled LPTIMER????? Every other module seems to have the module name in the API names but not this one!

       

      5) To sum up, I guess I'm really looking for a tutorial document that explains these things and lets me understand the basics as well as better examples with thorough documentation.

       

      Sorry if this seems like a rant but I think if we are expected to move form PSoC Creator to Modustoolbox then the path needs to be made a lot smoother.

      Susan

        • 1. Re: Documentation, HAL vs PDL, Interrupts and MCWDT
          DheerajK_81

          it wasn't in the BLE application I'm working on but that question is still unanswered in another forum here.

          You didn't mention the link but I think you are talking about this thread: Advertising period setup and power consumption. PY_21 is looking into this and will get back to you soon.

           

           

          1) From a tutorial perspective, I find the documentation greatly lacking. I dd find that the PSoC 6 BLE videos and the associated code for the PSoC Creator by Alan Hawse to be very useful but the ones around ModusToolbox (currently) just show you the various features of the IDE and not really on how to actually do anything useful. For example:

          PSoC Creator has gone through multiple versions and has become mature over a period of many years. ModusToolbox is just in its early phases and we are trying to make your experience better each day. Thanks for your feedback, we will definitely try to accommodate your request for more videos on MTB2.0.

           

           

          2) We now have the option of HAL and PDL. But how do we decide which to use? Do we have to decide on a project basis or can we mix and match them depending on the peripherals we want to use? Ditto examples that use both processors as most (at least the ones I looked at) seem to only be for CM0?

          You would decide to use the HAL when you want a generic interface that can be used across multiple product families. This would provide ease of use and portability to your application. You can mix and match HAL and PDL but ensure there aren't any conflicts. HAL finally uses the low-level PDL APIs itself. I didn't understand the last part of the question on both processors, please elaborate.

           

           

          3) I want to use the the MCWDT module as an interrupt source but the only example I could find for the MCWDT module polls it based on when a button is pressed. The HAL and PDL both seem to have peripheral-specific ways of connecting the interrupt to the ISR and the 'Interrupt' documentation simply lists the API with (I think) only 1 code example for a GPIO port - and even then it does not explain how to work out what to put into the various config fields [example: for the 'IntrSrc' field, the documentation simply says 'Interrupt source'!!!]. And how to I do this for the CM4 - do I just ignore the fields that have 'CM0' in the name - I can't find anything that *explains* these things

          Sorry if the documentation wasn't clear. All the interrupt sources are defined in the corresponding header file of the device. For example, if you are using the device "CY8C6347BZI_BLD54", then you can find this file inside "libs\psoc6pdl\devices\include\cy8c6347bzi_bld54.h".

          susan3.PNG

           

          However, to make things easier, if you have set up an interrupt on any peripheral in the device configurator, it automatically generates an interrupt macro mapped to the right interrupt source. You will find the interrupt macros defined for it in the file "cycfg_peripherals.h" present under "libs\TARGET_CY8CKIT-062-BLE\COMPONENT_BSP_DESIGN_MODUS\GeneratedSource\"

           

          More elaborate explaination on API usage is given in the main page of every peripheral. Checkout SysInt (System Interrupt) main page in the PDL documentation for more information on usage.

           

           

          4) I did eventually find the 'Find Me' example that uses the MCWDT as an interrupt source (because I remembered it did on the PSoC Creator example). It uses the HAL but why, oh why is the MCWDT interrupt API labelled LPTIMER????? Every other module seems to have the module name in the API names but not this one!

          I am not sure which code example you are referring to because the Find Me example I checked didn't have any LPTIMER defined. But Cypress LPTIMER is used to measure the timing between events or to perform some action after a set interval in low power modes.

           

           

          5) To sum up, I guess I'm really looking for a tutorial document that explains these things and lets me understand the basics as well as better examples with thorough documentation.

          Yes, we will be coming up with more videos and collateral to get you up to speed with application development in ModusToolbox.

           

          Sorry if this seems like a rant but I think if we are expected to move form PSoC Creator to Modustoolbox then the path needs to be made a lot smoother

          Thanks for the critical feedback, this will definitely help us improve the experience users have with our products. Appreciate it

           

          Regards,

          Dheeraj

          1 of 1 people found this helpful