SPEED and SlewRateEnable(SRE) setting on GPIO pin Teensy4.0

Status
Not open for further replies.

ossi

Well-known member
I try to see the influence of the SPEED and SRE setting on an output. I use output pin 13 and have the following connections from this pin: 100 Ohm to +3V3, 100 Ohm to GND, 100 pF to GND. I don't see any influence of the SPEED setting on the waveform at pin 13. (I can see an influence of the DSE setting). Anyone an idea how to demonstrate influence of SPEED/SRE setting ?


Code:
void SPEEDtest1(){
 Serial.println("SPEEDtest1()...") ; Serial.flush() ;
  cli() ;
  while(1){
    for(int speed=0 ; speed<4 ; speed++){
      if(speed==0){ 
        CORE_PIN14_PORTSET = CORE_PIN14_BITMASK; // trigger scope
        } 
       else { 
        CORE_PIN14_PORTCLEAR = CORE_PIN14_BITMASK; 
        }
      int sre=0 ;  
      int tmp=IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_03 ;
      tmp &= ~ ( (3<<6) | (1<<0) ) ;
      tmp |= (speed<<6) | sre ;
      IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_03=tmp ; 
      for(int k=0 ; k<100 ; k++){
        CORE_PIN13_PORTSET = CORE_PIN13_BITMASK;
        CORE_PIN13_PORTCLEAR = CORE_PIN13_BITMASK;
        }
      }
    }
  }
 
Not sure of the expected - the speed of change is on the bus clock … Perhaps give it a try on another pin - without the LED hookup.

On T_4 the GPIO are set to fast clocking and IIRC are not on the default GPIO#'s but shifted up for reference - not sure if that is accounted for in the above?:
Code:
#if defined(__IMXRT1062__)
	// Use fast GPIO6, GPIO7, GPIO8, GPIO9
	IOMUXC_GPR_GPR26 = 0xFFFFFFFF;
	IOMUXC_GPR_GPR27 = 0xFFFFFFFF;
	IOMUXC_GPR_GPR28 = 0xFFFFFFFF;
	IOMUXC_GPR_GPR29 = 0xFFFFFFFF;
#endif

Pin #13 moves it seems to GPIO7 in PJRC's startup.c:
Code:
	// pin 13 - if startup crashes, use this to turn on the LED early for troubleshooting
	//IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_03 = 5;
	//IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_03 = IOMUXC_PAD_DSE(7);
	//[B]IOMUXC_GPR_GPR27 = 0xFFFFFFFF;[/B]
	//GPIO7_GDIR |= (1<<3);
	//GPIO7_DR_SET = (1<<3); // digitalWrite(13, HIGH);
 
Status
Not open for further replies.
Back
Top