6 months ago.

Help needed: MODSERIAL software stops after a while, a buffer issue?

Hi,

I'm using great MODSERIAL module in my software. Software runs fine but suddenly after a while it "stops". I see from debugger, that it does not hang but it wont send any commands to serial interface anymore. I don't know how to go forward. Let me explain my issue.

I have modem connected to my device that has LPC11U68.

I initialize the serial MODSERIAL

modem2(UART_TXD, UART_RXD, 128);

And I attach interrupts

int main() {
	modem2.attach(&messageReceive, MODSERIAL::RxAutoDetect);
	modem2.attach(&rxCallback, MODSERIAL::RxIrq);
 // ...
}
void messageReceive(MODSERIAL_IRQ_INFO *q) {
    MODSERIAL *sys = q->serial;

    char *found;

	sys->move(messageBufferIncoming, MESSAGE_BUFFER_SIZE);

    messageReceived = true;
    led_act = !led_act;
   // ....
return;
}

void rxCallback(MODSERIAL_IRQ_INFO *q) {
	bool put_to;
	MODSERIAL *pc = q->serial;
	char c = pc->rxGetLastChar();

       // ... do things with the c
    return;
}

Then I send AT-commands to modem and fetch data from the internet.

Sofware loops this fetching so it is polling the website content.

I read the response.

After every command I try to empty the serial buffer calling getc.

	while(modem2.readable()) {
		c =  modem2.getc();
      }

After some time something strange happens. Software is not hanging up but no led_act flashing, so I assume no command are sent to the modem. MODSERIAL's buffer[RxIrq|TxIrw] are both full. If i initialize MODSERIAL with larger buffer, same thing happens but it takes more time, that's why I initialize it 128B buffer.

What should I try next? Thank you!

Comment on this question
Be the first to answer this question.

You need to log in to post a question