|
STM32从机配置如下
USART_InitStructure.USART_BaudRate = 9600;
USART_InitStructure.USART_WordLength = USART_WordLength_9b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No ;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_ITConfig(USART1,USART_IT_RXNE,ENABLE);
USART_ITConfig(USART1,USART_IT_TC,ENABLE);
USART_Init(USART1, &USART_InitStructure);
USART_Cmd(USART1, ENABLE);
USART_WakeUpConfig(USART1,USART_WakeUp_AddressMark);//静默模式设置 1、USART_WakeUp_IdleLine 空闲总线唤醒//2、USART_WakeUp_AddressMark 地址标记唤醒
USART_SetAddress(USART1, 0x1); //设置地址 从机1
USART_ReceiverWakeUpCmd(USART1,ENABLE); //使能接收唤醒
。。。。。。同样配置
USART_SetAddress(USART1, 0x3); //设置地址 从机2
每次分别发送u16 send_data[8]={0x101,0x02,0x03,0x04,0x05,0x06,0x07,0x08};
u16 send_data4[8]={0x103,0x04,0x05,0x06,0x07,0x08,0x09,0x10};
可以找到从机且接收准确,现在有这种现象:第一次从机接收到0x101(或0x103)唤醒后接收数据正常,然后过5s我直接发送u16 send_data3[8]={0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x10};从机不能接收数据,但发送u16 send_data4[8]={0x103,0x04,0x05,0x06,0x07,0x08,0x09,0x10};从机可以正常接收数据
问题如下:
1、第一次发送数据,串口地址正确唤醒后,是不是一直是唤醒状态,根据现象貌似不是
2、如果每次都需要唤醒,请问唤醒保持时间
请大神指点,谢谢
|
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|