4 Replies Latest reply on Jun 21, 2016 3:00 AM by davide.rossi

    CHANGE I2C pins to GPIO Pins

    davide.rossi

      Hi everybody,

         

      for a project, I have to change pins from I2C to GPIO, in order to drive them thorugh FW, because of test procedures in software.

         

      So I set up Pins 4.0 and 4.1 for I2C SCK, and SDA, but, during SW, IF a condition occurs, I have to change 4.0 and 4.1 to GPIOs pins.

         

       

         

      So i made this changes...

         

       

         

      if (testing)

         

      {

         

         regVal=CY_GET_REG32(CYREG_HSIOM_PORT_SEL4);
                   regVal&= ~ 0x00000F00u;
                    
                   // setta il PIN COME GPIO OUTPUT , configurazione del registro
                   regVal=CY_SET_REG32(CYREG_HSIOM_PORT_SEL4,regVal|(HSIOM_SW_GPIO<<0u));
                        
                    
                   I2C_scl_SetDriveMode(I2C_scl_DM_STRONG); // output digitale SCL
                  
                   regVal=CY_GET_REG32(CYREG_HSIOM_PORT_SEL4);
                   regVal&= ~ 0x00000F00u;
                    
                   // setta il PIN COME GPIO OUTPUT , configurazione del registro
                   regVal=CY_SET_REG32(CYREG_HSIOM_PORT_SEL4,regVal|(HSIOM_SW_GPIO<<0u));
                        
                    
                   I2C_sda_SetDriveMode(I2C_sda_DM_STRONG); // output digitale SDA 

         

       

         

       

         

      }

         

       

         

       

         

      Then I try to drive these pins by software but is not possible. Have you any ideas or I am not doing something?

         

       

         

      Thanks,

         

      David.