Help help help!

Thread Starter

allahjane

Joined Sep 19, 2012
75
THE HARRASMENT IS BACK!!!

The setup:

two atmega8L-PU on seperate boards .. independent power supply and other components including 4 LEDs on each

The first atmega8 has a ASK 434MHZ RF Transmitter module connected to its Tx pin

The second one has a ASK 434MHZ RF Receiver module connected to its Rx pin

both tuned to same Baud rate & have appropriate antenna's attached

also both atmega 8 have same 1MHz internal clock

NOTE:- the circuit path goes close to each other (I dont think it is causing any cross talk ! is it?)

The Algorithm

the atmega8 with the transmitter makes few ADC conversions and selects a byte from group of 4 pre defined bytes on basis of the result and sends it to the Uart ...directly writing the byte to UDR and then polling(waiting) till it is sent the sent byte is also shown by its LED.. then it repeats the procedure from ADC calcuations

the second atmega8(receiver) has 4 LED that light up on basis of received data byte.. each corresponding to one byte from the 4;


Transmitter LOGIC
Rich (BB code):
for(i=1;i<5;i++)
{
if(getADC(i)>((max[i-1]+min[i-1])/2))
{
    switch(i){
    case 1:
    byte=0xff;
    break;
    case 2:
    byte=0xfe;
    break;
    case 3:
    byte|=0xfd;
    break;
    case 4:
    byte|=0xfc;
    break;
    };
    dpadSelective(i,1);
}
else
dpadSelective(i,0);
}//end for
if(state==transmitting)
sendByte( byte);
    
}



    void sendByte(int byte){
UDR = byte;
while (( UCSRA & (1 << TXC )) == 0) {};
}
THE HARRASSMENT

EVERYTHING IS *BEEP*ED UP :mad:

the receiver listens sometime and sometime it ignores the transmitter completely.

one of the LED corresponding to byte 0xff will mostly light up but others only flicker (error in received data causing rapid on/off) while some may never light up

and sometimes the wrong LED lights up for the byte

however if I send a single byte repeatedly without any ADC and other calculation it works fine!

that said the link between RF modules are correct!

But the data gets out of sync quickly

I tried different baudrates,internal clock frequencies,stop bits as well as different data bytes and even changing between polling and interrupt methods (interuppt made it worse) and hell! also changed the optimisation levels

NO RESULTS


The thinking :rolleyes:

I think there are two major culprits the internal clock and the noise prone transmission

I have heard the ATMEGA8 has a bad Internal clock a so they both get out of sync quickly

also as I increase the BAUD rate the situation becomes worse

on the noise side the byte with more ONES (1) in upper nibble are received more than those having mostly 0

I think since its ASK there is a probablity that if you transmit zeros there is more room for noise to take over (ASK only)



HELP ME :(
 
Last edited by a moderator:

MrChips

Joined Oct 2, 2009
30,806
First rule of posting. Use a title that is relevant to the question.

Think what would happen if half the questions had titles like "Help help help!"
 

spinnaker

Joined Oct 29, 2009
7,830
First rule of posting. Use a title that is relevant to the question.

Think what would happen if half the questions had titles like "Help help help!"

Second rule of posting. Use a capital letter to start your sentences.

Third rule post a schematic.

Fourth rule

You need to be able to debug your own code and narrow the problem done some more. Few people have the time to read through a giant post like yours and give you an answer. The only thing worse than not enough information is too much information.

One way to help trouble shoot and debug is to create a new program that targets your specific issue. That way you can concentrate on the problem and better show the issue to forum members.
 

kubeek

Joined Sep 20, 2005
5,795
First check how it works when connected straight tx to rx.
For the future, when developing something like this it is almost mandatory to have a spare USART so you can print debug messages, this can make debugging so much easier.
The trasmitter and receiver that you use, are those just simple analog transmitters? Then you will need to send much more than a signle byte to be sure you get the right data on the other end. Something like a start byte, data payload and checksum should improve it. This also means you will have to transmit multiple times to have some chance of getting the data to the other side.
 
Top