This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Bug: SPI_STM32F4xx.c

There is a bug in file SPI_STM32F4xx.c The speed control bits of CR1 are not set correctly. If you are implementing FS over SPI you will get locked into the 400kHz initialising speed.

Find the speed section and modify it. You'll need to make a local copy of the file, remove the CMSIS SPI driver from the environment and then add your new file.

    case ARM_SPI_SET_BUS_SPEED:
      // Set SPI Bus Speed
      pclk = spi->periph_clock();
      for (val = 1U; val < 8U; val++) {
        if (arg >= (pclk >> val)) { break; }
      }
      // Disable SPI, update prescaler and enable SPI
      spi->reg->CR1 &= ~(SPI_CR1_SPE | (7U << 3U)); //modified to clear the BR bits
      spi->reg->CR1 |= (val - 1U) << 3U;
      spi->reg->CR1 |=  SPI_CR1_SPE;
      return ARM_DRIVER_OK;