Can not mesure a change in rising time with different speed settings - Page 1
Forum section: electronics / general

author: eTobey
author_rank: Super Contributor
timestamp: May 06, 2023, 11:40:10 am
content: Hi,i tried changing the slewrate of the GPIO pin, but i cant observe a change. It seems that i missed something?Code:int main(void){HAL_Init();SystemClock_Config();__HAL_RCC_GPIOB_CLK_ENABLE();GPIO_InitTypeDef GPIO_InitStruct;GPIO_InitStruct.Pin = GPIO_PIN_4;GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;GPIO_InitStruct.Pull = GPIO_NOPULL;GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);while (1){GPIOB->BSRR = (uint32_t) GPIO_PIN_4;HAL_Delay(1);GPIOB->BRR = (uint32_t) GPIO_PIN_4;HAL_Delay(1);}}

author: AndyC_772
author_rank: Super Contributor
timestamp: May 06, 2023, 11:59:26 am
content: What's the bandwidth of your scope and probe? It may well be that they're the limiting factor in the rise time you actually see, even when the GPIO is set to its slowest.

author: GromBeestje
author_rank: Frequent Contributor
timestamp: May 06, 2023, 12:24:22 pm
content: As an addition to the bandwidth of the probe: if you have a 1x/10x probe, make sure it is in the 10x setting otherwise it will not have its specified bandwidth.Also make sure there is no bandwidth limit configured on the scope.

author: peter-h
author_rank: Super Contributor
timestamp: May 06, 2023, 01:07:25 pm
content: I think you will find there is no "slew rate" setting. It would be difficult to implement; impossible using digital logic. All these chips do is select parallelled MOSFETs to vary the drive capability with, together some some finite load C, gives you a variable time constant on the transitions.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 06, 2023, 01:22:45 pm
content: I agree with the above, that your measurement setup may be the limiting factor.From what I remember, ST does not specifiy "slew rate", but they specify "drive strength" (or something similarly vague). You can try adding a relatively high capacitive load (something between 100pF and 10nF).

author: eTobey
author_rank: Super Contributor
timestamp: May 06, 2023, 06:35:22 pm
content: I dont know where i picked up "slew rate". Its called "speed" setting. The oscilloscope is a DSO QUAD:https://wiki.seeedstudio.com/DSO_Quad/I just tested it with some pocking on 3V, i does show the same rising time. Since the oscilloscope showed quite some details there like ringing, i never thought it would be right on the edge of the limit or even above.

author: james_s
author_rank: Super Contributor
timestamp: May 06, 2023, 06:52:35 pm
content: I don't even see the analog bandwidth mentioned which does not bode well, and 36MS/s sample rate is very slow, even the TDS300 scopes from ~30 years ago could do 100MS/s. I expect the scope is your limiting factor here, you likely will need at least 100 MHz analog bandwidth to even begin to see a difference.

author: gamalot
author_rank: Super Contributor
timestamp: May 06, 2023, 07:03:39 pm
content: I don't have STM32F303, so I used STM32F334R8T6 for testing. The test pin is PB4. The initialization sequence is the same as OPs. When the speed is set to high, medium and low, the rise time of 2.7ns, 3.8ns and 5.9ns is measured respectively.My suggestion is to check your probe or oscilloscope settings.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 06, 2023, 07:11:25 pm
content: I'm with James_s. I do not consider the DSO quad a decent scope. It's still a toy, (but I do agree that is can be a "useful" toy). As a result, you can only make guesses at what you are actually measuring (And some people (but not me) are good at making such guesses). From what I know of STM32, this feature is also not meant for direct measurement, but it's mostly intended for EMI regulations. The correct way to measure this would be to have lots of outputs switching all the time (preferaby on a badly design PCB without GND plane) and then use a spectrum analyser to measure the emitted noise spectrum.

author: gamalot
author_rank: Super Contributor
timestamp: May 06, 2023, 07:21:38 pm
content: Quote from: eTobey on May 06, 2023, 06:35:22 pmMaybe you should find an oscilloscope with a higher bandwidth and sample rate and try again.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 06, 2023, 08:11:53 pm
content: The speed measured is always the maximum risetime of the system. After addressing the above mentioned factors, it may simply be you don't have enough bandwidth to observe it. It may also be that the rise time doesn't change with the setting, because it's a drive strength rather than a speed -- it's the same thing when there's a significant capacitive load (say 20pF+?) but may not show up with just a probe connected.*More like the RMS / vector sum (sqrt(tr1^2 + tr2^2 + ...)) but when one dominates, it's basically max().I think the pin driver type in this family is slew rate controlled though, so it should vary with setting, with or without load on the pin.Tim