9 Replies Latest reply on Jul 1, 2020 2:03 PM by ErNo_1148106

    CY8C624AAZI-S2D44 BSP

    ErNo_1148106

      Hi All,

       

      How do I create a BSP for CY8C624AAZI-S2D44? I am really lost with Modus Toolbox and need serious help. I am used to using PSOC Creator and this is the first time jumping head first into Modus Toolbox. Any help would be greatly appreciated creating a project with this custom chip, accessing the device configurator, how to add c files and header files and configuring the components etc.

       

      Thanks,

       

      Eric

        • 1. Re: CY8C624AAZI-S2D44 BSP
          DheerajK_81

          Hello Eric,

           

          The steps to create your own custom BSP is documented in the ModusToolbox User Guide Section 5.3.9.

           

          In your case, for the device CY8C624AAZI-S2D44, the closest matching BSPs are CY8CPROTO-062-4343W and the CY8CKIT-062S2-43012. Based on the connectivity device 4343W or 43012 you have, you can choose one. So, here are the steps:

           

          (1) Create New Application > Choose one of the above mentioned BSPs > Choose application template > Create.

          (2) Once the application is imported inside of Eclipse IDE, navigate to "<ModusToolbox path>\tools_2.1\modus-shell" and open "Cygwin.bat" shell.

          (3) Change directory to point to the application directory

              >> cd "<path to application directory>"

          (4) Run make bsp with your target device and additional device as shown below:

          (5) Define or update the alias for pins in the cybsp_types.h file if required.

          (6) Customize the design.modus file and other configuration files with new settings for clocks, power supplies, and peripherals as required

          (7) Update the make TARGET variable to point to your new BSP in the Makefile.

             TARGET=MyBSP

          (5) Build your application.

           

          Let me know if it works

           

          Regards,

          Dheeraj

          • 2. Re: CY8C624AAZI-S2D44 BSP
            ErNo_1148106

            Hi Dheeraj,

             

            I went a different way. I downgraded the Modus Toolbox to version 1.1.0.234 and chose custom board and the CY8C624AAZI-D44 from the chip selection and was able to get up and running this way. I built a custom prototype board with the CY8C624AAZI-S2D44 ES2 chip and it works :-). With all of this being said why was this simpler functionality to create a project removed from later versions of Modus Toolbox? The other way you mentioned is too involved to get up and running compared to what I just did. I like simple especially when learning to navigate a new IDE. I could try your way but right now im happy with what I have done so far and I am able to change code and program the device no problem. For whatever reason Modus Toolbox 2.0 and up just doesn't seem user friendly especially for a new user. I REALLY like PSOC Creator and wish I could stick with that IDE but need Modus Toolbox for this particular chip. Is there any plans to incorporate the chip mentioned above in PSOC Creator? How hard would it be to create a custom chip in PSOC Creator. I like the flexibility of PSOC Creator and what you can do with it.

             

            Thanks,

             

            Eric

            • 3. Re: CY8C624AAZI-S2D44 BSP
              ErNo_1148106

              Hi Dheeraj,

               

              On an off topic I have several crypto authentication functions that need to run at 24 mhz before I run the system at full speed 144 mhz clock. Which clock is responsible for code execution? I see there is CLK_FAST, CLK_PERI, CLK_HF0, IMO etc but not sure which one I need to set at 24 mhz initially.

               

              I am porting over this code from a PSOC 5 project of mine:

               

              /* ****************** CPU Bus Clock Critical Section Start **************** */

               

                /* Call this before setting the Bus Clock */

                    CyFlash_SetWaitCycles(80);  /* Set frequency to 80 MHz */

               

               

                /* Set Bus Clock to 80 MHz */

                CyBusClk_SetDivider(0);

               

               

                CyDelayFreq(80000000);  /* Set Frequency in Hertz */

               

               

                /* Delay while the Bus Clock ramps up  */

                CyDelay(1000u); /* Delay 1000ms */

               

                /* ****************** CPU Bus Clock Critical Section End ****************** */

               

              I will adjust the clock to 144 mhz not the 80 mhz as shown. If possible do you know what functions are used to duplicate the above code in the PSOC 6 or at the very least tell me where to look? As always your help is greatly appreciated :-)!! Looking forward to hearing from you.

               

              Thanks,

               

              Eric

              • 4. Re: CY8C624AAZI-S2D44 BSP
                DheerajK_81

                Hello Eric,

                 

                Completely agree there needs to be a simpler way to create a custom BSP. Thank you for your feedback, we will try to incorporate it in the upcoming versions.

                 

                I do not recommend downgrading to any version below ModusToolbox 2.0. The reason being that ModusToolbox 2.0 remains the stable foundation that comes with a completely new project flow which is not compatible with the older versions. All the newer versions will be built on top of the 2.0 version and will come with new features.

                 

                So creating your project on ModusToolbox 1.1 would be a problem when you want to upgrade to make of the new features considering that it is not forward compatible.

                 

                The chip CY8C624AAZI-S2D44 ES2 won't be supported on PSoC Creator. I understand why you would prefer Creator considering that it is something you have been working with and is easy to create projects. But note that ModusToolbox is also a very friendly tool with configurators and abstraction layers, Board Support Packages which make it easier for you to focus on your application than worrying about the hardware-level details. It has a slight learning curve, but I'm sure you will love it at the end of it. And considering that it is still in its initial versions when compared to Creator, there's a lot of features coming up and definitely is going to mature over time.

                 

                And since it is so much easier to upgrade your libraries/code using Library Manager in ModusToolbox, you will notice how user friendly it is. It is the right time to jump on the bandwagon and use ModusToolbox because that's what the future holds.

                 

                Coming to the off-topics questions:

                Which clock is responsible for code execution? I see there is CLK_FAST, CLK_PERI, CLK_HF0, IMO etc but not sure which one I need to set at 24 mhz initially.

                 

                CLK_FAST is the clock for the CM4 and CLK_SLOW is the clock for CM0p. Both of them are sourced from CLK_HF0 and you can configure the frequencies by the choosing the clock source, the dividers etc. in the System tab of Device Configurator.

                 

                You can make use of the Cy_SysClk_ClkFastSetDivider API for changing the frequency of the CM4. Please find the list of functions in the PDL API reference guide in the Quick Section panel of ModusToolbox 2.x.

                 

                Regards,

                Dheeraj

                • 5. Re: CY8C624AAZI-S2D44 BSP
                  ErNo_1148106

                  Hi Dheeraj,

                   

                  I agree with you that I should use Modus Toolbox 2.0 or above but at this time since I am new and still learning how to get around the software I think and this is my personal opinion that I should stick with this version for now because it works and I feel comfortable with it at the moment. Once I feel a little more comfortable with this version I will spread my wings and take the plunge and go with version 2.0. I might wait until a newer version is released that has an easier project/BSP startup similar to version 1.1.

                   

                  Thank you for sending me the information on the clocks. Is there any other functions I need to call before or after the Cy_SysClk_ClkSetDivider? I know with PSoC 5 I had to call a few functions to get it to work smoothly.

                   

                  Since we are on the topic of code I wanted to bring up a point that was really confusing to me. The interrupts assignment and how the code is tagged does not have enough documentation to aid the user on how to setup the interrupts for lets say the UART, PWM and Timer components. When setting up the interrupts I can select them in the device configuration program but when I go to write the code all I see is the api's. I don't see examples on how the interrupts are used and where to find the corresponding .c or .h files that need to be used. Here is an example:

                   

                  void serial_init()

                  {

                    /* Initialize the UART component */

                    cy_en_scb_uart_status_t _UART_RX_init_status;

                    cy_en_scb_uart_status_t _UART_TX_init_status;

                   

                   

                    /* Populate configuration structure (code specific for CM4) */

                    cy_stc_sysint_t _UART_RX_SCB_IRQ_cfg =

                    {

                      .intrSrc      = _UART_RX_IRQ,

                      .intrPriority = 7u,

                    };

                   

                   

                    /* Populate configuration structure (code specific for CM4) */

                    cy_stc_sysint_t _UART_TX_SCB_IRQ_cfg =

                    {

                      .intrSrc      = _UART_TX_IRQ,

                      .intrPriority = 7u,

                    };

                   

                   

                    /* Allocate context for UART operation */

                    cy_stc_scb_uart_context_t _UART_RX_context;

                    cy_stc_scb_uart_context_t _UART_TX_context;

                   

                   

                    /* Initialize  UART RX component */

                    _UART_RX_init_status = Cy_SCB_UART_Init(_UART_RX_HW, &_UART_RX_config, &_UART_RX_context);

                    if (_UART_RX_init_status != CY_SCB_UART_SUCCESS) {

                  handle_UART_error();

                    }

                   

                   

                    Cy_SCB_UART_Enable(_UART_RX_HW);   /* Start  UART RX component */

                   

                   

                    /* Initialize  UART RX component */

                    _UART_TX_init_status = Cy_SCB_UART_Init(_UART_TX_HW, &_UART_TX_config, &_UART_TX_context);

                    if (_UART_TX_init_status != CY_SCB_UART_SUCCESS) {

                    handle_UART_error();

                    }

                   

                   

                    Cy_SCB_UART_Enable(_UART_TX_HW);   /* Start  UART TX component */

                   

                   

                    /* Unmasking the TX fifo empty and RX fifo not empty interrupt bits */

                    _UART_TX_HW->INTR_TX_MASK = SCB_INTR_TX_MASK_EMPTY_Msk;

                    _UART_RX_HW->INTR_RX_MASK = SCB_INTR_RX_MASK_NOT_EMPTY_Msk;

                   

                   

                    Cy_SysInt_Init(&_UART_TX_SCB_IRQ_cfg, _UART_tx_isr);

                    Cy_SysInt_Init(&_UART_RX_SCB_IRQ_cfg, _UART_rx_isr);

                   

                   

                    /* Enable  UART interrupts */

                    NVIC_EnableIRQ(_UART_TX_SCB_IRQ_cfg.intrSrc);

                    NVIC_EnableIRQ(_UART_RX_SCB_IRQ_cfg.intrSrc);

                   

                   

                  I took out the first part of the component name. It took me a half of a day trying to figure out how the interrupt sources worked and where to find the hooks the software generated. I am in no way doubting the software I just wish there was an easier way to find the critical information I need when I need it.

                   

                  I had to resort to using two Uarts one for transmit and one for receive because I needed to disable the tx uart's interrupt and couldn't figure out how to do it. Is there a way to do it? Is there a function call for this sort of thing? I did this:

                   

                  /* Disable the TX interrupt */

                  NVIC_DisableIRQ(GRBL_TX_IRQ);

                   

                  Id like to use one uart for rx and tx comms but cannot find a way to disable the only interrupt the uart has. I initially thought that I could somehow use a mask to prevent the TX EMPTY interrupt from firing but it always fired regardless so im at a loss there. Is there a way to disable the tx interrupt during runtime?

                   

                  On to other issues:

                   

                  How do I use the CM0 processor in conjunction with the CM4? Is there a separate main.c file I create? Is there an example you can provide? Also how do I send over chunks of data from the CM4 to the CM0 and vise versa? Is there examples and functions I can use? The main application I have runs on the CM4 and cannot be interrupted for any reason otherwise I run the risk of motion commands not firing at the right times causing all sorts of bad things including machine collisions. Id like to send small commands to the CM0 processor and have the CM0 control the background tasks that are slower. Id really like to know how to setup a bidirectional communication channel if possible.

                   

                  Ok enough of my long rant. I know I must annoy you guys to no end but all in all I really like PSoC Creator and Modus Toolbox and all of you have really done a great job. Everyone has always answered my questions in a timely manner and that speaks volumes to me and that is why I continue using cypress parts for my designs. I will continue to be your favorite annoying person asking these crazy questions trying to find ways to create cool things with these cool chips. Keep up the great work and look forward to new advancements and software releases!!

                   

                  I look forward to your reply Dheeraj!!

                   

                  Cheers,

                   

                  Eric Norton

                  • 6. Re: CY8C624AAZI-S2D44 BSP
                    DheerajK_81

                    Hello Eric,

                     

                    Yes definitely, whenever you feel comfortable to make the switch.

                     

                    Answering your questions:

                    Is there any other functions I need to call before or after the Cy_SysClk_ClkSetDivider?

                    In the device configurator window, you can check the CLK_HF0 frequency under the System tab. Based on the frequency you want for the CM4, you can the set the divider values using the Cy_SysClk_ClkSetDivider API.

                     

                    The interrupts assignment and how the code is tagged does not have enough documentation to aid the user on how to setup the interrupts for lets say the UART, PWM and Timer components

                    SysInt driver provides the APIs to configure the device peripheral interrupts. Please read the SysInt PDL documentation to see how it is used. Based on which block you are interacting you can go to corresponding PDL page to find more information on how to configure the interrupt for that block. For example, UART PDL documentation has this:

                    In the device configurator, you will notice the Code Preview tab that you can use to view the code that will get generated based on the instance name and the parameters you have set:

                    code.png

                    I have given the instance name as UART as you can see. Based on that you will get the respective macros as seen below:

                    code1.PNG

                     

                    You can make use of these macros in your code. All the code generated for all the peripherals will be available in the file cycfg_peripherals.h in the path: "<app_name>\libs\TARGET_<name>\COMPONENT_BSP_DESIGN_MODUS\GeneratedSource\"

                     

                    I had to resort to using two Uarts one for transmit and one for receive because I needed to disable the tx uart's interrupt and couldn't figure out how to do it. Is there a way to do it? Is there a function call for this sort of thing?

                    Please make use of Cy_SCB_ClearTxInterrupt and Cy_SCB_ClearRxInterrupt APIs.

                     

                    I initially thought that I could somehow use a mask to prevent the TX EMPTY interrupt from firing but it always fired regardless so im at a loss there. Is there a way to disable the tx interrupt during runtime?

                    Please have a look at the SCB Common PDL APIs for more information on getting the interrupt mask, disabling interrupts etc.

                     

                    How do I use the CM0 processor in conjunction with the CM4? Is there a separate main.c file I create? Is there an example you can provide?

                    Dual-core is not directly supported in ModusToolbox. CM0p is available as a pre-built image which starts the CM4 core and is the reason you only see the main.c file of CM4. You can develop your application wholly on the CM4 core, there won't be significant performance gains by running some part of the application on the CM0p core.

                     

                    I hope I have answered all your questions. Please create a new thread for any new issue just to make sure that someone who is searching for a similar problem can find the solution easily. You can feel free to create as many threads for different issues and we will be happy to help you.

                     

                    Since the original issue is resolved, I would recommend creating a new thread for any new issues

                     

                    Regards,
                    Dheeraj

                    • 7. Re: CY8C624AAZI-S2D44 BSP
                      ErNo_1148106

                      Hi Dheeraj,

                       

                      Thank you for the information. The one thing that is a show stopper is the CM0p core. Once I get into the CM4 loop it's blocking and cannot make any calls to new functions because it will throw off timing and lock up the system. The only thing I can do is issue small command words without interrupting the communication and timing of the core system. I really need the CM0p core to handle tasks in parallel.

                       

                      I'm building a four head pick and place machine:

                       

                      CM4 - 9 axis grbl controller

                      CM0p - Controller for up to 128 component feeders over RS-485, vacuum controller and sensing

                       

                      As you can see while grbl is doing its thing I need tasks to run in parallel with it issuing commands to certain feeders, sensing vacuum and controlling other aspects of the machine. If I can't get the second core working ill have to go with an fpga.

                       

                      Thanks,

                       

                      Eric

                      • 8. Re: CY8C624AAZI-S2D44 BSP
                        DheerajK_81

                        Hello Eric,

                         

                        Are you making use of FreeRTOS in your application? You could consider this when you have real-time requirements. You can create multiple parallel tasks and execute them by assigning priorities to them. All of the execution will be taken care of by the task scheduler.

                         

                        Regards,

                        Dheeraj

                        • 9. Re: CY8C624AAZI-S2D44 BSP
                          ErNo_1148106

                          Hi Dheeraj,

                           

                          Nope no cannot do that... It's purely interrupt and loop dependant for tight timing requirements. Look at GRBL for details. Having RTOS is like allowing windows control of grbl. Everything is structured and coded in very tight low level c code. I found out for my application I don't need cm0p anymore so we can close this aspect of the design. The pick and place software allows for multiple controllers.

                           

                          Thanks,

                           

                          Eric