2018-11-20 12:09 PM
We are using stm32L476 in one project where we need to access external SPI flash. I have
setup SPI clock speed to 10Mhz and it works without any problems, but at 21Mhz flash become
non responsible. When I checked clock with oscilloscope I can see, that waveform is not like
it should be. It can be seen, that voltage goes to around 3.1V, what is OK, but low level is around 0.5V. MCU is running at 64Mhz, but it will be switched to 80Mhz.
SPI bus is quite short around 10mm from MCU pins without any terminators. I also tried to setup different GPIO speed, but it does not improve very much.
So is there any specified maximal GPIO speed when used for SPI peripheral?
2018-11-20 02:12 PM
If the oscilloscope's and the probe's bandwidth is adequate (i.e. well above some 100MHz), this is certainly not a waveform you want to see. If you set OSPEEDR of the given bit to 0b11 (and verified it is set so by reading back the relevant GPIO register), and still the waveform is like this, then something is terribly wrong - pin too heavily loaded by something else than just one sFLASH SCK input pin, short to some neigbouring pin/track, pin not connected to track (ie. bad solder joint).
JW
2018-11-20 10:13 PM
Oscilloscope probe is set to 1x and bandwidth is 100MHz. I also tried higher bandwidth oscilloscope and probe as well, but results are the same. OSPEED register is set to GPIO_SPEED_FREQ_VERY_HIGH what I double checked. SPI is reserved for flash only, so none other devices is sharing pins.
In datasheet I checked SPI speed and is defined as:
Master mode receiver/full duplex (2.7-3.6V) 24MHz Max
Master mode transmitter (2.7-3.6V) 40MHz Max
Does this mean, that when using master full duplex mode only 24Mhz is possible, but only transmit is possible to run up to 40Mhz!
2018-11-21 01:05 AM
> OSPEED register is set to GPIO_SPEED_FREQ_VERY_HIGH what I double checked.
By reading out the content of GPIOx_OSPEED register?
And what about bad solder joints and/or shorts?
Can you please try this on a "known good" board, such as the 'L476 DISCO?
JW
2018-11-21 01:11 AM
Yes I read register OSPEED in debugger and also in release this register is checked. Best results I got with
MEDIUM or HIGH speed setup from which is my first picture. With VERY_HIGH speed I get signal even worse and is similar to triangular pulse.
Today I will get NUCLEO-64 board with stm32L476 CPU and I will try the same setting on this board as well.
2018-11-21 01:49 AM
I just received board NUCLEO-L476RG, which is the same MCU like we have. I soldered external crystal of 8Mhz and uploaded our software. I just put scope on SCLK of SPI2 (PB10) and I get the same result as on out board. So waveform is quite bad shape. PB10 OSPEED is 0x03.
The pin is floating and only scope probe with 200Mhz bandwidth is attached. On our board I removed SPI flash, so no load at all and also get the same results like with flash ON.
2018-11-21 03:46 AM
Something is wrong. According to the 'L476 datasheet, I/O AC characteristics table, at OSPEEDR=0b11 and VDDIO above 2.7V the rise/fall times into a 30pF load should be 3.3ns. The waveform you are showing us exhibits around 30ns rise/fall times - you shouldn't be seing that with any other than OSPEEDR=0b00 setting.
If your probe can be switched to 1:10, switch it, and if it has a compensation setting, set it up properly using the calibration output from the scope.
JW