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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • 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
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • 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 Memory mapped I/O?
  • 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 Suggested Answer
  • Replies 15 replies
  • Answers 1 answer
  • Subscribers 676 subscribers
  • Views 2682 views
  • Users 0 members are here
  • raspberry_pi
Related

Memory mapped I/O?

michael.vos
michael.vos over 8 years ago

Does the compiler have memory mapped I/O - at least  byte wide?

  • Sign in to reply
  • Cancel
Parents
  • michaelkellett
    0 michaelkellett over 8 years ago

    I'm not a Pi expert but I'll try to help.

     

    The Pi hardware (in common with all similar processors) does not support memory mapped IO in the way that, for example, an ARM Cortex M part does.  This is because it is designed to work with DDRAM which is hard enough to get to work in the very special case of a processor or FPGA to memory interface - as far as I know no one uses the DDRAM interface for IO. The usual solution is to provide some additional IO ports which will require some kind of drivers to operate them - they are rarely mapped into normal memory space.

    The PI has very limited IO (Beagles are much better) but it is supported by lots of low cost IO expanded boards from many sources but they are all slow.

    To be fair the PI is not alone in having this problem - the best way to get data in and out of most computers at high speed is often to use Ethernet or PCI but both require serious hardware.

     

    It's this (hardware) limitation which allows small Cortex M class  micros to beat the ****** out of GHz application processors like that on the PI when it comes to low latency fast IO. And even with Gbit Ethernet, although you can get 100Mbytes/s in and out of the processor the round trip latency will be measured in us  - perhaps 100x slower than an STM32F4xx can bit bang IO !!!

     

    Roger is correct in implying that it isn't a compiler issue - you'll have the same problem with Python, C or anything else.

     

    What are you trying to do - there are (almost) always ways round these problems.

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gdstew
    0 gdstew over 8 years ago in reply to michaelkellett

    You're not a processor architecture expert either. The 8086 processor and some of its more modern variants had special instructions for I/O operations

    that separated them from memory space accesses using dedicated hardware I/O read/write signals (I assume that they still do, but for example the PCI bus

    is memory mapped !). ARM processors (and most other RISC processors) do not have these instructions and instead dedicate some of their memory

    space for I/O, this is what is known as memory-mapped I/O and accessing this "I/O space" uses the same instructions as normal memory reads and

    writes. When this I/O space is accessed it does not in any way affect DRAM because the memory address decoding of this I/O space prevents RAM

    access hardware signal pins from being activated.

     

    ARM SoCs use some of it's memory space for I/O registers built into the SoC to perform the various types of I/O supported by the chip. While in general

    these registers do use consecutive bits in each 32 bit word, unfortunately when they are connected to dedicated I/O pins on the SoC they do not always

    follow that bit order. Most of the time it is because some of the GPIO pins have multiple functions and when the "alternate" function (such as I2C, SPI, A/D, etc)

    is used it splits up the other I/O bits so that they are no longer 8 or 16 consecutive bits. Sometimes because of pin limitations they just don't run all of the bits

    to external pins. And just to make things worse, sometimes when laying out the PCB, it is just easier to route the SoC I/O pins to the PCB I/O when they are

    split up. This has always been a pet peeve to me for the reason that Michael Vos has stated, sometimes it would just be a whole lot better/easier to be able

    to do true byte-wide (or bigger !) accesses but it is physically impossible.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rew
    0 rew over 8 years ago in reply to gdstew

    Gary, one little addition: the PCI bus allows IO accesses that the '8086 family of processors support. Most expansion cards no longer use such old fashioned stuff, but the PCI bus supports it. A reason could be that the address space on IO accesses is only 64k.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • michaelkellett
    0 michaelkellett over 8 years ago in reply to gdstew

    Gary, when someone start a reply with an "I'm not an X expert but I'll try to help" any rational person interprets this as a genuine attempt to set the context for their answer.

     

    To respond with an " You're not a Y expert either ..." is quite simply rude and unhelpful. No, I'm not a processor architecture expert and I never claimed to be.

     

    My reply was, perhaps, a bit of an over simplification and I had assumed that the OP wished to connect an external non-memory device to the PI and have it appear in the PI memory space - something which is easily done with ARM Cortex M (and similar) parts with external memory buses but not feasible on most application processors.

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • michaelkellett
    0 michaelkellett over 8 years ago in reply to gdstew

    Gary, when someone start a reply with an "I'm not an X expert but I'll try to help" any rational person interprets this as a genuine attempt to set the context for their answer.

     

    To respond with an " You're not a Y expert either ..." is quite simply rude and unhelpful. No, I'm not a processor architecture expert and I never claimed to be.

     

    My reply was, perhaps, a bit of an over simplification and I had assumed that the OP wished to connect an external non-memory device to the PI and have it appear in the PI memory space - something which is easily done with ARM Cortex M (and similar) parts with external memory buses but not feasible on most application processors.

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • rew
    0 rew over 8 years ago in reply to michaelkellett

    Michael,

    I'm familiar with the "embedded" family of STM32 processors. On those, you need to go quite far up the ranks of processors before they start having enough pins that ST decided to implement the external memory bus.

     

    Similarly, MOST application processors have an external memory bus. Simply because integrating 1Gb of memory onto one or two chips is best left to the companies specializing in memory chips. That said... the DRAM bus is special and will you be able to access other stuff? The answer is usually yes. Those external busses often need to interface to NAND flash, SD cards (or EMMC) and stuff like that.

     

    The one exception that I'm aware of is the BCM2835. Because it has the memory bus broken out on the TOP of the chip for the stacked memory arrangement, that's one of the few "application processor" chips that doesn't have an external memory bus.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • michaelkellett
    0 michaelkellett over 8 years ago in reply to rew

    This thread will be hard to follow - my previous comment was responding to your long post re. io control on the PI.

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • 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