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 RPi 3 B+ with Sense Hat getting "Error: cannot open framebuffer device." from snake.c example
  • 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 16 replies
  • Subscribers 663 subscribers
  • Views 3804 views
  • Users 0 members are here
  • sense hat
  • frame_buffer
  • raspberry_pi_3b+
Related

RPi 3 B+ with Sense Hat getting "Error: cannot open framebuffer device." from snake.c example

osenjw
osenjw over 5 years ago

I am new to RPi.

 

I placed the sense hat on an RPi 3B+ and get a nice rainbow display on the LED.

 

When I run the snake example, I get the message "Error: cannot open framebuffer device."

 

I run in debug using Code::Blocks, and I see that the code apparently finds the joystick.  So the frame buffer is not the first thing I checked.

 

My RPi is nearly virgin.  I have installed Code::Blocks and the sense hat.  Raspian is up to date.  I enabled VNC, SSN, SPI and I2C.

 

I am working headless via a VNC window in W10.

 

Is there an incompatibility between a RPi 3B+ and the sense hat?  I am seeing that it is compatible with RPi 3B  (no +).

 

If not, would somebody offer a suggestion for getting snake to get past this error?

 

Thanks.

  • Sign in to reply
  • Cancel
  • osenjw
    osenjw over 5 years ago

    I just tried a python script and found the following:

     

    Traceback (most recent call last):

      File "space_invader.py", line 4, in <module>

        sense = SenseHat()

      File "/usr/lib/python2.7/dist-packages/sense_hat/sense_hat.py", line 39, in __init__

        raise OSError('Cannot detect %s device' % self.SENSE_HAT_FB_NAME)

    OSError: Cannot detect RPi-Sense FB device

     

    This is rather cryptic, but I am guessing that the frame buffer was not found.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mp2100
    mp2100 over 5 years ago

    Can you try to use the Sense Hat with a computer monitor attached to the RPi, that is, don’t run it headless?  I would have thought that VNC would provide a framebuffer, but it’s perhaps it doesn’t.

     

    There should not be any incompatibility with the RPi 3B+ Model, the Sense Hat is only using the 40 pin header, and that did not change between models.  Raspbian is quite stable between versions.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • osenjw
    osenjw over 5 years ago in reply to mp2100

    Thanks for the response.

     

    I have returned to running with a display attached through the HDMI, VNC off, keyboard + mouse attached, reboot and also shutdown + cold start.

     

    No change in behavior.

     

    Running a couple of the other python examples fail in the same manner.  The humidity sensor example fails when instantiating a sense hat, complaining about the frame buffer.

     

    Is there something I need to set in a boot time file?  I would be surprised, because such a requirement is not mentioned in a half dozen threads.

     

    I see nothing in RPi preferences.

     

    Thanks for any time you can think on this.

     

    This is truly a near clean system.  I just reset my SD card and started a clean slate yesterday, before adding the sense hat package.  As I recall the only other package I added was Code::Blocks.  I cannot imagine how a IDE would change the interface to the sense hat.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • osenjw
    osenjw over 5 years ago in reply to mp2100

    I just found a thread.  Its conclusion for the user was that the sense hat was bad.  A second one fixed the problem.

     

    https://raspberrypi.stackexchange.com/questions/88213/rpi-not-reading-data-from-sense-hat-due-to-missing-frame-buffer

     

    My sense hat is just out of the box.

     

    In that thread, the question was raised multiple times, "Do you have more than one frame buffer?  I.e., /dev/fb0 and /dev/fb1?"

     

    I only have /dev/fb0.

     

    How do I get a /dev/fb1 for the sense hat?  What part of installation would have done that? 

     

    I will try to install sense hat with a monitor attached.  I believe I installed headless.  But if there is another suggestion, please, give it!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • osenjw
    osenjw over 5 years ago in reply to mp2100

    I tried removing sense hat, then reinstalling with a head on.  No change.

    I then just tried copying /dev/fb0 to /dev/fb1.  fb0 has 0 bytes in size.  So I suspect it is a abstraction only.

     

    I am not quite sure if this leaves me to conclude my sense hat was bad out of the box.  As I have been responsible for end of line tests of controllers, this is a rare issue.  I usually do not have this bad luck.

     

    Is there any other test to exercise the sense hat at a lower level?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • osenjw
    osenjw over 5 years ago

    On another thread I find that this is somehow helpful in determining whether the sense hat is fully functional:

     

    pi@raspberrypi:~ $ i2cdetect -y 1

         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

    00:          -- -- -- -- -- -- -- -- -- -- -- -- --

    10: -- -- -- -- -- -- -- -- -- -- -- -- 1c -- -- --

    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    40: -- -- -- -- -- -- 46 -- -- -- -- -- -- -- -- --

    50: -- -- -- -- -- -- -- -- -- -- -- -- 5c -- -- 5f

    60: -- -- -- -- -- -- -- -- -- -- 6a -- -- -- -- --

    70: -- -- -- -- -- -- -- --     

     

    I would expect the i2c address is something like left column header | row header.  So the 1C is found at address 0x1c.

     

    I found this:

    • 0x5c: LPS25H
    • 0x1c: LSM9DS1
    • 0x5f: HTS221HTS221
    • 0x46: LED2472G - am I to guess this means the LED array is responding?  The thread I found does not have
    • 0x6a: LSM9DS1

     

    This is the second thread where one of the final responses was "return the sense hat, get another".  One thread had no conclusion, another had "new hat, success" as a conclusion.

     

    As I am evaluating the RPi for instruction, I am chilled at how much work and web browsing I am having to do to get an out of box component working.  I would hate for a student to go through this much.  It would probably trigger the student to walk away from embedded programming.

     

    I am thinking an STM discovery kit would be more fool proof and have better support.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 5 years ago

    Hi John,

     

    Just to confirm, the Sense HAT was placed on the Pi unpowered, right? I doubt the framebuffer appears except at boot time.

    Since i2cdetect seems to be providing the correct type of info, it is likely that the Sense HAT works (but as mentioned, the framebuffer may not appear without a reboot).

    There could be a software issue too - perhaps it is looking for a particular enumeration, and using VNC may be confusing it.

    You could try the following combinations:

    1. Using a HDMI monitor and the Sense HAT

    2. Using the Sense HAT but no HDMI monitor, and no VNC either (i.e. just using SSH).

    The Pi is just a Linux computer - there should be some training material on the Pi website which may make some assumptions (e.g. locally attached HDMI monitor)

    If you're going to create your own procedures, then you have to test it out thoroughly beforehand - the same applies with any STM discovery board too I imagine.

     

    By the way, if this is for students to learn embedded programming, you may need to have someone experienced in troubleshooting nearby, because the engineering-minded/curious students will likely do stuff on their own enterprise, so you'll need to be prepared for that, if they get stuck - that's just the way engineering-minded students are.

     

    EDIT: Reading some more of the posts above, it seems you have rebooted and tried a HDMI monitor. Just to confirm, you're using the 'official' PSU, right? The sense HAT may consume a fair amount of power for the LEDs.

    I have a Sense HAT somewhere so I will try to replicate it if I can find it..

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 5 years ago

    Hi John,

     

    I plugged in a Sense HAT into a Pi 3B (I don't have a model 3B+ handy), and then powered up the Pi.

    What happens at boot-up, is that the LEDs light up in a spectrum, illuminated for 3-4 seconds, and then the LEDs extinguish.

    I had no HDMI monitor connected, and am not using VNC. I connected to the Pi using SSH.

    I see this:

    image

    If you're not getting that far, then if you're sure that you're on a recent version of Raspbian, and you're using the correct PSU (there's a difference between the official PSU, and mobile phone chargers, even if the current rating is the same or higher), then unfortunately there is a possibility your Sense HAT is faulty. I'm surprised though. There's not a lot to go wrong with the Sense HAT.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • osenjw
    osenjw over 5 years ago in reply to shabaz

    Thanks for the reply.  I have tried just SSH with PuTTY, same results.

     

    I am not using an official RPi PSU.  It is a third party (Micro Connectors) device 2500mA output, designated for the RPi.

     

    I tried a USB power bank I can charge my tablet with.  No change.  It puts out 2.4A.

     

    Is there anyway I can tell if the Atmel MCU is responsive?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • osenjw
    osenjw over 5 years ago in reply to shabaz

    And I do not have fb1.  How is fb1 created?

    • Cancel
    • Vote Up 0 Vote Down
    • 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