cancel
Showing results for 
Search instead for 
Did you mean: 

GPIOx_OSPEEDR and GPIO Compensation Cells

rgodshall
Associate II
Posted on February 19, 2014 at 23:36

Hi All

I've been working with STM32F405/07 (STM32FDiscovery & my own designs) for a while now... though I'm certainly no expert:)

This is a request for any discussion or useful information generally related to high speed GPIO. While some aspects of this seem pretty obvious I really hate to make assumptions... ''behind the baddest of bugs are even worse assumptions!'' I've searched the forums and available literature and am not really finding much; maybe I've missed something? Some of my questions are: 

  • First and foremost, is there a document (other than the main reference manual and data sheet) that covers GPIO speed and/or the compensation cells in detail?
  • Is there any good reading on the mechanics of AHB1 with respect to the GPIO ports? I think this could help my understanding of the speed aspect. 
  • What sorts of effects do GPIOx_OSPEEDR values have on pins when configured as: 
    • Output?
    • Input, if any? 
    • Alternate function, if any? ie, if I'm expecting 10MHz SPI and my MOSI line is setup with GPIOx_OSPEEDR = 2MHz, should I expect trouble? 
  • What exactly do the compensation cells do?
  • What are the pros and cons of using the compensation cells? And what are the possible consequences of not using them when toggling an input or output at >= 50MHz?

Thanks in advance for any and all feedback! 

-Robert

#poor-quality-of-documentation
4 REPLIES 4
Posted on February 19, 2014 at 23:43

It relates to how hard a signal is driven into an output load, it's commonly referred to as slew-rate control. Drive it too hard you get over/under shoot, drive it too little and your square wave gets more triangular.

I'm not sure I've seen an IO cell diagram for the STM32, but for CMOS in general running at 1.2 or 1.8V to get off the part at 3.0 or 3.3V requires that you go through a chain of inverters of increasing strength/size,  the OSPEED presumably allows you to control the length of this chain, and the power it absorbs.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on February 20, 2014 at 01:43

The pin driver is the same regardless of GPIO or AF mode, in AF mode more control is afforded to the peripheral.

The input has a schmitt trigger attached to it, you can read this a GPIO regardless of the AF mode. The schmitt trigger is turned off in Analogue mode so as not to introduce noise.

You could observe the effect of the speed setting by driving an output clock, from say a TIM or MCO pin. Drive the signal into a load capacitor, the specs probably suggest a specific value. Then with a suitable scope/probe you should be able to observe the degradation of the signal.

http://electronics.stackexchange.com/questions/30287/cascaded-logic-inverters

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on February 20, 2014 at 08:55

> [document dealing with] the compensation cells in detail?

None I know of.

Generally, compensation circuitry is used to condition the output stage transistors' operating point to compensate for temeperature, supply voltage and varying load effects. However, the implementation details in the STM32F4xx are to me unknown.

> Is there any good reading on the mechanics of AHB1 with respect to the GPIO ports? I think this could help my understanding of the speed aspect. 

This has nothing to do with ''speed'' (output current/slew rate) as such. You might perhaps want to define your notion of ''speed'' more precisely.

> if I'm expecting 10MHz SPI and my MOSI line is setup with GPIOx_OSPEEDR = 2MHz, should I expect trouble? 

Not necessarily. The output stage simply consists of several transistors (of different geometry, i.e. different RDSon) in parallel, and the OSPEEDR setting simply determines, how many of them are actually driven. Even if OSPEEDR=2MHz, it just means *some* output impedance, and if the loading capacitance of the connected external circuitry is sufficiently small, the slew rate might be good enough for higher frequency operation. In this place I should direct you to the datasheet (table 49); unfortunately, even in its Rev 4 incarnation (which itself is almost a year old) the interesting values in there are TBD. While in this situation indeed measuring the real-world behaviour is the only instant answer, if you have genuine interest in knowing these things in detail, you must pester ST to yield some solid data. However, as experience shows, they won't move a finger unless you buy in large volume...

JW

rgodshall
Associate II
Posted on February 20, 2014 at 23:40

Clive & JW, thank you both very much for your valuable input! As JW pointed out, my ''notion of speed'' was the main issue - I'm a CPE guy first, so I immediately got wrapped up in thinking about clocks and registers rather than capacitance, dv/dt, etc. It all makes much more sense now. Much appreciated!  -Robert