看到有帖子成功实现多机通信
http://www.openedv.com/forum.php ... t=STM32%B6%E0%BB%FA
但是这个函数
USART_WakeUpConfig(USART2,USART_WakeUp_AddressMark);//静默模式设置:地址标记唤醒
USART_SetAddress(USART2, 0x1); //设置地址 从机1
USART_ReceiverWakeUpCmd(USART2,ENABLE); //使能接收唤醒
这些函数在STM32F3里面没有啊
STM32F3里只有
/* STOP Mode functions ********************************************************/
void USART_STOPModeCmd(USART_TypeDef* USARTx, FunctionalState NewState);
void USART_StopModeWakeUpSourceConfig(USART_TypeDef* USARTx, uint32_t USART_WakeUpSource);
/* AutoBaudRate functions *****************************************************/
void USART_AutoBaudRateCmd(USART_TypeDef* USARTx, FunctionalState NewState);
void USART_AutoBaudRateConfig(USART_TypeDef* USARTx, uint32_t USART_AutoBaudRate);
/* Data transfers functions ***************************************************/
void USART_SendData(USART_TypeDef* USARTx, uint16_t Data);
uint16_t USART_ReceiveData(USART_TypeDef* USARTx);
/* Multi-Processor Communication functions ************************************/
void USART_SetAddress(USART_TypeDef* USARTx, uint8_t USART_Address);
void USART_MuteModeWakeUpConfig(USART_TypeDef* USARTx, uint32_t USART_WakeUp);
void USART_MuteModeCmd(USART_TypeDef* USARTx, FunctionalState NewState);
void USART_AddressDetectionConfig(USART_TypeDef* USARTx, uint32_t USART_AddressLength);
用着感觉根本不能使得串口处于静默状态,通信依然是正常的。收发都正常程序如下所示
/***************′®¿ú3õê¼»ˉoˉêy*****************/
void usart1_Init(uint32_t Baud_Rate){
//GPIO¶Ë¿úéèÖÃ
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
// NVIC_InitTypeDef NVIC_InitStructure;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB,ENABLE); //ê1ÄüGPIOAê±Öó
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);//ê1ÄüUSART1ê±Öó
//′®¿ú1¶Ôó|òy½Å¸′óÃó3éä
GPIO_PinAFConfig(GPIOB,GPIO_PinSource6,GPIO_AF_7); //GPIOA9¸′óÃÎaUSART1
GPIO_PinAFConfig(GPIOB,GPIO_PinSource7,GPIO_AF_7); //GPIOA10¸′óÃÎaUSART1
//USART1¶Ë¿úÅäÖÃ
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7; //GPIOA9óëGPIOA10
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//¸′óÃ1|Äü
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //Ëù¶è50MHz
// GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //íÆíì¸′óÃêä3ö
// GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //éÏà-
GPIO_Init(GPIOB,&GPIO_InitStructure); //3õê¼»ˉPA9£¬A10
//USART1 3õê¼»ˉéèÖÃ
USART_InitStructure.USART_BaudRate = Baud_Rate;//2¨ìØÂêéèÖÃ
USART_InitStructure.USART_WordLength = USART_WordLength_9b;//×Ö3¤Îa9λêy¾Y¸ñê½
USART_InitStructure.USART_StopBits = USART_StopBits_1;//ò»¸öí£Ö1λ
USART_InitStructure.USART_Parity = USART_Parity_No;//ÎTÆæżD£Ñéλ
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//ÎTó2¼têy¾Yá÷¿ØÖÆ
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //êÕ·¢Ä£ê½
USART_Init(USART1, &USART_InitStructure); //3õê¼»ˉ′®¿ú1
USART_Cmd(USART1, ENABLE); //ê1Äü′®¿ú1
USART_SetAddress(USART1, 0x01);
USART_MuteModeCmd(USART1,ENABLE);
// USART_STOPModeCmd(USART1,ENABLE);
//
// USART_AddressDetectionConfig(USART1,USART_AddressLength_4b);
// USART_StopModeWakeUpSourceConfig(USART1,USART_WakeUpSource_AddressMatch);
USART_MuteModeWakeUpConfig(USART1, USART_WakeUp_AddressMark);
}
做过STM32F3系列的童鞋看一下哪里有问题 因为关于STM32F3系列的资料比较少,然后也没有f1串口静默唤醒那样的函数。
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>