element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 Process of developing a kernel module for Pi
  • 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
  • Replies 0 replies
  • Subscribers 662 subscribers
  • Views 202 views
  • Users 0 members are here
  • raspberry_pi
  • rpi
  • kernel
  • adafruit
  • linux
Related

Process of developing a kernel module for Pi

fustini
fustini over 12 years ago

Part of the weekly Friday blast of Raspberry Pi posts on the Adafruit blog, they highlighted a series of posts by Sean Cross who developed a PWM kernel module for the Pi:

 

How Sean gets ready for RPi k-deving, Poking at /dev/mem – hacking without a net & more…

How Sean gets ready for RPi k-deving & How Sean started the skeleton of the hardware PWM kernel module. But wait, there’s more! Poking at /dev/mem – hacking without a net! Before writing up the PWM kernel module, Sean wanted to spend some user-space time prodding the registers for PWM. The fastest way to do this is to simply open up /dev/mem and index to the PWM control registers. This isn’t for the faint-of-heart, as a little incorrect math and you can possibly bork your Pi installation but it is as fast & furious as it gets with embedded Linux.

 

Here's a brief snippet from each of his posts:

 

Setting Up The Environment

 

Getting new hardware is always an exciting time. When dealing with old, familiar hardware, it's possible to become complacent. When a problem arises, the solution is simple, obvious, and requires no intake of new knowledge. At worst you know exactly where to find the answer in the manual or source file. But new hardware is great. It's a trip back to ignorance.

 

Pwm Driver Part 1: Housekeeping

 

The Raspberry Pi has a single PWM port, but in order to drive it you need to directly map register memory and talk directly to several different subsystems, each of which has a confusing chapter in the manual (if it's documented at all) in order to get it to work. Let's see if we can create a kernel driver to make life simpler

 

Pwm Driver Part 2: Research

 

Now that we have the basis for working in the kernel, we need to figure out what it is we want to do exactly. Fortunately it's possible to prototype this code in userspace and really get a feel for how the PWM block behaves before moving it into the kernel

 

 

Cheers,

Drew

  • Sign in to reply
  • Cancel
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