初级会员

- 积分
- 109
- 金钱
- 109
- 注册时间
- 2014-11-8
- 在线时间
- 0 小时
|
5金钱
你们发布的STM32F407探索者资料中的程序源码里的spi.c文件内容是不是有错啊,开头(如图显示第24行)应该是使能GPIOB时钟吧。但是编译时没错,估计是因为前面的程序中别个文件已经对GPIOB时钟使能了。我在SPI实验和NRF24L01无线通讯实验的源代码里看到这个问题的
void SPI1_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
SPI_InitTypeDef SPI_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);//????GPIOA?±??
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);//????SPI1?±??
//GPIOFB3,4,5???????è??
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5;//PB3~5????????????
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//????????
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//???ì????
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//????
GPIO_Init(GPIOB, &GPIO_InitStructure);//??????
|
|