10 Replies Latest reply on Nov 17, 2020 3:48 AM by KeSh_1984591

    Error: fit:m0049: Pin Guidance Unavailable

    KeSh_1984591

      Hi Everyone,

       

      I am using PSOC6 CY8C6137BZI. I want to have connect total 16 device which are controlled by SPI. There are two options available for that,

       

      1. Since there are 9 SCB in it I can use 4 SPI with 4 slave select signals. But I am unsure that whether I can change the Slave Select frequently in the program using Cy_SCB_SPI_SetActiveSlaveSelect(SPI_1_HW, CY_SCB_SPI_SLAVE_SELECTx) or not. Does anyone knows about it?

      I dont have the development kit to test it.

       

      2. Second way is I use 1 SPI module with 1 slave select and pass it through demux having 16 channel. But in that case I am unable to build it. Error comes fit:m0049:Pin guidance unavailable: Invalid connection for output "\SPI_1:SCB\:spi_select_0" connected to "Net_116:main_0". What is the issue I am not able to understand. I did pass through the not gate but I failed.

       

      I am uploading the workspace for reference.

       

      Thanks.

        • 1. Re: Error: fit:m0049: Pin Guidance Unavailable
          LePo_1062026

          KeSh,

           

          I may have some answers for you.

           

          1. Since there are 9 SCB in it I can use 4 SPI with 4 slave select signals. But I am unsure that whether I can change the Slave Select frequently in the program using Cy_SCB_SPI_SetActiveSlaveSelect(SPI_1_HW, CY_SCB_SPI_SLAVE_SELECTx) or not. Does anyone knows about it?

          I dont have the development kit to test it.

          I don't know how frequently you need to change the SS.  If you can't change it fast enough you can consider;

          • Lower the SPI slave update rate.
          • Create a HW state machine to automatically switch the SS.  This can also be done using DMA writes to the  SPI SCB SS selection register.

           

          2. Second way is I use 1 SPI module with 1 slave select and pass it through demux having 16 channel. But in that case I am unable to build it. Error comes fit:m0049:Pin guidance unavailable: Invalid connection for output "\SPI_1:SCB\:spi_select_0" connected to "Net_116:main_0". What is the issue I am not able to understand. I did pass through the not gate but I failed.

          If you could use a mux to still need to control the mux switch value.  In your Temp project you are using a Control Register.  This can be set in SW or via DMA (see comment above).

           

          Sadly, the error your are receiving (Error comes fit:m0049:Pin guidance unavailable: Invalid connection for output "\SPI_1:SCB\:spi_select_0" connected to "Net_116:main_0". ) is due to the choice that Cypress made regarding their SCB architecture.  They don't allow the SS output to be routed to a mux.  Sucks.  Many of their older product line can do this.

           

          I've attached a modified version of your Temp project where one SPI SCB can be routed to 4 SS controlled slaves.

           

          The PSoC6 you are using has 9 SPI SCB resources.  If each SPI SCB has 4 SS controlled slaves, you just need four SPI SCB blocks to control 16 SPI slaves.

           

          Suggestion:  I highly recommend acquiring a PSoC6 kit.  This is the lowest cost prototyping solution in pre-testing project concepts including pin allocation and its restriction.  It beats making a "first quess" at a layout and acquiring a board.

           

          Usually what I do is use a Cypress kit and buy a very low-cost prototype 0.1 inch "peg" board.  I populate the external circuits and wire it up with 30 AWG wire.  I connect this hand-assembled prototype of the external circuits to the kit.  I get 99% to 100% of the SW and HW operating. (Rewiring may be needed).  Once I'm happy, I start the layout.

           

          Len

          1 of 1 people found this helpful
          • 2. Re: Error: fit:m0049: Pin Guidance Unavailable
            KeSh_1984591

            Thanks for the reply LePo,

             

            "1. Since there are 9 SCB in it I can use 4 SPI with 4 slave select signals. But I am unsure that whether I can change the Slave Select frequently in the program using Cy_SCB_SPI_SetActiveSlaveSelect(SPI_1_HW, CY_SCB_SPI_SLAVE_SELECTx) or not. Does anyone knows about it?

            I dont have the development kit to test it."

             

            Thus to be on the same page what you are saying is we can change the slave select, on the fly in the program, (speed is not an issue). Its not that during project building it is assigned to one particular slave select out of 4.

             

            If this is correct, Cy_SCB_SPI_SetActiveSlaveSelect(SPI_1_HW, CY_SCB_SPI_SLAVE_SELECTx) this must be the command to select the slave select. Right?

             

            If all of above is correct I am facing another issue in programming multiple slave select. Since there are 16 slaves which are change multiple times during the program, I want to use a loop structure to code it. But I don't know how use SetActiveSlaveSelect in loop. I cannot make an array of CY_SCB_SPI_SLAVE_SELECTx which can be placed directly in the loop.

             

             

            char array [4][25] =  {"CY_SCB_SPI_SLAVE_SELECT0" , "CY_SCB_SPI_SLAVE_SELECT1" , "CY_SCB_SPI_SLAVE_SELECT2" , "CY_SCB_SPI_SLAVE_SELECT3"};

             

            int main()

            {

            for (i=0; i <= 4; i++)

            {

                 Cy_SCB_SPI_SetActiveSlaveSelect(SPI_1_HW, array[i]);                             // Selecting Slave Select

                 Cy_SCB_SPI_Write (SPI_1_HW, l1_mux_msb[1]);                                          // Sending Data

            }

            return 0;

            }

             

            Does anyone knows any workaround? Otherwise my code will be very lengthy and error prone.

            Can you help me on this???

            • 3. Re: Error: fit:m0049: Pin Guidance Unavailable
              LePo_1062026

              KeSh.

               

              Thus to be on the same page what you are saying is we can change the slave select, on the fly in the program, (speed is not an issue). Its not that during project building it is assigned to one particular slave select out of 4.

               

              If this is correct, Cy_SCB_SPI_SetActiveSlaveSelect(SPI_1_HW, CY_SCB_SPI_SLAVE_SELECTx) this must be the command to select the slave select. Right?

              Yes.  All API function calls are intended to be executed at RUN-TIME.  This includes Cy_SCB_SPI_SetActiveSlaveSelect(SPI_1_HW, CY_SCB_SPI_SLAVE_SELECTx)

               

              Here are some notes on your code example.

              • Cy_SCB_SPI_SetActiveSlaveSelect(SPI_1_HW, array[i]);                             // Selecting Slave Select

                The second argument to Cy_SCB_SPI_SetActiveSlaveSelect() is a number not a string.

              •  

                for (i=0; i <= 4; i++)

                i <= 4 [0 to 4 would be 5 SS lines] would exceed the number of SS lines [=4].  i < 4 is correct.

              I've attached a project.

              This code example is very simple.

              It uses 4 SPI SCBs with each SCB configured for 4 SS control lines. (Total SS lines = 16)

              The example continuously cycles in the 8 bytes of data in the array intended for each SPI slave.

              For example:

              SPI_1 (SS_0)  = 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07

              SPI_1 (SS_1)  = 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17

              SPI_1 (SS_2)  = 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27

              SPI_1 (SS_3)  = 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37

              SPI_2 (SS_4)  = 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47

              SPI_2 (SS_5)  = 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57

              SPI_2 (SS_6)  = 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67

              SPI_2 (SS_7)  = 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77

              SPI_3 (SS_8)  = 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87

              SPI_3 (SS_9)  = 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97

              SPI_3 (SS_10) = 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7

              SPI_3 (SS_11) = 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7

              SPI_4 (SS_12) = 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7

              SPI_4 (SS_13) = 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7

              SPI_4 (SS_14) = 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7

              SPI_4 (SS_15) = 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7

               

              The code builds with no errors.   I have not tested it on a PSoC6 kit.  It is straightforward and should work.

              If you get a PSoC6 kit to can load it on, you can see the SPI data output for each slave.

               

              Len

              1 of 1 people found this helpful
              • 4. Re: Error: fit:m0049: Pin Guidance Unavailable
                KeSh_1984591

                Thanks Len for the support.

                 

                Just wanted to discuss,

                 

                Cy_SCB_SPI_SetActiveSlaveSelect(SPI_1_HW, array[i]);

                 

                this command was never mentioned in the PDL  3.1. From where did you find this?

                 

                 

                 

                Also, can there be similar solution for the selecting the SPI Instance? As my code require both, SPI instance and Slave select in the loop.

                • 5. Re: Error: fit:m0049: Pin Guidance Unavailable
                  LePo_1062026

                  KeSh,

                   

                  Cy_SCB_SPI_SetActiveSlaveSelect(SPI_1_HW, array[i]);

                   

                  This line came from your second post.

                   

                  Have you looked at my code example "SPI_16salves.cyprj"?  It does just that.

                   

                  Len

                  • 6. Re: Error: fit:m0049: Pin Guidance Unavailable
                    KeSh_1984591

                    Oh sorry my bad.  I meant the following command.

                    SPI_3_SetActiveSlaveSelect(spi_ss_idx);

                    This command is not mentioned in the PDL.

                     

                    Yes I saw your program, it did solved my issue to certain extend but again what I want to do is

                    I want to continuosly change the SPI instance and SPI SS. Something like the following code.

                     

                    int i;

                    int array_inst [5] = { 1, 2, 1, 4, 3}

                    int array_ss [5] = {0,2,3,1,3}

                    for (i = 0; i==5; i++)

                    {

                    Cy_SCB_SPI_SetActiveSlaveSelect (array_inst[i], array_ss [i]);

                    }

                    I hope you understood what my purpose is.

                     

                     

                    Kevin

                    • 7. Re: Error: fit:m0049: Pin Guidance Unavailable
                      LePo_1062026

                      KeSh,

                       

                      SPI_3_SetActiveSlaveSelect(spi_ss_idx);

                      is the pre-PDL way to refer to the HW resources being used.

                       

                      If you go into the SPI_3_SetActiveSlaveSelect() function you will see:

                      /*******************************************************************************
                      * Function Name: SPI_3_SetActiveSlaveSelect
                      ****************************************************************************//**
                      *
                      * Invokes the Cy_SCB_SPI_SetActiveSlaveSelect() PDL driver function.
                      *
                      *******************************************************************************/
                      __STATIC_INLINE void SPI_3_SetActiveSlaveSelect(cy_en_scb_spi_slave_select_t slaveSelect)
                      {
                          Cy_SCB_SPI_SetActiveSlaveSelect(SPI_3_HW, slaveSelect);
                      }
                      

                      Note however that SPI_3_HW is not an ordinal number (ie 0, 1, 2 3, 4, etc).  It is actually a HW address.

                       

                      Therefore I've modified your code fragment to do what you want.

                       

                      int i;
                      (CySCB_Type *) array_inst [5] = { SPI_1_HW, SPI_2_HW, SPI_1_HW, SPI_4_HW, SPI_3_HW}
                      int array_ss [5] = {0,2,3,1,3}
                      for (i = 0; i==5; i++)
                      {
                      ...
                           Cy_SCB_SPI_SetActiveSlaveSelect (array_inst[i], array_ss [i]);
                      ...
                      }
                      

                       

                      Len

                       

                      PS:  I've attached a modified version of the SPI_16slaves project with changes similar to what you requested.  You just need to define the "spi_sequence" array for the SPI_SCB, the SS needed and the data to Tx.

                      1 of 1 people found this helpful
                      • 8. Re: Error: fit:m0049: Pin Guidance Unavailable
                        KeSh_1984591

                        Thanks a lot LePo_1062026.  You have been a great support.

                         

                        This thing is working. Didn't check with the hardware but at least I am able to build the code. This was something I was looking for since last week.

                         

                        Also do you have any getting started reference manual to the PSOC 6 coding? I was not able to find any. All I got is PDL. As I am still facing some syntax related issues in USB and other modules. Anything which can help me code better in PSOC 6. As it is much different from older version. Please share if you have any.

                         

                        And again, thanks a lot for all the help.

                        • 9. Re: Error: fit:m0049: Pin Guidance Unavailable
                          LePo_1062026

                          KeSh,

                           

                          I'm glad you got it working and I've was able to help.

                           

                          The PDL documentation along with the component datasheet is as good as it gets for now.

                           

                          Keep working at it as you are doing, it will become more clear.

                           

                          I find to better understand something I have to experiment a bit.  Sometimes I peek inside the function to understand the mechanisms that make it work.

                           

                          Len