My Tasks/threads stop working

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

My Tasks/threads stop working

Postby snahmad75 » Thu Sep 27, 2018 1:34 pm

Hi,

I am using latest ESP-IDF SDK versin 3.2 from git.

I have app main loop. one esp timer . I created few others tasks/threads. but I do ESP32 log from my two threads which logs every 10 seconds. I also do debug log from app main loop and esp timer.

My two threads stop working after running and processing CAN data and sending TCP messages.

One thread is sending TCP messages using mongoose. another thread check every 1ms perform processing CAN receive messages received in buffer from CAN RX interrup handler.

I have CAN interrupt handler. which picks any can messages. cannot do ESP debug/info logs into interrupt handler. not sure may be can use printf.

After sending can messages for sometime( 1 hour) suddenly ESP32 device stop receiving can messages and stop sending TCP messages from another thread. basically I can see my two threads stop printing debug logs but app main loop and esp timer still doing logs.

Any idea. I enable freeRTOS debug . My debug level is info. no error shown.

I am using dual core mode.

I will try single CPU mode as well.

Should I try ESP-IDF 3.1 stable release. how can i get stable release using git hub command. what is latest stable release.

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: My Tasks/threads stop working

Postby fly135 » Thu Sep 27, 2018 3:45 pm


snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: My Tasks/threads stop working

Postby snahmad75 » Thu Sep 27, 2018 4:24 pm

Thanks. got 3.1 stable release.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: My Tasks/threads stop working

Postby snahmad75 » Thu Sep 27, 2018 6:58 pm

My application now working reliable 100% in single core mode. I ran all my task on cpu=0 now.

It is good enough for our first release. I will try dual core with stable release version=3.1 when i found time later.

Any experience please do share.

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: My Tasks/threads stop working

Postby fly135 » Thu Sep 27, 2018 9:11 pm

I've been using the 3.1 release. My buddy wants to learn about programming the ESP32, so I helped him set up his laptop. I pulled from the master branch. I could not get the MSYS environment to work (win 10). I kept getting python errors. I tried performing the update script with windows_install_prerequisites.sh and other update recommendations in the setup guide. Couldn't get the problem fixed.

Since I've had it working on other installs I figured I would switch over to release v3.1. No other change and it started working fine.

John A

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: My Tasks/threads stop working

Postby snahmad75 » Fri Sep 28, 2018 10:09 am

Hi John,

Thanks for information. I am using Windows 7, so ESP-IDF SDK latest( 3.2) builds ok.

I am using CAN Driver as well. CAN Driver is not release in last stable release 3.1

I am getting esp timer queue overflow some time. It cause my devices to gets slow down cpu processing speed. I know I should not be using latest source code from ESP-IDF, bu tI have to due to CAN Driver usage now.

May be I can try copy just can driver from V3.2 folder to V3.1 and check if it builds ok.

Now I am using single core cpu mode

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: My Tasks/threads stop working

Postby snahmad75 » Fri Oct 05, 2018 8:27 pm

Kindly do reply. I are going into production within 1 month time. need to sort this out.

We need to use latest source version=3.2 which have CAN driver. we need to use dual core mode.

kindly some one help us with ideas.

I did try out stable version 3.1. i manage to copy CAN driver files from version=3.2 folder into 3.1 folder. It is building ok. but when i run it. no CAN transmit and receive happening. it could be CAN interrupt handler not working in 3.1

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: My Tasks/threads stop working

Postby ESP_Sprite » Sat Oct 06, 2018 5:30 am

It sounds like a race condition of some kind... any chance you have JTAG debugging working? If so, you should be able to see what the halted threads are waiting on.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: My Tasks/threads stop working

Postby snahmad75 » Sat Oct 06, 2018 11:04 am

I am using Windows machine. tricky to work with JATG debugger. I have not try much.
I need to try setup JATG with either eclipse or visual studio to get better picture about threads/tasks aand their states soon.

I do get logs using make monitor.
I do use freeRTOS CPU stats to get thread usage and state. I can try looking into.

For CPU Tasks usage.

static char __stats_buffer[1024];
vTaskGetRunTimeStats(__stats_buffer);
printf("%s\n", __stats_buffer);
vTaskList(__stats_buffer);
printtf"%s\n", __stats_buffer);

but this does not shows all threads. It shows only active threads. I have few thread in suspend state.

Have some one used JTAG debugging on windows platform?

Who is online

Users browsing this forum: No registered users and 147 guests