9 Replies Latest reply on Oct 23, 2016 11:35 PM by user_1377889

    How do I use the HSIOM to set pins to SCB SPI mode?

    bpatel15_1565176

      Hi,

         

      I am very new to using a PSoC or any cypress product for that matter.

         

      Here's the datasheet for the device I'm using: http://www.cypress.com/file/137466/download (Page 15 is where the pertinent pins are listed)

         

      The pins I want to use are: P4_0, P4_1, P5_0, P5_1. They are all dedicated to the SCB1_SPI peripheral. The "mode" they correspond to is Deep-Sleep #1 (value = 15).

         

      My question is this: How do I use this information to actually connect the pins to perform their SPI functions? I have been unable to find a single well-explained resource that can tell me how to use the HSIOM register to manipulate the ports, their pins, and perform a peripheral selection.

         

      Like I know I should be starting with CYREG_HSIOM_PORT_SEL4, but what do I set it equal to? How do I select a pin and a "mode"?

         

       

         

      Thanks.

         

      EDIT: I came across the CY_SET_XTND_REG32 function which'll let me set the CYREG_HSIOM_PORT_SELx registers. But I don't know what value I set the register to.

         

      EDIT 2: Okay. Is this how it's done?    

         

         /*For pin P4_0: x = 4, y = 0. Configure bits 3:0 to value 15 for deep sleep mode 3 */
          /*Bits 3:0 are selected because 4y+3:4y*/
          CY_SET_XTND_REG32(CYREG_HSIOM_PORT_SEL4, (0x0000000F|0x0000000F));

        • 1. Re: How do I use the HSIOM to set pins to SCB SPI mode?
          user_1377889

          That is quite easy: Open in workspace explorer your .cydwr file. Here you can connect the IO-pins to the real world ;-)

             

          Furthermore you will find a lot of places for setting up the clock system or setting some system resources by clicking the right tabs.

             

           

             

          Bob

          • 2. Re: How do I use the HSIOM to set pins to SCB SPI mode?
            bpatel15_1565176

            I've already tried changing them in the .cydwr file, but I can only see pins from Ports 0, 1, 2, and 3 in the drop-down list. This led me to believe that I can only configure other pins using HSIOM. On top of this, I found a guide that says "None of the port 4 pins can be routed through the DSI. However, these pins can still be used as a firmware pin, LCD_COM, LCD_SEG, or can be connected to the SCB block through the HSIOM."

            • 3. Re: How do I use the HSIOM to set pins to SCB SPI mode?
              user_1377889

              When you are using an SCB based component ie. I2C, these port 4 pins will be used. You can use one of those pins programmatically by setting its value as PinName_Write(PinState).

                 

               

                 

              Bob

              • 4. Re: How do I use the HSIOM to set pins to SCB SPI mode?
                bpatel15_1565176

                So are you saying that I don't need to use to HSIOM register at all? Because that's not what the documentation says. I am specifically asking how to use the HSIOM register to select the SPI peripheral and the deep-sleep mode #3.

                • 5. Re: How do I use the HSIOM to set pins to SCB SPI mode?
                  user_1377889

                  All settings for the PSoCs are integrated into Creator 3.3 IDE. The components allow for setting the wanted properties and the .cydwr view is for setting the device capabilities. There is no HSIOM register you need to set, all can be done using Creator at design time. Only on very rare special needs (changing system properties at run-time) writing to a register might be needed.

                     

                  Getting out of deep sleep (what you mean with mode #3??) is mostly a function of the PICU (Peripheral Interrupt Controller).

                     

                   

                     

                  Bob

                  • 6. Re: How do I use the HSIOM to set pins to SCB SPI mode?
                    bpatel15_1565176

                    Hi Bob,

                       

                    I appreciate you taking the time out to respond to my messages.

                       

                    When I say deep-sleep mode, I am merely repeating what the device datasheet calls the pinout column in which the spi peripheral is stated be activated on pins 4_0, 4_1, 5_0, and 5_1. I have already posted a link and page number to this datasheet above.

                       

                    Using that information, I proceeded to the PSoC 4 BLE Architecture Technical Reference Manual: http://www.cypress.com/file/137266/download where they discuss the usage of the HSIOM register on Page 77 where the table specifically talks about enabling the SCB-SPI block.

                       

                    If I was to follow whatever you're saying, and ignore any special internal pin-to-peripheral routing like most of the documentation suggests, using just the Creator to achieve this is confusing to me. As mentioned above, I cannot see the pins I want to use in the .cydwr file. Conduction SPI communication using read/write commands such as PinName_Write(PinState) seems wasteful since there's an entire SPI function library for reading and writing to buffers.

                       

                    If you can suggest an example code that'd be great since I can't wrap my head around this.

                       

                     

                       

                    Bhoomi

                    • 7. Re: How do I use the HSIOM to set pins to SCB SPI mode?
                      bpatel15_1565176

                      I found the solution to my problem. Instead of using the SPI Slave block, if I use the SPI block, I can assign the pins I want to use in the .cydwr file. No HSIOM shenanigans required at the moment.

                      1 of 1 people found this helpful
                      • 8. Re: How do I use the HSIOM to set pins to SCB SPI mode?
                        user_1377889

                        Fine that you got it working!

                           

                        I should have advised you to post your complete project (To do so next time use
                        Creator->File->Create Workspace Bundle (minimal)
                        and attach the resulting file.), someone would have seen your problem at first sight.

                           

                        Some explanation:

                           

                        Components are cast into silicone in different ways: there are "Fixed Function" blocks (mostly timers, counters, USB etc.), Serial Control Blocks (used for interfaces as I2C, UART etc.) and Universal Digital Blocks (which you can even program yourself what they should perform). At first you selected a UDB implementation of the SPI component which needs to have IO pins connected to it, then you took the SCB implementation that handles the pins directly without using the HSIOM where port 4 or port5 aren't connected to.

                           

                        So for the future keep in mind: You cannot use a routed pin that is not connected to the HSIOM. Newer PSoC 4L family members have got a larger HSIOM, so they are not so restricted for connections.

                           

                         

                           

                        Bob

                        • 9. Re: How do I use the HSIOM to set pins to SCB SPI mode?
                          user_237418738

                          I have a similar  problem:  How can I assign EXTPA_EN to pin 5.0. I see nothing in PSOC Creator. Is this a case where we have to use the HSIOM instead of PSOC Creator?

                          • 10. Re: How do I use the HSIOM to set pins to SCB SPI mode?
                            user_1377889

                            Welcome in the forum, Carl!

                               

                            Creator (now 4.0) is software and HSIOM is chip internal hardware. Building a project using Creator will involve a program named "Fitter". This will program the HSIOM to fit your needs. A rule of thumb: PSoC4 port >= 4 is not connected to HSIOM and so can only be used as dedicated pins or program access.

                               

                             

                               

                            Bob