Scenario
STM8266
FREE RTOS SDK
>>>>>Connecting to Mobile phone Wifi HotSpot
I am sending UDP Messages to a mobile app around 90 per second, inside a task , with a while(1)
the problem is that the code crash on me randomly , the less vTaskdelay i use the more is crashing.
The connection between ESP and phone is Solid and very close together
ERROR
Code: Select all
91 Per Second
91 Per Second
91 Per Second
91 Per Second
91 Per Second
83 Per Second
24 Per Second
[0;31mE (454685) wifi: no buf for probe, ie len 0[0m
4 Per Second
5 Per Second
5 Per Second
4 Per Second
5 Per Second
pm 1253
ets Jan 8 2013,rst cause:4, boot mode:(3,7)
wdt reset
abort() was called at PC 0x402518cb on core 0
Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x402151b2 PS : 0x00000033 A0 : 0x402151b0 A1 : 0x3fff9e20
A2 : 0x00000000 A3 : 0x00000001 A4 : 0xffffffdb A5 : 0x00000001
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000000 A9 : 0xffffffe3
A10 : 0x00000010 A11 : 0xfffffffc A12 : 0x401074b0 A13 : 0x00000004
A14 : 0x40106f60 A15 : 0x40107314 SAR : 0x0000001e EXCCAUSE: 0x0000001d
Backtrace: 0x402151b2:0x3fff9e20 0x402518ce:0x3fff9e30 0x40251a41:0x3fff9e40 0x4027d1f3:0x3fff9e50 0x4027d254:0x3fff9e70 0x4027d2fe:0x3fff9ea0 0x40219792:0x3fff9eb0 0x40219fa5:0x3fff9f40 0x4021a102:0x3fff9f50 0x4021a5d5:0x3fff9f60 0x4021a90a:0x3fff9f70
ets Jan 8 2013,rst cause:4, boot mode:(3,7)
Code: Select all
inside TASK
int sock = socket(addr_family, SOCK_DGRAM, ip_protocol);
if (sock < 0)
{
printf("Unable to create socket: errno %d", errno);
printf("Failed to create socket/n");
break;
}
// Set timeout
struct timeval timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);
printf("Socket created, sending to %s:%d", SERVER_IP, SERVER_PORT);
while (1)
{
const uint32_t cur_time = MY_MILLIS();
makedata();
if (elapsed_time(cur_time, send_time2) >= 1000)
{
send_time2 = cur_time;
printf("%d Per Second \n", countUDP);
countUDP = 0;
}
clientAddress.sin_family = AF_INET;
clientAddress.sin_port = htons(11000);
int sent3 = sendto(sock, (uint8_t *)data, sizeof(data), 0, (struct sockaddr *)&data, sizeof(clientAddress));
countUDP = countUDP + 1;
if (sent3 < 0)
{
printf(" send error number %d from Port %d %s \n", sent3, ntohs(clientAddress.sin_port), inet_ntoa(clientAddress.sin_addr));
}
if (elapsed_time(cur_time, send_time3) >= 20000)
{
send_time3 = cur_time;
sta_ip = wifi_got_ip();
ap_sta = wifi_ap_has_client();
connected = sta_ip || ap_sta;
printf("Check if is connected \n");
}
}
vTaskDelay(10); //the more the better but costs me frames....
}