2015-11-03 10:25 AM
Hi,
I just bought a xbee and I wanted to control it with a stm32f4-disco. Xbee is simple, I have to send a frame through serial port. I send via USART1 a frame that toggles a led in the remote xbee. The problem is that this led toggle signal should be square but it's not and it changes randomly (80% On 20%Off, 20%On 80%Off). My main looks like this:int main(void)
{
RCC_Configuration();
NVIC_Configuration();
GPIO_Configuration();
USART_Configuration();
int off[20]={0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0xE4,0x93,0x30,0xFF,0xFE,0x02,0x44,0x34,0x04,0xD0};
int on[20]={0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0xE4,0x93,0x30,0xFF,0xFE,0x02,0x44,0x34,0x05,0xCF};
int i=0;
while(1){
while (i<20){
while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
USART_SendData(USART1,off[i]);
i++;
}
i=0;
Delay(100000);
while (i<20){
while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
USART_SendData(USART1,on[i]);
i++;
}
i=0;
Delay(100000);
}
}
2015-11-03 11:06 AM
You should perhaps look at what/when the remote device is receiving.