<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">A zrovna nad tim badam a jedna vec mi
nejde do hlavy:</div>
<div class="moz-cite-prefix">v modulu port.c je obsluha <br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">BaseType_t xPortSysTickHandler( void )<br>
{<br>
BaseType_t ret;<br>
<br>
portbenchmarkIntLatency();<br>
traceISR_ENTER(SYSTICK_INTR_ID);<br>
ret = xTaskIncrementTick();<br>
if( ret != pdFALSE )<br>
{<br>
portYIELD_FROM_ISR();<br>
} else {<br>
traceISR_EXIT();<br>
}<br>
return ret;<br>
}<br>
<br>
</div>
<div class="moz-cite-prefix">Je logicky umistena v IRAM sekci ale
proc??? Funkce nema specifikovany IRAM_ATTR, ani v hlavicce.</div>
<div class="moz-cite-prefix">zrovna tak BaseType_t
xTaskIncrementTick( void ) v tasks.c</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Tady uz treba attribut je</div>
<div class="moz-cite-prefix">void IRAM_ATTR
esp_vApplicationTickHook(void)<br>
{<br>
int n;<br>
int core = xPortGetCoreID();<br>
for (n=0; n<MAX_HOOKS; n++) {<br>
if (tick_cb[core][n]!=NULL) {<br>
tick_cb[core][n]();<br>
}<br>
}<br>
}</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Funkce se vnoruji v tomto poradi.<br>
</div>
<p>Zkousel jsem se povesit na hook od toho casovace a funguje to,
jak z Flash, tak z IRAM (to je asi rozumnejsi, kdyz je to v ISR)<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Dne 02.08.2021 v 12:32 Jaroslav Buchta
napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:3369d673-358e-1a56-9184-95311e7c932f@hascomp.cz">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">At to ctu stale dokola, nevidim
prostor pro zkraceni <a
href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html#task-api"
moz-do-not-send="true">FreeRTOS - ESP32 - — ESP-IDF
Programming Guide latest documentation (espressif.com)</a></div>
<div class="moz-cite-prefix">Jen je tam upozorneni, ze je nejista
prodleva, kdy bude zavolana funkce a az od te doby se to
pocita. vTaskDelayUntil bude mit asi jediny rozdil v tom, ze je
tam dany cas ukonceni cekani jako parametr, u vTaskDelay se tato
hodnot asi ulozi v okamziku volani.</div>
<div class="moz-cite-prefix">A i tak by se jednalo spis o
milisekundy nez sekundy...</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Koukam na to, ze ty funkce pracuji v
principu uplne stejne, pouziji pro uspani<br>
</div>
<div class="moz-cite-prefix">
prvAddCurrentTaskToDelayedList(...);<br>
jenom jinak pocitaji dobu pro uspani...</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Pokud opravdu muze dojit ke zkraceni
intervalu, bylo by v systemu neco velmi spatne. Neprobehne
nahodou spis restart?</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">//////////////////////////////<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix"> void vTaskDelay( const TickType_t
xTicksToDelay )<br>
{<br>
BaseType_t xAlreadyYielded = pdFALSE;<br>
<br>
/* A delay time of zero just forces a reschedule. */<br>
if( xTicksToDelay > ( TickType_t ) 0U )<br>
{<br>
configASSERT( uxSchedulerSuspended[xPortGetCoreID()]
== 0 );<br>
taskENTER_CRITICAL( &xTaskQueueMutex );<br>
{<br>
traceTASK_DELAY();<br>
<br>
/* A task that is removed from the event list
while the<br>
scheduler is suspended will not get placed in
the ready<br>
list or removed from the blocked list until the
scheduler<br>
is resumed.<br>
<br>
This task cannot be in an event list as it is
the currently<br>
executing task. */<br>
prvAddCurrentTaskToDelayedList(
xPortGetCoreID(), xTicksToDelay );<br>
}<br>
taskEXIT_CRITICAL( &xTaskQueueMutex );<br>
}<br>
else<br>
{<br>
mtCOVERAGE_TEST_MARKER();<br>
}<br>
<br>
/* Force a reschedule if xTaskResumeAll has not already
done so, we may<br>
have put ourselves to sleep. */<br>
if( xAlreadyYielded == pdFALSE )<br>
{<br>
portYIELD_WITHIN_API();<br>
}<br>
else<br>
{<br>
mtCOVERAGE_TEST_MARKER();<br>
}<br>
}<br>
<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix"> void vTaskDelayUntil( TickType_t
* const pxPreviousWakeTime, const TickType_t xTimeIncrement )<br>
{<br>
TickType_t xTimeToWake;<br>
BaseType_t xAlreadyYielded = pdFALSE, xShouldDelay =
pdFALSE;<br>
<br>
configASSERT( pxPreviousWakeTime );<br>
configASSERT( ( xTimeIncrement > 0U ) );<br>
configASSERT( uxSchedulerSuspended[xPortGetCoreID()] ==
0 );<br>
<br>
taskENTER_CRITICAL( &xTaskQueueMutex );<br>
{<br>
/* Minor optimisation. The tick count cannot change
in this<br>
block. */<br>
const TickType_t xConstTickCount = xTickCount;<br>
<br>
/* Generate the tick time at which the task wants to
wake. */<br>
xTimeToWake = *pxPreviousWakeTime + xTimeIncrement;<br>
<br>
if( xConstTickCount < *pxPreviousWakeTime )<br>
{<br>
/* The tick count has overflowed since this
function was<br>
lasted called. In this case the only time we
should ever<br>
actually delay is if the wake time has also
overflowed,<br>
and the wake time is greater than the tick
time. When this<br>
is the case it is as if neither time had
overflowed. */<br>
if( ( xTimeToWake < *pxPreviousWakeTime )
&& ( xTimeToWake > xConstTickCount ) )<br>
{<br>
xShouldDelay = pdTRUE;<br>
}<br>
else<br>
{<br>
mtCOVERAGE_TEST_MARKER();<br>
}<br>
}<br>
else<br>
{<br>
/* The tick time has not overflowed. In this
case we will<br>
delay if either the wake time has overflowed,
and/or the<br>
tick time is less than the wake time. */<br>
if( ( xTimeToWake < *pxPreviousWakeTime ) ||
( xTimeToWake > xConstTickCount ) )<br>
{<br>
xShouldDelay = pdTRUE;<br>
}<br>
else<br>
{<br>
mtCOVERAGE_TEST_MARKER();<br>
}<br>
}<br>
<br>
/* Update the wake time ready for the next call. */<br>
*pxPreviousWakeTime = xTimeToWake;<br>
<br>
if( xShouldDelay != pdFALSE )<br>
{<br>
traceTASK_DELAY_UNTIL();<br>
<br>
/* prvAddCurrentTaskToDelayedList() needs the
block time, not<br>
the time to wake, so subtract the current tick
count. */<br>
prvAddCurrentTaskToDelayedList(
xPortGetCoreID(), xTimeToWake - xConstTickCount );<br>
}<br>
else<br>
{<br>
mtCOVERAGE_TEST_MARKER();<br>
}<br>
}<br>
taskEXIT_CRITICAL( &xTaskQueueMutex );<br>
<br>
/* Force a reschedule if xTaskResumeAll has not already
done so, we may<br>
have put ourselves to sleep. */<br>
if( xAlreadyYielded == pdFALSE )<br>
{<br>
portYIELD_WITHIN_API();<br>
}<br>
else<br>
{<br>
mtCOVERAGE_TEST_MARKER();<br>
}<br>
}<br>
<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Dne 02.08.2021 v 12:09 as5s
napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:a6ae0720-c9e9-9bb0-bf60-e9a6c5115441@gmail.com">
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<p>Netusim ako to presne funguje, ale v dokumentacii na to
upozornuju.</p>
<p>ale je mi cudne ze sa to skrati. O kolko sa to skrati?</p>
<p>Myre<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 2. 8. 2021 10:35, Jaroslav
Buchta wrote:<br>
</div>
<blockquote type="cite"
cite="mid:6478535f-fed3-91da-fd9d-a3c892b4898b@hascomp.cz">
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<div class="moz-cite-prefix">To jako opravdu vTaskDelay muze
fungovat nespolehlive, teda jeste k tomu se zkratit? <br>
</div>
<div class="moz-cite-prefix">To snad primo pocita systemova
preruseni od casovace (default tusim 100Hz), ze by se nejaky
nestihly bych jeste pochopil...</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Dne 02.08.2021 v 9:49 as5s
napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:7be7b28f-486b-6042-224c-c29f70e2ce70@gmail.com">
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<p>Dobry den,</p>
<p>skuste pozriet na vTaskDelayUntil()</p>
<p><a class="moz-txt-link-freetext"
href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html#_CPPv415vTaskDelayUntilPC10TickType_tK10TickType_t"
moz-do-not-send="true">https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html#_CPPv415vTaskDelayUntilPC10TickType_tK10TickType_t</a></p>
<p>mozno vam to bude stacit.</p>
<p>Myre<br>
</p>
<div class="moz-cite-prefix">On 2. 8. 2021 9:45, Jan Půhoný
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAEwSxSEWcQeVBq=FroAkjpRNvi=L555d4VpQ1fFMCsaw4AXjHA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<div dir="ltr">Dobrý den,
<div><br>
</div>
<div>mám tady další zádrhel - mějme funkci, která ovládá
výstupní piny, potřebuji po nastavení udžet cca 20
sekund v HIGH a pak vrátit vše do low. Jedná se o
otevítání a zavírání ventilu. Přidal jsem tedy mezi
to <span style="font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre;background-color:rgb(30,30,30);color:rgb(220,220,170)">vTaskDelay</span><span style="color:rgb(212,212,212);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre;background-color:rgb(30,30,30)">(</span><span style="font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre;background-color:rgb(30,30,30);color:rgb(181,206,168)">20000</span><span style="color:rgb(212,212,212);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre;background-color:rgb(30,30,30)"> / </span><span style="font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre;background-color:rgb(30,30,30);color:rgb(86,156,214)">portTICK_PERIOD_MS</span><span style="color:rgb(212,212,212);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre;background-color:rgb(30,30,30)">);</span>
, problém je v tom, že někdy se to zpoždění značně
zkrátí a ventil zůstane napolo otevřený. Jak se toto
dá ošetřit aby se vTaskDelay(20000 /
portTICK_PERIOD_MS); nikdy nemohlo zkrátit a bylo
dodrženo.</div>
<div><br>
</div>
<div>Volám to pak standardně přes
xTaskCreatePinnedToCore() ....</div>
<div><br>
</div>
<div>
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(86,156,214)">void</span> <span style="color:rgb(220,220,170)">vent1On</span>(<span style="color:rgb(86,156,214)">void</span> <span style="color:rgb(86,156,214)">*</span> <span style="color:rgb(156,220,254)">parameter</span>){</div><div> <span style="color:rgb(197,134,192)">for</span>(;;){<span style="color:rgb(106,153,85)"> // infinite loop </span></div>
<div> <span style="color:rgb(156,220,254)">button1</span>.<span style="color:rgb(220,220,170)">update</span>(<span style="color:rgb(181,206,168)">1</span>);</div>
<div> <span style="color:rgb(220,220,170)">digitalWrite</span>(<span style="color:rgb(156,220,254)">ventMain1</span>, <span style="color:rgb(86,156,214)">HIGH</span>);</div><div> <span style="color:rgb(220,220,170)">digitalWrite</span>(<span style="color:rgb(156,220,254)">ventOn1</span>, <span style="color:rgb(86,156,214)">HIGH</span>);</div><div> <span style="color:rgb(220,220,170)">digitalWrite</span>(<span style="color:rgb(156,220,254)">ledPinRed</span>, <span style="color:rgb(86,156,214)">HIGH</span>);</div>
<div><span style="color:rgb(106,153,85)"> // Pause the task fo 20s</span></div><div> <span style="color:rgb(220,220,170)">vTaskDelay</span>(<span style="color:rgb(181,206,168)">20000</span> / <span style="color:rgb(86,156,214)">portTICK_PERIOD_MS</span>);</div><div> </div><div> <span style="color:rgb(220,220,170)">digitalWrite</span>(<span style="color:rgb(156,220,254)">ventMain1</span>, <span style="color:rgb(86,156,214)">LOW</span>);</div><div> <span style="color:rgb(220,220,170)">digitalWrite</span>(<span style="color:rgb(156,220,254)">ventOn1</span>, <span style="color:rgb(86,156,214)">LOW</span>);</div><div> <span style="color:rgb(220,220,170)">digitalWrite</span>(<span style="color:rgb(156,220,254)">ledPinRed</span>, <span style="color:rgb(86,156,214)">LOW</span>);</div>
<div> <span style="color:rgb(220,220,170)">vTaskDelete</span>(<span style="color:rgb(86,156,214)">NULL</span>);<span style="color:rgb(106,153,85)"> //spustí se jen jednou</span></div><div> }</div><div>}</div></div>
<div><br>
</div>
<div><br>
</div>
<div>xTaskCreatePinnedToCore(<br>
vent1On, // Function that should be called<br>
"vent1On", // Name of the task (for debugging)<br>
1000, // Stack size (bytes)<br>
NULL, // Parameter to pass<br>
1, // Task priority<br>
NULL, // Task handle<br>
0 // Core 1/0<br>
);<br>
</div>
<div><br clear="all">
<div>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>HP</div>
</div>
</div>
</div>
</div>
</div>
<br>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">so 31. 7. 2021 v 8:27
odesílatel Jan Půhoný <<a
href="mailto:konference@puhy.cz"
moz-do-not-send="true">konference@puhy.cz</a>>
napsal:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px
0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Díky, zkusil jsem jak 2000 tak 4000 ale
stále stejné. Resetuje se to pořád dokola s tímto:
<div><br>
</div>
<div>rst:0x1 (POWERON_RESET),boot:0x12
(SPI_FAST_FLASH_BOOT)<br>
configsip: 0, SPIWP:0xee<br>
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00<br>
mode:DIO, clock div:2<br>
load:0x3fff0018,len:4<br>
load:0x3fff001c,len:1044<br>
load:0x40078000,len:10124<br>
load:0x40080400,len:5828<br>
entry 0x400806a8</div>
<div><br>
</div>
<div><b>Ale zjistil jsem, že to dělá jen pokud to
napájím z USB. Když to dám přímo do svého
zapojení, kde je pořádná kapacita na Vin, tak to
drží. Takže skutečně jen problém s napájením.</b></div>
<div><br>
</div>
<div>Teď už to budu programovat jen přes OTA, takže
vyřešeno.</div>
<div><br>
</div>
<div>
<div>HP<br>
<br>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">so 31. 7. 2021
v 6:44 odesílatel Jaroslav Buchta <<a
href="mailto:jaroslav.buchta@hascomp.cz"
target="_blank" moz-do-not-send="true">jaroslav.buchta@hascomp.cz</a>>
napsal:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px
0px 0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">kod jsem
nezkoumal ale na prvni pohled mi prijde maly
zasobnik pro <br>
vlakno, tady je to tusim v btech. dal bych 2 nebo
4K na zkousku<br>
_______________________________________________<br>
HW-list mailing list - sponsored by <a
href="http://www.HW.cz" rel="noreferrer"
target="_blank" moz-do-not-send="true">www.HW.cz</a><br>
<a href="mailto:Hw-list@list.hw.cz"
target="_blank" moz-do-not-send="true">Hw-list@list.hw.cz</a><br>
<a
href="http://list.hw.cz/mailman/listinfo/hw-list"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://list.hw.cz/mailman/listinfo/hw-list</a><br>
</blockquote>
</div>
</blockquote>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
HW-list mailing list - sponsored by <a class="moz-txt-link-abbreviated" href="http://www.HW.cz" moz-do-not-send="true">www.HW.cz</a>
<a class="moz-txt-link-abbreviated" href="mailto:Hw-list@list.hw.cz" moz-do-not-send="true">Hw-list@list.hw.cz</a>
<a class="moz-txt-link-freetext" href="http://list.hw.cz/mailman/listinfo/hw-list" moz-do-not-send="true">http://list.hw.cz/mailman/listinfo/hw-list</a>
</pre>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
HW-list mailing list - sponsored by <a class="moz-txt-link-abbreviated" href="http://www.HW.cz" moz-do-not-send="true">www.HW.cz</a>
<a class="moz-txt-link-abbreviated" href="mailto:Hw-list@list.hw.cz" moz-do-not-send="true">Hw-list@list.hw.cz</a>
<a class="moz-txt-link-freetext" href="http://list.hw.cz/mailman/listinfo/hw-list" moz-do-not-send="true">http://list.hw.cz/mailman/listinfo/hw-list</a>
</pre>
</blockquote>
<p><br>
</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
HW-list mailing list - sponsored by <a class="moz-txt-link-abbreviated" href="http://www.HW.cz" moz-do-not-send="true">www.HW.cz</a>
<a class="moz-txt-link-abbreviated" href="mailto:Hw-list@list.hw.cz" moz-do-not-send="true">Hw-list@list.hw.cz</a>
<a class="moz-txt-link-freetext" href="http://list.hw.cz/mailman/listinfo/hw-list" moz-do-not-send="true">http://list.hw.cz/mailman/listinfo/hw-list</a>
</pre>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
HW-list mailing list - sponsored by <a class="moz-txt-link-abbreviated" href="http://www.HW.cz" moz-do-not-send="true">www.HW.cz</a>
<a class="moz-txt-link-abbreviated" href="mailto:Hw-list@list.hw.cz" moz-do-not-send="true">Hw-list@list.hw.cz</a>
<a class="moz-txt-link-freetext" href="http://list.hw.cz/mailman/listinfo/hw-list" moz-do-not-send="true">http://list.hw.cz/mailman/listinfo/hw-list</a>
</pre>
</blockquote>
<p><br>
</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
HW-list mailing list - sponsored by <a class="moz-txt-link-abbreviated" href="http://www.HW.cz">www.HW.cz</a>
<a class="moz-txt-link-abbreviated" href="mailto:Hw-list@list.hw.cz">Hw-list@list.hw.cz</a>
<a class="moz-txt-link-freetext" href="http://list.hw.cz/mailman/listinfo/hw-list">http://list.hw.cz/mailman/listinfo/hw-list</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>