kywwilson11 opened a new pull request, #15098: URL: https://github.com/apache/nuttx/pull/15098
## Commit Descriptions Used STM32H7 spi driver as a base. The register set is nearly identical. All registers are named the same with the same offset. There are some bits within the registers that are different but are not referenced in stm32_spi.c. Therfore this driver may just work as is. I did modify the clock source selection for each SPI peripheral, but not much else. Differences in the registers were applied in hardware/stm32h5xxx_spi.h. Added SPI info to Kconfig and other minor updates. Updated Pin Map for SPI, added CFG1_BPASS support Fixed redefinition of GPIO_SPI6_SCK_2 Added SPI_MAX_KER_CK definition - This definition was needed because the H50 chips allow a kernel clock of 250 MHz. However the datasheets for all other chips (H52, H53, H56, H57) have a max of 125 MHz. Changed SPI Clock Source Configuration - Moved setting of SPIx clock sources to stm32h5xx_rcc.c. STM32_SPIx_FREQUENCY and STM32_RCC_CCIPR3_SPIxSEL are now defined in board.h. Added error checking in stm32_spi.c to make sure STM32_SPIx_FREQUENCY and STM32_RCC_CCIPR3_SPIxSEL are actually defined. Style updates Removed SPI Clock selection from Kconfig *Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary SPI Support for the STM32H5. This driver borrows heavily from the STM32H7x3, given the register set was almost identical. The CFG1_BPASS bit is not available in the STM32H7, and therefore it was accounted for here. Other registers such as CR2_TSER, CFG1_UDRCFG, CFG1_UDRDET, and the RDY signal were not referenced in the stm32h7 and therefore no support was added here for them. This driver has the ability to select any available input clock for the SPI kernel clock. The kernel clock is selected and defined in board.h, while the clock is actually set in stm32h5xx_rcc.c. Basic functional testing was completed using an Adafruit MicroSD SPI breakout board. ## Impact This should only impact the STM32H5 family of boards. This also only affects architecture files, not board files. Configuration for the Nucleo-H563ZI that was used can be found in this git repo: https://github.com/stbenn/nuttx/tree/stm32h5_spi_testing ## Testing Hardware: 1. Nucleo-H563ZI Board - Connected to PC through USB-C port. 2. Adafruit MicroSD SPI Board with microsd card- https://cdn-learn.adafruit.com/downloads/pdf/adafruit-microsd-spi-sdio.pdf 3. USB Oscilloscope. To do the functional testing, I utilized this MicroSD SPI board and the mmcsd nuttx driver. I was able to initialize the SPI device, initialize and create the mmcsd device, and mount /dev/mmcsd0 to a vfat filesystem. After that, I could successfully read and write from the sdcard that was mounted. Different clock speeds were also tested. 20 MHz was too fast to measure in my setup, but appeared to work. I tested several speeds, 400K, 1M, and 20M, and all functionally worked. Additionally, I tested the spi interfaces using a usb oscilloscope. Below is a screen capture of activity on the bus at 1MHz.   -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
