Shop OBEX P1 Docs P2 Docs Learn Events
Fastspin question re clkset in propeller.h — Parallax Forums

Fastspin question re clkset in propeller.h

I've a P1 PropGCC project which I'm converting to Fastspin 3.9.25 C . Easy enough except I'm unable to find the macro reference "clkset" in propeller.h or indeed anywhere in the whole directory structure after grepping all files inthe tree. c.md references it as below:
### P1 Clock Frequency

In C code, the P1 clock frequency defaults to 80 MHz, assuming a 5 MHz crystal and `xtal1 + pll16x` clock mode. This is a common configuration. You may override it with the `clkset` macro from `<propeller.h>`, which works the same as the Spin `clkset` function.
What or where am I missing?
Eric, your work is genius - thank you.

Comments

  • clkset is a built in function in fastspin, so the documentation referring to it as a "macro" is somewhat misleading. Sorry about that.

    I'm not sure that clkset has ever worked correctly on P1. Does your P1 project use it?
  • ersmith wrote: »
    clkset is a built in function in fastspin, so the documentation referring to it as a "macro" is somewhat misleading. Sorry about that.

    I'm not sure that clkset has ever worked correctly on P1. Does your P1 project use it?

    It does; I was using it for one style board that used a 6.25 mHz crystal but have since moved on to using the Flip which is 5x16 so we're good there. The remaining use I had for clkset was to reboot the Prop. The project is a bullet speed chronograph and uses a PiZeroW and a Prop to communicate to a PC app via wifi as the chrono and sensors itself can be 50 or 100 yards away. I never really had the need to reboot, the Prop is just a very reliable, very accurate realtime beast. I've switched to Fastspin due to anticipating using P2 for a much enhanced version using a microphone array to detect target strike localization. Re the clkset, it's a "want" not a need, if you weren't planning on implementing it don't worry about for now. I'll give the builtin a shot (no pun intended) and if I have any difficulty the inline PASM would be super easy to implement in my code. Thanks for answering, I'll look at the fastspin source and see what's there. I'll report back in this thread.

    Best regards, Mike R.
  • Sorry to waste your time - I should have looked in the source. In my code I'm using "#define reboot() clkset(0x80, 0);" and that works just fine. Thanks again.

    Mike R.
  • My gosh, you weren't wasting anybody's time, it was a good question. clkset on P1 is a little rusty, I haven't really tested it there as much as I should. I'm glad you were able to get it working, and thanks for your feedback!

    Cheers,
    Eric
  • evanhevanh Posts: 15,187
    It's cool to hear about the Prop making someone's coding life a little easier.
Sign In or Register to comment.