2026-01-08 7:40 AM
In my project I've set the SPI clock to 125MHz; with a SPI prescaler value=4 all works good, when I set it to 2 the SPI stops working and ther is no clock signal.
Any helps ?
Thank you
CarloV
Solved! Go to Solution.
2026-01-08 9:04 AM
Ensure GPIO pin speed is set to VERY HIGH. This is not the default.
2026-01-08 7:57 AM
Check the datasheet - maybe 62.5 MHz is above the limit ?
2026-01-08 8:19 AM
I configured the SPI1 as "Master Transmit only", the maximum clock frequency should be 133MHz; kernel clock=500MHz, SPI1 clock=125MHz, prescaler=2 ---> 62.5MHz
2026-01-08 9:04 AM
Ensure GPIO pin speed is set to VERY HIGH. This is not the default.
2026-01-08 9:33 AM
Yes SCLK and MOSI are VERY HIGH...
2026-01-08 11:35 AM - edited 2026-01-08 11:37 AM
Should work. It's possible that you aren't measuring it correctly, perhaps sample rate is insufficient. It's also possible changing this caused something else in the code to break and SPI commands no longer get executed. To address those:
How are you measuring it and what does "no clock signal" look like? How do you know the code is being executed?
Could also be something else wrong in the code but if you're only changing the prescaler, unlikely. The more info you provide the more likely someone is to spot the problem.
2026-01-08 12:26 PM
2026-01-08 1:24 PM - edited 2026-01-08 1:29 PM
@TDK has totally valid points. If its custom hardware, as it sounds like, then I think you need to look carefully at electronic signals quality. If the slew rate is low (e.g. due to bad traces/wires) then raising clock frequency lowers the peak-to-peak amplitude. If you try to trigger oscilloscope on such signal at half the nominal voltage like it's done with digital signals, then it wont trigger.
You should share the oscilloscope images at prescaler 4 and 2. Oscilloscope shall have at least 50 MHz bandwidth (better if 100 MHz) and few hundred MHz sampling rate (better 1GHz). Use 1 MOhm input impedance. Trigger on falling CS with one channel and measure SCK on another.
These measurements should be done anyway to be sure there are no hardware issues to avoid banging head to the wall.
2026-01-09 6:56 AM
I'm sure the oscilloscope is working good, it is a digital oscilloscope with a 100MHz bandwidth, 2GSamp, compensated probe 10Mohm, no triggering problems...; when I set the prescaler to 2, something goes wrong also in the code, this is the routine where the code loops:
static HAL_StatusTypeDef SPI_WaitOnFlagUntilTimeout(const SPI_HandleTypeDef *hspi, uint32_t Flag, FlagStatus Status,
uint32_t Timeout, uint32_t Tickstart)
{
/* Wait until flag is set */
while ((__HAL_SPI_GET_FLAG(hspi, Flag) ? SET : RESET) == Status)
{
/* Check for the Timeout */
if ((((HAL_GetTick() - Tickstart) >= Timeout) && (Timeout != HAL_MAX_DELAY)) || (Timeout == 0U))
{
return HAL_TIMEOUT;
}
}
return HAL_OK;
}
I suppose that the reason may be the missing clock...
2026-01-09 7:31 AM
You are absolutely sure you're using a 125 MHz capable peripheral?
I mean: which SPI block x?
And which H7 exactly?
Here's from the H723 datasheet, and the maximum clock depends on supply voltage and which SPI block (1..6) is used:
PS: using a 100 MHz scope for a 125 MHz signal is not really optimal... but you should see at least something (closer to a sine).