hi, the size of tick is CONFIGURE_MICROSECONDS_PER_TICK ? On Sat, Jul 6, 2019 at 12:22 AM Gedare Bloom <ged...@rtems.org> wrote:
> On Thu, Jul 4, 2019 at 2:45 AM Jython <googch...@gmail.com> wrote: > > > > is there someone could help me > > > I can give you some guesses. > > > On Sun, Jun 30, 2019 at 2:36 PM Jython <googch...@gmail.com> wrote: > >> > >> a 21ms counter in fact more than 10s, see log , my rtc 10s wake up > >> > >> static void Delay_ms(x) > >> { > >> #if 0 > ... // delete noise > >> #endif > >> volatile int i; > >> int us_cnt = 1000*x; > From what you said, probably x=21, and us_cnt = 21000 > > >> printf("delay x %dms us_cnt %d\n", x, us_cnt); > >> for(i = 0; i < us_cnt; i++) > >> rtems_counter_delay_nanoseconds(1000); > You make 21000 calls to this function with 1000ns (1 us) per call. You > should debug what is happening during a call to > rtems_counter_delay_nanoseconds(1000). > > Some things to be aware of. The function does not disable interrupts > or task switches, so if you have other tasks/interrupts, they may be > scheduled and cause your delay to be even longer than you anticipate. > > I would check what is the granularity of your processor ability to > tell time. That is, what is the size of a "tick". This function will > convert the nanosecond argument to some number of ticks, and then > delay at least that many ticks. One possibility is that your tick is > around 500 microseconds, so each call you make is really becoming > rtems_counter_delay_ticks(1) == > rtems_counter_delay_nanoseconds(500000). Thus, delay about .0005 > seconds per call * 21000 calls = 10.5 seconds. > > >> > >> printf("end delay\n"); > >> } > >> > >> > >> [14:33:18.242]ÊÕ¡û¡ôflash_buf 32 00 00 00 > >> write page index 50 > >> log_page_no = 50 > >> before while > >> loop begin > >> dtr set 0 > >> baud 9600 at UART1_ChangeBaud > >> USART_WordLength_8b > >> USART_StopBits_1 > >> delay x 21ms us_cnt 21000 > >> > >> [14:33:21.055]ÊÕ¡û¡ôafter clr isr 00000033 > >> > >> [14:33:31.056]ÊÕ¡û¡ôafter clr isr 00000033 > >> > >> [14:33:32.759]ÊÕ¡û¡ôend delay > >> Lenggui_ClrBuffer begin okflag 0 > >> > >> > >> > > _______________________________________________ > > users mailing list > > users@rtems.org > > http://lists.rtems.org/mailman/listinfo/users >
_______________________________________________ users mailing list users@rtems.org http://lists.rtems.org/mailman/listinfo/users