Schorschi
Posts: 244
Joined: Thu Nov 22, 2012 9:38 pm

Anyway to reset a dtoverlay driver other than reboot?

Mon Aug 10, 2020 6:41 am

I am using dtoverlay method to read data from a bme280 sensor. This works, but once in a while, randomly, after several hours, issues result. For example, today I could read temperature and pressure from the bme280 sensor, but trying to read relative humidity from the bme280 sensor stopped working, and would return a remote IO error. No matter what I tried once the first failed relative humidity occurs I could not read the humidity value again. But reading temperature and pressure continued to work. My python code to read the same bme280 sensor, works for months without issue. But the dtoverlay method, only works for hours before issues, like noted above. The only way to clear the issue is to reboot the hardware, i.e. Pi? Is this true, or is there some way I can get the dtoverlay to reload, reapply, or whatever, to reset the sensor, i2c bus, whatever to avoid a reboot?

User avatar
rpdom
Posts: 17696
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Anyway to reset a dtoverlay driver other than reboot?

Mon Aug 10, 2020 7:44 am

You could try removing the overlay and then adding it back in again using the dtoverlay command. I can't guarantee it will work though.

Code: Select all

rpdom@raspi12:~ $ dtoverlay -h
Usage:
  dtoverlay <overlay> [<param>=<val>...]
                           Add an overlay (with parameters)
  dtoverlay -D             Dry-run (prepare overlay, but don't apply -
                           save it as dry-run.dtbo)
  dtoverlay -r [<overlay>] Remove an overlay (by name, index or the last)
  dtoverlay -R [<overlay>] Remove from an overlay (by name, index or all)
  dtoverlay -l             List active overlays/params
  dtoverlay -a             List all overlays (marking the active)
  dtoverlay -h             Show this usage message
  dtoverlay -h <overlay>   Display help on an overlay
  dtoverlay -h <overlay> <param>..  Or its parameters
    where <overlay> is the name of an overlay or 'dtparam' for dtparams
Options applicable to most variants:
    -d <dir>        Specify an alternate location for the overlays
                    (defaults to /boot/overlays or /flash/overlays)
    -p <string>     Force a compatible string for the platform
    -v              Verbose operation

Adding or removing overlays and parameters requires root privileges.
Unreadable squiggle

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 9850
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Anyway to reset a dtoverlay driver other than reboot?

Mon Aug 10, 2020 9:21 am

rpdom wrote:
Mon Aug 10, 2020 7:44 am
You could try removing the overlay and then adding it back in again using the dtoverlay command. I can't guarantee it will work though.
Note that you can only unload an overlay that was loaded with the dtoverlay command, not dtoverlay=<foo> in config.txt.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

cleverca22
Posts: 1821
Joined: Sat Aug 18, 2012 2:33 pm

Re: Anyway to reset a dtoverlay driver other than reboot?

Mon Aug 10, 2020 9:25 am

you could check lsmod, find the driver for the bme280 sensor, then just unload with rmmod and reload with modprobe

Return to “Device Tree”