element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Generating clk synchronized signal without using typical serial communication protocol (SPI, UART etc)
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 13 replies
  • Subscribers 663 subscribers
  • Views 3206 views
  • Users 0 members are here
Related

Generating clk synchronized signal without using typical serial communication protocol (SPI, UART etc)

lolants55
lolants55 over 3 years ago

Hello i have problem with generating clk synchronized signal.


I am using Raspberry 4 and Python , trying to make 8MHz clk and the synchronized signal(24bit every cycle) with it.
I need to generate 24bits every rising rising edge of 8MHz clk. Like 0101 1001 0000 0000 0010 0000(24 zeros and ones) should be generated every rising edge of 8MHz clk. Every commends on the manual have different configuration of 0 and 1, so i was trying to make function that can determine 0 or 1 every rising edge so that it can express all commends.

I made a clk with pigpio library's " hardware_clock(gpio, clkfreq) " function and used "event_callback(event, func)", i referred "">abyz.me.uk/.../python.html" to use it , to detect the rising edge and call function sending a bit every event(when rising edge is detected). But i found it doesn't work since its operation time was too low compare to clk period. So i tried to use interrupt function of raspberry itself but again found it is slow to use again. Is there any way that i can generate MHz order scale signal using raspberry 4 and python?

So what i want to know since the receiver operates when 8MHz clk and signal are received and synchronized well each other, i want make raspberry operates a function(this would be something like one bit generating) at least 10^-7 second(~ 8MHz) a once.

If needed i may use C language instead, but i am not familiar with it. If it is possible i prefer to use python.

p.s
I found functions from RPIgpio and pigpio aren't compatible(I tried to use clk function from pigpio and eventcallback function from rpigipio). Is this because they occupy same registers in raspberry 4(since they have similar function.. ig)? So that they may malfunction while they are used at once.

Thanks for your helps in advance.
Thanks for reading!

  • Sign in to reply
  • Cancel
Parents
  • shabaz
    0 shabaz over 3 years ago

    Hi, 

    Regarding your comment:

    using raspberry 4 and python

    You're requesting about two orders of magnitude better performance than is realistic if you wish to operate at such rates that you mention.

    With C, you're still one order of magnitude away, if you wish to do this in user-space code (i.e. using libraries like RPIgpio etc).

    You'd likely need to do this at driver level, which has a learning curve. There are not many good books on it, you'd need to do some research online (or try to find a good book if you're lucky, please leave a recommendation here!) to learn how to do that.

    Another option is to dispense with Linux and go with bare-metal code, but then you're losing access to all of the Linux functionality. Yet another option is to do this with different hardware (FPGA or microcontroller) and connect to the Pi as required.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • lolants55
    0 lolants55 over 3 years ago in reply to shabaz

    Thanks for your courteous reply.

    I didn't know that MHz scale signal is impossible to make, since it is low compare to fundamental clk of raspberry.

    Since i know the problem, maybe I should try another one.

    I found that SPI can be used to make MHz signal. How do you think about using SPI instead? 

    Thank you for your advice :)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • lolants55
    0 lolants55 over 3 years ago in reply to shabaz

    Thanks for your courteous reply.

    I didn't know that MHz scale signal is impossible to make, since it is low compare to fundamental clk of raspberry.

    Since i know the problem, maybe I should try another one.

    I found that SPI can be used to make MHz signal. How do you think about using SPI instead? 

    Thank you for your advice :)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube