这是 main.c
#include "DSP2833x_Device.h"
#include "DSP2833x_Examples.h"
#include "spi.h"
#include "w25q64_1.h"
#include <stdio.h>
void main()
{
Uint8 writebuf[256] = "abcde";
Uint8 readbuf[4096];
char str[256];
InitSysCtrl(); // 系统时钟初始化,默认开启 F28335 所有外设时钟
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart); // 写入 FLASH
DINT;
InitPieCtrl(); // 初始化 PIE 控制寄存器
IER = 0x0000; // 关闭所有外设 CUP 级中断使能
IFR = 0x0000; // 清除 CPU 级中断状态标志
InitPieVectTable(); // 初始化 PIE 中断向量表
SPI_Init(); // 初始化 SPI
while(1){
W25Q64_SectorErase(0x00);
W25Q64_Wait();
W25Q64_PageProgram(writebuf, 0x00, 5);
W25Q64_ReadData(readbuf, 0x00, 4096);
sprintf(str, "senddata = %d recdata = %d\r\n", writebuf, readbuf);
}
}
|