Mega32/16 with HC-11 RF 433MHz Tranciever

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello there , i started a project which includes side units that collect data and sebd it to the main unit , i use mega32A 16Mhz external crystal with 2 simple RF module HC-11 trancievers .

I made a simple code to send a string if a button is pushed , from the 1st MCU .
The 2nd MCU recieve the string ( hello world ) , if it matches a LED toggle .

I'm certain about my UART function because this code works perfectly when the TX->RX connected by wires and it displays the string on LCD and the LED toggle . (Wired)

The problem arise when i put the HC11 module , the LED doesn't toggle and LCD displays (hello ) only or sometimes displays ( hello WorLD ) , this means the data is incorrect .

I tried to access the AT commands but with no response .
Ex:
Uart_transmitString("AT") ;
Uart_recieveString(data,10) ;
LCD_dispString(data) ;

According to AT commands , there should be an "OK" message reply by the module .
Also i made sure that the SET pin is pulled down to access the AT command mode .

Any help would be great

Last Edited: Thu. Sep 22, 2016 - 07:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RF links are unreliable by their nature, you will need to use a protocol that ensures the data matches and retries if not or adds redundancy so it can be recovered when it fails.

 

There are many protocols to choose from, one you may want to look at is called S.N.A.P from hth.com, its free to use and they have examples for AVR,

start with one of the simple protocols and see if it works for you.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks alot Ki0bk , i'll check it out and see how it goes

Last Edited: Fri. Sep 23, 2016 - 11:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another alternative is to use a better radio that has the error correction built in, rather then the simple radios you have now. 

One takes more money, the other more time!   Use either wisely!  smiley

 

Jim

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks alot Jim , but now i'm having another kind of problem indecision , the program which used to work on wired UART , well !! it's not working anymore !!

i've no idea what happened , i double checked the wiring .

if i send (hello world) it gets displayed as ( h!!!o !!r!d) ...( the '!' represent nonsense data , sometimes i get chinese characters :-D ) 

NOTE : the characters which succeed to reach , they are displayed on their order and spot . as u can see in the previous example .

another thing to know  that whenever i push the button to resend the data again , other characters succeed to reach but other fail . 

i checked the baud , parity and the stop bits , they are identical . 

 

i think it maybe a faulty atmega ?

 

tho , here aremy functions of receiving and sending bytes :

 

u8 UART_u8RecieveByte(void)
{
    u8 u8Byte;
    while ((UCSRA & (1<<RXC)) == 0x00);
     u8Byte = UDR;
     return u8Byte;
}

 

void UART_vidTransmitByte(u8 u8Byte)
{
    while((UCSRA & (1<<UDRE)) == 0x00);
    UDR = u8Byte;
}

 

 

Last Edited: Sat. Sep 24, 2016 - 08:32 PM