当前位置:   article > 正文

axi-quad-spi_axi quad spi

axi quad spi

winbond型号例程main函数读写操作步骤:

1.初始化spi驱动

        ConfigPtr = XSpi_LookupConfig(SPI_DEVICE_ID);

        XSpi_CfgInitialize(&Spi, ConfigPtr, ConfigPtr->BaseAddress);

2.把spi驱动连接到中断子系统SetupInterruptSystem(&Spi);

3.设置中断处理函数XSpi_SetStatusHandler(&Spi, &Spi, (XSpi_StatusHandler)SpiHandler);

4.设置器件为主模式和手动片选模式XSpi_SetOptions(&Spi, XSP_MASTER_OPTION |
                 XSP_MANUAL_SSELECT_OPTION);

5.通过片选选择要读写的器件XSpi_SetSlaveSelect(&Spi, SPI_SELECT);

6.start使能中断和器件XSpi_Start(&Spi);

7.指定擦、写、读操作的地址Address = FLASH_TEST_ADDRESS;

8.写使能SpiFlashWriteEnable(&Spi);

9.sector块擦除SpiFlashSectorErase(&Spi, Address);

10.设置quad模式使能SpiFlashQuadEnable(&Spi);

11.写使能SpiFlashWriteEnable(&Spi);

12.页写操作SpiFlashWrite(&Spi, Address, 256, 0x2);

                //SpiFlashWrite(XSpi *SpiPtr, u32 Addr, u32 ByteCount, u8 WriteCmd)

13

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/738485
推荐阅读
相关标签
  

闽ICP备14008679号