电工基础知识_电工技术-电工最常见电路移动版

电工基础主页 > 电工电子

cc1101低功耗设计方案 CC1101收发驱动程序(3)


  GPIO_Init(PORT2, &GPIO_InitStructure);

  //NSS,SCK,MOSI output pushpull mode

  GPIO_InitStructure.GPIO_Pin = (NSS|SCK|MOSI);

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;

  GPIO_Init(PORT2, &GPIO_InitStructure);

  //############################################################################

  //TEST Port set

  //TESTO input pushpull mode

  GPIO_InitStructure.GPIO_Pin = TESTO;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

  GPIO_Init(TEST_PORT, &GPIO_InitStructure);

  //############################################################################

  //TEST Port set

  //TESTI output pushpull mode

  GPIO_InitStructure.GPIO_Pin = TESTI;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;

  GPIO_Init(TEST_PORT, &GPIO_InitStructure);

  //############################################################################

  //LED Port Set

  //LED output pushpull mode

  GPIO_InitStructure.GPIO_Pin = LED;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;

  GPIO_Init(LED_PORT, &GPIO_InitStructure);

  //############################################################

  GPIO_InitStructure.GPIO_Pin = (GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_8|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_15);

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;

  GPIO_Init(GPIOA, &GPIO_InitStructure);

  GPIO_InitStructure.GPIO_Pin = (GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10);

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;

  GPIO_Init(GPIOB, &GPIO_InitStructure);

  GPIO_InitStructure.GPIO_Pin = (GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15);

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;

  GPIO_Init(GPIOC, &GPIO_InitStructure);

  首先,想MOSI、SCK、CS、LED、RST这些管脚应该设置为推挽输出,TXD设置为复用输出,而IRQ、RXD、MISO设置浮空输入,什么都没接的管脚全都设置为下拉输入,而TESTI、TESO我一直不解是什么东东,开始就没管,而开始的时候MISO我也没怎么注意,设置成上拉输入(而不是浮空输入),反正大部分按照厂家提供的参考,我并没有照搬,测试效果一样,但功耗确是还有80-90uA,期间我找了好久没找到原因,给技术支持一看,原来是因为MISO没有设置成浮空输入,我是设置成了上拉输入,上拉电阻一直在消耗大约40uA的电流。。。 好吧,这是自己不够细心导致的,以后做低功耗的项目管脚配置是个大问题,不能再这么马虎了!!! 我将MISO设置成浮空输入之后,最低功耗还是有40+,离10uA的最低功耗还有段距离,到底是为什么呢?最后我发现 (责任编辑:admin)

相关文章