cancel
Showing results for 
Search instead for 
Did you mean: 

My MCU works fine in debug mode but out of debug mode it suddenly fails

parisa
Senior
Posted on March 25, 2017 at 21:09

Hi,

Something is driving me crazy.

Actually I have written a program that

it:

receive 100chars each 60ms from USART1 and 2 with RXNE interrupt(baudrate 57600)

receive100chars each 100ms from Ethernet with PHY and after processing it sends to USARTs port with TXNE interrupt

sends 120 chars to PC via Ethernet each 100ms with Timer.

it works fine when I connect my board via st-link in debug mode but when I get off out of debug mode it works for 1-2 hours and suddenly hangs and disables Ethernet communication.In this states I can't realize what  my problem is.

what is your idea about this strange states? why it works fine in debug mode?

Thanks in advance

20 REPLIES 20
parisa
Senior
Posted on May 01, 2017 at 13:32

Hi,

Thanks for your response and sorry for my long delay.

I have found something interesting with my communication, according to dear Clive one,Avatar and KIC8462852 EPIC204278916 I check different parts of my code and I see this error in my PC with wireshark program.

0690X00000606unQAA.png

It shows me that my device (IP 150) 's TCP window has been zero however I clear TCP windows each time That I receive any new data.

0690X00000606usQAA.png

uint32_t tcp_cb_func (int32_t socket, netTCP_Event event,const NET_ADDR *addr, const uint8_t *buf, uint32_t len) {

   switch (event) {

    case netTCP_EventConnect:Ether.DataAvailable=0;return (1);

    case netTCP_EventData:Ether.DataAvailable=1;Ether.Len=len;memcpy(PCSTR,  buf,len);netTCP_ResetReceiveWindow(Socket);break;

        }

  return (0);

}

But why it becomes zero?