[solved] why nonstop process paused - no continuous output

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

[solved] why nonstop process paused - no continuous output

Postby rudi ;-) » Thu Nov 17, 2016 11:39 pm

simple code:

This simple example stands for several std outputs

Code: Select all


void app_main() {
  uint32_t counts = 0;
  
  nvs_flash_init();
  /// system_init();
  
  while (-1) {
     printf("Counter: %10d\r", counts);
     counts++;
  }

}

paused several tacts -
Output on Youtube

does here work a 'hidden' fill in sendbuffer ?
can we change to "each char" to get continuous output`?

thanks for watching and tips

best wishes
rudi ;-)


btw:
nonstop continuous printf output example ESP31 ADC
Last edited by rudi ;-) on Fri Nov 18, 2016 4:11 am, edited 1 time in total.
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: why nonstop process paused - no continuous output

Postby WiFive » Fri Nov 18, 2016 12:29 am

It is still a task and buffers

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: why nonstop process paused - no continuous output

Postby rudi ;-) » Fri Nov 18, 2016 12:35 am

WiFive wrote:It is still a task and buffers
txs, void app_main is a task?
Can we increase the priority of the app_main ?
or better, can we call app_main with arguments?

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: why nonstop process paused - no continuous output

Postby WiFive » Fri Nov 18, 2016 12:43 am

Why not just make a new task with high priority and pinned to single core if you want.

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: why nonstop process paused - no continuous output

Postby rudi ;-) » Fri Nov 18, 2016 12:55 am

WiFive wrote:Why not just make a new task with high priority and pinned to single core if you want.
txs - ok - this i have thinked too -- give them a try.
btw:
http://www.esp32.com/viewtopic.php?t=272#p1163
but not sure, we can go higher priority like the caller is ?

btw found this too:
http://www.freertos.org/a00125.html
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: why nonstop process paused - no continuous output

Postby rudi ;-) » Fri Nov 18, 2016 1:04 am

WiFive wrote:Why not just make a new task with high priority and pinned to single core if you want.
no change
highest priority

Code: Select all

xTaskCreatePinnedToCore(&counter_task, "counter_task", 1024, NULL, configMAX_PRIORITIES - 1, NULL, 0);
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: why nonstop process paused - no continuous output

Postby rudi ;-) » Fri Nov 18, 2016 1:50 am

this i do not understand,
the 1000 ms delay "buffering" the work on counts
and delay time is much much more in real: ( 6-7 times more )

Code: Select all


void app_main() {
  uint32_t counts = 0;
  
  nvs_flash_init();
  /// system_init();
  
  while (-1) {
     printf("Counter: %10d\r", counts);
     counts++;
     vTaskDelay(1000 / portTICK_PERIOD_MS);
  }
}
i tried the same with new Task too - but no change -

Counter Output with 1000 ms delay Youtube Video
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: why nonstop process paused - no continuous output

Postby WiFive » Fri Nov 18, 2016 2:05 am

Did you try to add fflush(stdout)?

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: why nonstop process paused - no continuous output

Postby rudi ;-) » Fri Nov 18, 2016 2:31 am

WiFive wrote:Did you try to add fflush(stdout)?
since you cursed me i did not use fflush any more :lol: ,
( remember i used it in the ISR )
but you are right, WiFive, this is the buffer clean trick, and now i go on in this!
have forget the important thing, txs WiFive again!

nice run now YouTube Video

btw i tried this in arduino ide too, - without fflash(stdout) -
youtube video
the same effect only was in buffer fill
the time effect was ok with delay ( 1 )
can we fflush(stdout) in arduino? do you know?
will test ..

txs again!
best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: why nonstop process paused - no continuous output

Postby rudi ;-) » Fri Nov 18, 2016 2:37 am

tried in arduino ide with fflush(stdout);

Code: Select all

void loop() {
   Serial.println(counter);
  fflush(stdout);
  counter++;
  delay(1);
}
this do not change the counting right way.
same like in last video.
i am usually not work in the arduino ide
perhabs i do make wrong code

EDIT:

Code: Select all

void setup() {
  Serial.begin(115200);
}

int counter = 0;

void loop() {
  Serial.print(counter);
  Serial.print('\r');
  fflush(stdout);
  counter++;
  delay(10);
}
now it is ok in arduino ide too
;)
Last edited by rudi ;-) on Fri Nov 18, 2016 4:07 am, edited 1 time in total.
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: No registered users and 101 guests