raspberrypi / pico-sdk

BSD 3-Clause "New" or "Revised" License
3.26k stars 838 forks source link

Fixed an issue that caused incorrect settings when the SPI clock was … #1633

Closed aizaki77 closed 1 week ago

aizaki77 commented 4 months ago

…less than 244,141Hz.

Fixed an issue that caused incorrect settings when the SPI clock was less than 244,141Hz.

For example, if clk_peri is 125MHz and you specify 150kHz

Before correction prescale=2, postdiv=256, 125000000/(2*256)=244140.625Hz Therefore, it exceeds 150kHz.

After correction prescale=4, postdiv=209, 125000000/(4*209)=149521.5311004785Hz This is the correct frequency.

lurch commented 1 week ago

Unassigning myself, as I don't know anything about the SPI hardware nor its frequency requirements.