embedded - can I change "delay until" granularity on cortex-m4? -



embedded - can I change "delay until" granularity on cortex-m4? -

i'm scheduling loop "delay until" clause on stm32f4 discovery board, , when increment frequency, thing stop respecting time constraint. after digging, under impression it's scheduler granularity not task. 1 of signs when go slow time respected, , faster go, more bonkers go. tardiness seems discrete, falling on scheduling frequency limit.

here test code:

task body pwm onperiod : time_span; offperiod : time_span; period : time_span; next_start : time := clock; pwm_on : boolean := true; begin loop period := microseconds (1_000_000) / pwmfrequency; onperiod := period / 3; offperiod := 2 * period / 3; if (pwm_on) off (pattern (next_led)); pwm_on := false; next_start := next_start + offperiod; else on (pattern (next_led)); pwm_on := true; next_start := next_start + onperiod; end if; delay until next_start; end loop; end pwm;

i'm not showing oscilloscope traces, it's complicated, suffice higher frequency, less duty cycle close 33.3% (or stable).

after poking around in gnat distribution, found in s-bbbosu.adb:

-- utilize sys_tick timer periodic timer 1 khz rate. -- trade-off between accurate delays, limited overhead , maximum -- time interrupts may disabled. tick_period : constant timer_interval := clock_frequency / 1000;

(and connections in function called delay_until in s-bbtime.adb)

am forced utilize native mcu timer hand or there higher speed scheduling facility provided in system? i'm beginner in ada, reply might obvious.

you can utilize altered scheme library components placing altered file(s) in own code directory , rebuilding programme gnatmake -a (gprbuild doesn’t recognise switch on command line, though may possible include in gnat project file). warned, library file recompilations done switches require tight conformance gnat coding style (for example, compiler warnings treated errors, -werror c).

so say

tick_period : constant timer_interval := clock_frequency / 10_000;

you’ll undoubtedly need visit places tick_period used determine number of ticks wait given duration!

embedded ada stm32

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -