Search found 29 matches

by dmitryga
Fri Sep 13, 2019 2:27 pm
Forum: General Discussion
Topic: DHCP server and client at the same time
Replies: 1
Views: 4637

DHCP server and client at the same time

Hi, I'm trying to build simple ESP-32-based router with WiFi and Ethernet interfaces. I've already checked this solution https://github.com/espressif/esp-iot-solution/tree/master/examples/eth2wifi , but it acts like a bridge and does not suite my needs. And I want to build IP router based on lwIP st...
by dmitryga
Fri Jan 18, 2019 11:19 am
Forum: General Discussion
Topic: fread fails very often
Replies: 1
Views: 3771

fread fails very often

Hi everybody! I'm using SPIFFS file system to store some intermediate data in files. So I use fopen/fread/fwrite/fclose functions to manipulate file contents. Generally everything works OK, but fread fails in about 10% of cases. When it happens ferror returns 1 and errno is equal to 5. I've tried to...
by dmitryga
Thu Sep 20, 2018 4:32 pm
Forum: General Discussion
Topic: Synchronizing access to file from different tasks
Replies: 10
Views: 19152

Re: Synchronizing access to file from different tasks

With CONFIG_HEAP_POISONING_COMPREHENSIVE enabled today in the morning I got same assert again two times. Both were in the same place in xQueueGenericReceive function. If I understand source code correctly, heap poisoning should cause HEAP CORRUPT exception. But I don't see such exceptions or warning...
by dmitryga
Thu Sep 20, 2018 7:38 am
Forum: General Discussion
Topic: Synchronizing access to file from different tasks
Replies: 10
Views: 19152

Re: Synchronizing access to file from different tasks

Yes, I also thought that it's worth enabling an extended heap and stack checking. Hope this helps to detect the source of this problem.

But what about file corruption? Is there any way to protect data from corruption?
by dmitryga
Thu Sep 20, 2018 7:30 am
Forum: General Discussion
Topic: Ethernet goes mad
Replies: 7
Views: 10656

Re: Ethernet goes mad

There are no loops in our network. We're using switches with STP support which are shutting down looped ports. This problem is reproducible even when ESP ethernet port is connected directly to PC ethernet port with a single link. Thank you for information about MAC address fix. I'll check if we are ...
by dmitryga
Wed Sep 19, 2018 4:22 pm
Forum: General Discussion
Topic: Synchronizing access to file from different tasks
Replies: 10
Views: 19152

Re: Synchronizing access to file from different tasks

A little bit more information about exception that caused ESP reboot. It was assert at line 1442 of freertos/queue.c inside xQueueGenericReceive function. I'm not using this function directly but it is used by xSemaphoreTake macro which is used in my code, especially with mutex to synchronize file a...
by dmitryga
Wed Sep 19, 2018 4:09 pm
Forum: General Discussion
Topic: Synchronizing access to file from different tasks
Replies: 10
Views: 19152

Re: Synchronizing access to file from different tasks

I'm using SPIFFS filesystem located on flash. SPIFFS partition size is 128KB, it holds only 3 files about 10-12KB in total. Today I was able to detect the moment when file got corrupted. Code was performing some file contents manipulation (reading and writing). These manipulations were completed suc...
by dmitryga
Wed Sep 19, 2018 7:55 am
Forum: General Discussion
Topic: Synchronizing access to file from different tasks
Replies: 10
Views: 19152

Re: Synchronizing access to file from different tasks

Thanks to everybody for replies! In my case mutex works fine, but I noticed that sometimes file becomes corrupt. File dump analysis showed that 4 or 8 extra bytes were written somewhere in the middle of the file and all the records after this place were shifted accordingly. Since file has strongly t...
by dmitryga
Tue Sep 18, 2018 3:08 pm
Forum: General Discussion
Topic: Synchronizing access to file from different tasks
Replies: 10
Views: 19152

Synchronizing access to file from different tasks

Hi everybody! I want to know what is the best practice to synchronize file access from different tasks? I'm accessing single file from different tasks and want to guarantee that file access is an atomic operation (another task has to wait when first task finishes file access cycle: open file -> read...
by dmitryga
Tue Sep 18, 2018 3:02 pm
Forum: General Discussion
Topic: Ethernet goes mad
Replies: 7
Views: 10656

Re: Ethernet goes mad

I'm back with update about my problem with ethernet. I've took "magic" value 5704 (0x1648) from STP packet and made search across ESP-IDF sources. And I've found only one occurrence inside ethernet\emac_dev.c file in emac_enable_flowctrl function. So I've decided to disable flow control during ether...