Arduino RX not working

I am trying to read an SMS message from a GSM modem .

My arduino TX and RX are connected to a MAX232 IC and from the IC another 2 wires goes to the RS232 cable of the Modem.

I am capable of sending a string to the modem. I even sent an SMS from the arduino. and I also see the TX led flashing when sending the strings

When I try to read the responses from the modem I get nothing because the serial interrupt is not being triggered

When I disconnect the RX pin of the arduino that goes to the MAX232 it works . When i send something through the serial port it works, the RX led blinks and the prints me back the string as supposed

any ideas are appreceated

Thanks

You don't mention a GND connection. That is usually essential as well as Rx and Tx.

...R

Yes I used common ground from the RS232 cable

I assume that if the TX worked with that ground the RX should too

Post your code.
And please use the code button </> so your code looks like this and is easy to copy to a text editor

…R

char receivedString[100]; // received string
char sensorString[100]; // received string
char count; // string counter

float time_counter=0;
float seconds;

void setup() {

Timer_Initialise();
serialBegin();
interrupt_Initialise();
sei();
pinMode(13,OUTPUT);

}

void loop() {
serialPrint(“at+cmgf=1\r”);
delay(5000);

}

//*****************************//
void serialBegin(void)
{
int baudrate=103; // 9600

UCSR0B = (1 << RXEN0) | (1 << TXEN0); // Turn on the transmission and reception circuitry
UCSR0C = (3 << UCSZ00) | (1 << USBS0); // Use 8-bit character frame

UBRR0H = (baudrate>>8); // Load upper 8-bits of the baud rate value into the high byte of the UBRR register
UBRR0L = baudrate; // Load lower 8-bits of the baud rate value into the low byte of the UBRR register
UCSR0B |= (1 << RXCIE0); // enable RX interrupt
}

void Timer_Initialise(void){
// Divide clock Freq by 64
// The timer is cleared after the compare (1mS)
TCCR1B=(1<<WGM12)|(1<<CS11)|(1<<CS10);

OCR1A=250; // (1/f)PS = 4uS 4uS250 = 1mS delay without pausing the programm
TIMSK1|=(1<<OCIE1A); //Enable the Output Compare A interrupt
}

void interrupt_Initialise(void){
sei();
EIMSK = 1<<INT0; // enable external interrupt
EICRA = 1<<ISC01 | 1<<ISC00; // detect rising edge
}

//*****************************//
void serialPrint(char *x)
{
while(*x != 0) //search for null terminator
{
UDR0=*x; // transmit a character
x++; // look the next character
delay(100);
}

}
//*****************************//

void sendSMS(void)
{
serialPrint(“at+cmgs= “);
serialPrint(””+35679852525" \r");
serialPrint(“hello”);
delay(1000);
UDR0=26; //Ctrl+Z
delay(10000);

}

//*****************************//
ISR(USART_RX_vect) // Read String
{

digitalWrite(13,HIGH);
receivedString[count]=UDR0;
delay(100);
if(receivedString[count]==’\n’)
{
receivedString[count-1]=0;
count=0;
UDR0=0;

if (strcmp(“OK”, receivedString) == 0)
{
digitalWrite(13,HIGH);
serialPrint(“babababa\n”);

delay(5000);

}

}

else{

count++;

}

}

ISR (TIMER1_COMPA_vect)
{
time_counter++; // every 1mS

}

ISR(INT0_vect)
{
seconds=(time_counter/1000)+(TCNT1*0.000004);
sprintf(sensorString,"%f",seconds);
time_counter=0;

}

You obviously did not read all of Reply #3.

...R

I did’t got your point, using the >< and pasting directly would not make a difference for you. it the same code after all

bastjan:
it the same code after all

Perhaps. But I suspect you did not put smileys in your code.

And the way you have it I can’t click SELECT and copy it to my text editor. Help us to help you. Read How to use the Forum

Frankly, I wonder why I even wasted the time to write this.

…R

I did’t got your point, using the >< and pasting directly would not make a difference for you. it the same code after all

Please read #7 below:

http://forum.arduino.cc/index.php/topic,148850.0.html