cancel
Showing results for 
Search instead for 
Did you mean: 

XBEE with stm32f4-disco

fiulala
Associate II
Posted on November 03, 2015 at 19:25

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);
}
}

1 REPLY 1
Posted on November 03, 2015 at 20:06

You should perhaps look at what/when the remote device is receiving.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..