Hi Dennis!

Thank you very  much!   Your comments are spot on and tell me where to look!
I hadn't used 'volatile' and that certainly messed things up :)   Thank you
again for
your quick response and great help..
Have a great week.

Bill

On Sat, Dec 1, 2018 at 6:21 PM Dennis Lee Bieber <[email protected]>
wrote:

> On Sat, 1 Dec 2018 12:33:25 -0800 (PST), Bill Bitner
> <[email protected]> declaimed the following:
>
> >PruCookbook set up.   I found that using
> >the -O 2 flag for clpru, the compiler would *delete* certain looping
> code.
> > Removing the flag would run the code
> >properly.   It took a while to figure out what was happening since I'm
> not
>
>         Try declaring some of the loop controlling variables "volatile" --
> that
> should tell the compiler that they can change state /external/ to the
> actions of the loop itself.
>
> >
> >while (1)
> >        {
> >
> >            runState = pru0Dram[0];
>
> for example, pru0Dram
>
> >            if (runState == 0)
> >            {
> >                __R30 &= ~gpio;         // Set the GPIO pin to 0, this
> >should be a 10 us pulse
> >                continue;
>
> just as a style -- I'd probably drop the "continue" and code the rest as an
> "else" block
> >            }
> >
> >            onTime  = pru0Dram[1];
> >
> >            __R30 |= gpio;
> > >>>           while(1)
> >            {
> >                if (counter > onTime)
>
> I don't see any code initializing "counter" -- did you snip some
> intervening code? And again, if not volatile, the compiler may be assuming
> pru0Dram initializes as 0, and also assumes it never changes, so any
> non-zero value of counter will set R30 and exit the loop -- that comes down
> to one loop pass doing nothing but incrementing counter, and the second
> loop pass sets R30/exits.
>
>
> >                {
> >                    __R30 &= ~gpio;         // Set the GPIO pin to 0,
> this
> >should be a 10 us pulse
> >                    break;
> >                }
> >                counter += 1;
> >            }
> >
>
>
> --
>         Wulfraed                 Dennis Lee Bieber         AF6VN
>         [email protected]    HTTP://wlfraed.home.netcom.com/
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/fd860e1a5r49nvengb6gbbv2b3d88vlhlb%404ax.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAOYP4divAJG52KZei40GGtuA1RMRpqAoYCJ6T0mtuS51casXhg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to