stm32: make SPI CLK fast to fix data issue
See "STM32F40x and STM32F41x Errata sheet" - SPI CLK port must be 'fast' or 'very fast' to avoid data corruption on last bit (at the APB clocks we configure).
Этот коммит содержится в:
родитель
e587b1d1b4
коммит
ae59e7703e
1 изменённых файлов: 6 добавлений и 4 удалений
|
@ -55,7 +55,9 @@ const (
|
||||||
gpioPullMask = 0x3
|
gpioPullMask = 0x3
|
||||||
|
|
||||||
// OSPEED bitfields.
|
// OSPEED bitfields.
|
||||||
|
gpioOutputSpeedVeryHigh = 3
|
||||||
gpioOutputSpeedHigh = 2
|
gpioOutputSpeedHigh = 2
|
||||||
|
gpioOutputSpeedMedium = 1
|
||||||
gpioOutputSpeedLow = 0
|
gpioOutputSpeedLow = 0
|
||||||
gpioOutputSpeedMask = 0x3
|
gpioOutputSpeedMask = 0x3
|
||||||
)
|
)
|
||||||
|
@ -120,7 +122,7 @@ func (p Pin) ConfigureAltFunc(config PinConfig, altFunc uint8) {
|
||||||
// SPI
|
// SPI
|
||||||
case PinModeSPICLK:
|
case PinModeSPICLK:
|
||||||
port.MODER.ReplaceBits(gpioModeAlternate, gpioModeMask, pos)
|
port.MODER.ReplaceBits(gpioModeAlternate, gpioModeMask, pos)
|
||||||
port.OSPEEDR.ReplaceBits(gpioOutputSpeedLow, gpioOutputSpeedMask, pos)
|
port.OSPEEDR.ReplaceBits(gpioOutputSpeedHigh, gpioOutputSpeedMask, pos)
|
||||||
port.PUPDR.ReplaceBits(gpioPullFloating, gpioPullMask, pos)
|
port.PUPDR.ReplaceBits(gpioPullFloating, gpioPullMask, pos)
|
||||||
p.SetAltFunc(altFunc)
|
p.SetAltFunc(altFunc)
|
||||||
case PinModeSPISDO:
|
case PinModeSPISDO:
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче