weewx 3.0.1 on Raspberry Pi B current firmware with FineOffset ... frequent usb lock ups

337 views
Skip to first unread message

bh...@darkrealm.net

unread,
Dec 30, 2014, 5:32:36 PM12/30/14
to weewx...@googlegroups.com
Hi guys,

For quite some time I had been running weewx version 2.3.6 with my FineOffset weather station..  I have a USB hub with PPPS and had added a small cludge in wxengine.py to power cycle the base station whenever the USB locked up, and it did this when needed, sometimes it would go 10 or more days without a reset.  I have just in the last few days upgraded everything, Pi firmware, apt-get upgrade etc ... And upgraded weewx.  I read through the change log and found that weewx had built in support now to switch the PPPS usb hub, so I configured it for that..  Didn't work..  Everything runs until suddenly I get spurious records that do not trigger weewx to reset the USB port though. I have the following in my /etc/weewx/weewx.conf:

[FineOffsetUSB]
    # This section is for the Fine Offset series of weather stations.
    
    # The station model, e.g., WH1080, WS1090, WS2080, WH3081
    model = WH1080
    
    # The polling mode can be PERIODIC or ADAPTIVE
    polling_mode = ADAPTIVE
    
    # How often to poll the station for data, in seconds
    polling_interval = 60
    
    # The pressure calibration offset, in hPa (millibars)
    pressure_offset = 0
    
    # The driver to use
    driver = weewx.drivers.fousb
    station_interval = 60
    power_cycle_hub = 001:005
    power_cycle_port = 1

I don't have debug mode turned on at this point, but will for the next time it happens, but here is the log of whats happening as far as I have seen it as you will see weewx is crashing without even issuing traceback output the first time around and it's restarted by my restart script I use:

Dec 31 07:31:33 weather weewx[3165]: fousb: unstable read: blocks differ for ptr 0x000000
Dec 31 07:31:33 weather weewx[3165]: fousb: unrecognised magic number 1000
Dec 31 07:31:33 weather weewx[3165]: fousb: magic number changed old=55aa new=1000
Dec 31 07:31:33 weather weewx[3165]: fousb: unstable read: blocks differ for ptr 0x001860
Dec 31 07:31:33 weather weewx[3165]: fousb: ignoring spurious rain counter decrement (0x1870): new: 9.48 old: 35.91
Dec 31 07:31:33 weather weewx[3165]: fousb: station status {'unknown': 1, 'lost_connection': 64, 'rain_overflow': 0} (65)
Dec 31 07:31:33 weather weewx[3165]: engine: ignoring windDir value of 1507.5, limits are (0.0, 359.0)
Dec 31 07:31:33 weather weewx[3165]: engine: ignoring outTemp value of 247.46, limits are (0.0, 122.0)
Dec 31 07:31:33 weather weewx[3165]: engine: ignoring windGustDir value of 1507.5, limits are (0.0, 359.0)
Dec 31 07:32:01 weather /USR/SBIN/CRON[4330]: (root) CMD (/usr/sbin/weewxrestart > /dev/null 2>&1)
Dec 31 07:32:03 weather weewx[4342]: engine: Initializing weewx version 3.0.1
Dec 31 07:32:03 weather weewx[4342]: engine: Using Python 2.7.3 (default, Mar 18 2014, 05:13:23) #012[GCC 4.6.3]
Dec 31 07:32:03 weather weewx[4342]: engine: pid file is /var/run/weewx.pid
Dec 31 07:32:03 weather weewx[4344]: engine: Using configuration file /etc/weewx/weewx.conf
Dec 31 07:32:03 weather weewx[4344]: engine: Loading station type FineOffsetUSB (weewx.drivers.fousb)
Dec 31 07:32:03 weather weewx[4344]: fousb: driver version is 1.7
Dec 31 07:32:03 weather weewx[4344]: fousb: power cycling enabled for port 1 on hub 001:005
Dec 31 07:32:03 weather weewx[4344]: fousb: polling mode is ADAPTIVE
Dec 31 07:32:03 weather weewx[4344]: fousb: found station on USB bus=001 device=015
Dec 31 07:32:03 weather weewx[4344]: engine: StdConvert target unit is 0x1
Dec 31 07:32:03 weather weewx[4344]: engine: Archive will use data binding wx_binding
Dec 31 07:32:03 weather weewx[4344]: engine: Record generation will be attempted in 'hardware'
Dec 31 07:32:04 weather weewx[4344]: fousb: unstable read: blocks differ for ptr 0x000000
Dec 31 07:32:04 weather weewx[4344]: fousb: unstable read: blocks differ for ptr 0x000020
Dec 31 07:32:04 weather weewx[4344]: fousb: unstable read: blocks differ for ptr 0x000040
Dec 31 07:32:04 weather weewx[4344]: fousb: unstable read: blocks differ for ptr 0x000060
Dec 31 07:32:05 weather weewx[4344]: fousb: unstable read: blocks differ for ptr 0x000080
Dec 31 07:32:05 weather weewx[4344]: fousb: unstable read: blocks differ for ptr 0x0000a0
Dec 31 07:32:05 weather weewx[4344]: fousb: unstable read: blocks differ for ptr 0x0000c0
Dec 31 07:32:05 weather weewx[4344]: fousb: unstable read: blocks differ for ptr 0x0000e0
Dec 31 07:32:05 weather weewx[4344]: fousb: unrecognised magic number 1000
Dec 31 07:32:05 weather weewx[4344]: engine: Caught unrecoverable exception in engine:
Dec 31 07:32:05 weather weewx[4344]:     ****  unsupported operand type(s) for *: 'NoneType' and 'int'
Dec 31 07:32:05 weather weewx[4344]:     ****  Traceback (most recent call last):
Dec 31 07:32:05 weather weewx[4344]:     ****    File "/usr/share/weewx/weewx/engine.py", line 834, in main
Dec 31 07:32:05 weather weewx[4344]:     ****      engine = EngineClass(config_dict)
Dec 31 07:32:05 weather weewx[4344]:     ****    File "/usr/share/weewx/weewx/engine.py", line 74, in __init__
Dec 31 07:32:05 weather weewx[4344]:     ****      self.loadServices(config_dict)
Dec 31 07:32:05 weather weewx[4344]:     ****    File "/usr/share/weewx/weewx/engine.py", line 140, in loadServices
Dec 31 07:32:05 weather weewx[4344]:     ****      self.service_obj.append(weeutil.weeutil._get_object(svc)(self, config_dict))
Dec 31 07:32:05 weather weewx[4344]:     ****    File "/usr/share/weewx/weewx/engine.py", line 483, in __init__
Dec 31 07:32:05 weather weewx[4344]:     ****      if software_interval != self.engine.console.archive_interval:
Dec 31 07:32:05 weather weewx[4344]:     ****    File "/usr/share/weewx/weewx/drivers/fousb.py", line 1003, in archive_interval
Dec 31 07:32:05 weather weewx[4344]:     ****      return self._archive_interval_minutes() * 60
Dec 31 07:32:05 weather weewx[4344]:     ****  TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
Dec 31 07:32:05 weather weewx[4344]:     ****  Exiting.

Hope this helps...  Thanks in advance for any suggestions..

Regards,
Cameron

mwall

unread,
Jan 1, 2015, 1:30:24 PM1/1/15
to weewx...@googlegroups.com
the usb communication is failing before weewx can even get the archive interval from the station.

power cycle the station.  be sure that your batteries are fresh.  if you are powering the console only via usb, be sure that the usb hub provides sufficient power.

also, you should not use ADAPTIVE mode - that will increase greatly the chance of a usb lockup.  use PERIODIC instead.

m

bh...@darkrealm.net

unread,
Jan 2, 2015, 1:19:03 AM1/2/15
to weewx...@googlegroups.com
Hi mwall,

It's powered just by USB specifically so the USB hub can power cycle it, and unless something in  the hub has died at the exact same time I upgraded the Pi firmware then yeah, something fishy...  I am pretty sure I switched from PERIODIC to ADAPTIVE back in the earlier versions because ADAPTIVE was meant to be nicer to the USB bus etc...  Or maybe at the time I changed, found it worse on PERIODIC and switched back?  Cannot remember, that was a couple of years ago...  I have tossed in another os.system call to the usb power switching program I have always used at the error message it failed at, hopefully that will clear things up...  Funnily enough it hasn't locked up since I started this thread :/  I am going to stop using the base station pretty soon, I have a 433MHz receiver which I will soon attach to the Pi and do things that way...  Thanks m for getting back to me with your suggestion!  I shall change to PERIODIC and see how that goes :)

bh...@darkrealm.net

unread,
Jan 2, 2015, 1:45:35 AM1/2/15
to weewx...@googlegroups.com
Also just remembered, I am getting spurious readings, seems to almost be at the same time of day, will look at that tomorrow, which is something I never had before...  Really wishing I didn't do a firmware upgrade now....  At least I would have a better idea what was going wrong...


On Friday, January 2, 2015 4:30:24 AM UTC+10, mwall wrote:

Cancunia

unread,
Jan 20, 2015, 6:28:29 AM1/20/15
to weewx...@googlegroups.com
After burning a few SD cards on my B+, I've switched to a USB hard drive and started to notice similar problems to those listed in this thread below.

Namely: "TypeError: unsupported operand type(s) for *: 'NoneType' and 'int"

I invariably get the problem after powerup  but I've discovered that rebooting sorts the problem out, latest occurance took 2 reboots after I moved from ethernet cable to USB wifi. I now have  fully populated USB ports on the B+ so I suppose it's not too surprising that I get some conflicts.   It may well be the Fine Offset that causes the problem, but I have 3 other devices on USB that work fine so thought it best to note it. I thought that I'd mention this as there was a comment in another thread about the Fine Offest USB driver being re-written.

Andrew Milner

unread,
Jan 20, 2015, 6:41:40 AM1/20/15
to weewx...@googlegroups.com
can you post the actual log of the error to help identify the cause?  Are you using nick's gauges by any chance - there used to be errors in the gauges when things like windspeed or wind direction were None - the condition was not handled correctly.

Cancunia

unread,
Jan 20, 2015, 7:02:48 AM1/20/15
to weewx...@googlegroups.com
Sorry, I'm not sure how / if you can post code blocks here so I've listed the Weewx startup lines from syslog. For me the problem only exists at powerup, rebooting normally clears it:

Jan 20 11:14:04 BPLuss weewx[2333]: engine: Initializing weewx version 3.0.1
Jan 20 11:14:04 BPLuss weewx[2333]: engine: Using Python 2.7.3 (default, Mar 18 2014, 05:13:23) #012[GCC 4.6.3]
Jan 20 11:14:04 BPLuss weewx[2333]: engine: pid file is /var/run/weewx.pid
Jan 20 11:14:05 BPLuss weewx[2354]: engine: Using configuration file /etc/weewx/weewx.conf
Jan 20 11:14:05 BPLuss weewx[2354]: engine: Loading station type FineOffsetUSB (weewx.drivers.fousb)
Jan 20 11:14:05 BPLuss weewx[2354]: fousb: driver version is 1.7
Jan 20 11:14:05 BPLuss weewx[2354]: fousb: polling mode is PERIODIC
Jan 20 11:14:05 BPLuss weewx[2354]: fousb: polling interval is 60
Jan 20 11:14:05 BPLuss weewx[2354]: fousb: found station on USB bus=001 device=006
Jan 20 11:14:05 BPLuss weewx[2354]: engine: StdConvert target unit is 0x1
Jan 20 11:14:05 BPLuss weewx[2354]: engine: Archive will use data binding wx_binding
Jan 20 11:14:05 BPLuss weewx[2354]: engine: Record generation will be attempted in 'hardware'
Jan 20 11:14:06 BPLuss weewx[2354]: engine: The archive interval in the configuration file (300) does not match the station hardware interval (60).
Jan 20 11:14:06 BPLuss weewx[2354]: engine: Using archive interval of 60 seconds
Jan 20 11:14:06 BPLuss weewx[2354]: engine: Using binding 'wx_binding' to database '/var/lib/weewx/weewx.sdb'
Jan 20 11:14:06 BPLuss weewx[2354]: engine: Starting backfill of daily summaries
Jan 20 11:14:06 BPLuss weewx[2354]: engine: Daily summaries up to date.
Jan 20 11:14:07 BPLuss weewx[2354]: restx: Wunderground-PWS: Data for station ITATHWEL2 will be posted
Jan 20 11:14:07 BPLuss weewx[2354]: engine: Starting up weewx version 3.0.1
Jan 20 11:14:31 BPLuss weewx[2354]: fousb: get_records failed: Connection timed out
Jan 20 11:15:02 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x000000
Jan 20 11:15:02 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x000020
Jan 20 11:15:02 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x000040
Jan 20 11:15:02 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x000060
Jan 20 11:15:02 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x000080
Jan 20 11:15:02 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x0000a0
Jan 20 11:15:03 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x0000c0
Jan 20 11:15:03 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x0000e0
Jan 20 11:15:03 BPLuss weewx[2354]: fousb: unrecognised magic number 8100
Jan 20 11:15:03 BPLuss weewx[2354]: fousb: magic number changed old=55aa new=8100
Jan 20 11:15:03 BPLuss weewx[2354]: engine: Caught WeeWxIOError: invalid read_period in get_records
Jan 20 11:15:03 BPLuss weewx[2354]:     ****  Waiting 60 seconds then retrying...
Jan 20 11:16:03 BPLuss weewx[2354]: engine: retrying...
Jan 20 11:16:03 BPLuss weewx[2354]: engine: Using configuration file /etc/weewx/weewx.conf
Jan 20 11:16:03 BPLuss weewx[2354]: engine: Loading station type FineOffsetUSB (weewx.drivers.fousb)
Jan 20 11:16:03 BPLuss weewx[2354]: fousb: driver version is 1.7
Jan 20 11:16:03 BPLuss weewx[2354]: fousb: polling mode is PERIODIC
Jan 20 11:16:03 BPLuss weewx[2354]: fousb: polling interval is 60
Jan 20 11:16:03 BPLuss weewx[2354]: fousb: found station on USB bus=001 device=006
Jan 20 11:16:03 BPLuss weewx[2354]: engine: StdConvert target unit is 0x1
Jan 20 11:16:03 BPLuss weewx[2354]: engine: Archive will use data binding wx_binding
Jan 20 11:16:03 BPLuss weewx[2354]: engine: Record generation will be attempted in 'hardware'
Jan 20 11:16:03 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x000000
Jan 20 11:16:03 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x000020
Jan 20 11:16:03 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x000040
Jan 20 11:16:03 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x000060
Jan 20 11:16:03 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x000080
Jan 20 11:16:04 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x0000a0
Jan 20 11:16:04 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x0000c0
Jan 20 11:16:04 BPLuss weewx[2354]: fousb: unstable read: blocks differ for ptr 0x0000e0
Jan 20 11:16:04 BPLuss weewx[2354]: fousb: unrecognised magic number 8100
Jan 20 11:16:04 BPLuss weewx[2354]: engine: Caught unrecoverable exception in engine:
Jan 20 11:16:04 BPLuss weewx[2354]:     ****  unsupported operand type(s) for *: 'NoneType' and 'int'
Jan 20 11:16:04 BPLuss weewx[2354]:     ****  Traceback (most recent call last):
Jan 20 11:16:04 BPLuss weewx[2354]:     ****    File "/usr/share/weewx/weewx/engine.py", line 834, in main
Jan 20 11:16:04 BPLuss weewx[2354]:     ****      engine = EngineClass(config_dict)
Jan 20 11:16:04 BPLuss weewx[2354]:     ****    File "/usr/share/weewx/weewx/engine.py", line 74, in __init__
Jan 20 11:16:04 BPLuss weewx[2354]:     ****      self.loadServices(config_dict)
Jan 20 11:16:04 BPLuss weewx[2354]:     ****    File "/usr/share/weewx/weewx/engine.py", line 140, in loadServices
Jan 20 11:16:04 BPLuss weewx[2354]:     ****      self.service_obj.append(weeutil.weeutil._get_object(svc)(self, config_dict))
Jan 20 11:16:04 BPLuss weewx[2354]:     ****    File "/usr/share/weewx/weewx/engine.py", line 483, in __init__
Jan 20 11:16:04 BPLuss weewx[2354]:     ****      if software_interval != self.engine.console.archive_interval:
Jan 20 11:16:04 BPLuss weewx[2354]:     ****    File "/usr/share/weewx/weewx/drivers/fousb.py", line 1003, in archive_interval
Jan 20 11:16:04 BPLuss weewx[2354]:     ****      return self._archive_interval_minutes() * 60
Jan 20 11:16:04 BPLuss weewx[2354]:     ****  TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
Jan 20 11:16:04 BPLuss weewx[2354]:     ****  Exiting.


On Tuesday, 30 December 2014 22:32:36 UTC, bh...@darkrealm.net wrote:

Andrew Milner

unread,
Jan 20, 2015, 7:33:58 AM1/20/15
to weewx...@googlegroups.com
The log snippet should give matthew something to work with!

mwall

unread,
Jan 20, 2015, 7:49:23 AM1/20/15
to weewx...@googlegroups.com
On Tuesday, January 20, 2015 at 7:02:48 AM UTC-5, Cancunia wrote:
Sorry, I'm not sure how / if you can post code blocks here so I've listed the Weewx startup lines from syslog. For me the problem only exists at powerup, rebooting normally clears it:


cameron,

the log was what we needed - everyone already has the code :)

change the station's archive interval to 5 minutes instead of 60 minutes.  with weewx *not* running, do this:

sudo wee_config_device --set-interval 5

change the record generation to software.  do this at the appropriate place in weewx.conf:

[StdArchive]
    record_generation = software

those two changes will significantly reduce the amount of usb communication and make your setup less prone to failure.

also, try using a powered hub.  try running the fine offset station when nothing else is connected to the pi.  if it works better in either of those configurations, then you know you have a hardware issue.


Cancunia

unread,
Jan 20, 2015, 10:22:18 AM1/20/15
to weewx...@googlegroups.com
Thanks for the pointers, I've implemented the changes as suggested and also changed weewx.conf so that "polling_interval = 300", I'm assuming that this will match the set interval of 5 mins. By coincidence it all started fine on powerup this time before I'd made the software changes! One thing that I had done was to use different USB ports for each device as part of a general cable tidy up. 


On Tuesday, 30 December 2014 22:32:36 UTC, bh...@darkrealm.net wrote:

mwall

unread,
Jan 20, 2015, 10:26:40 AM1/20/15
to weewx...@googlegroups.com
On Tuesday, January 20, 2015 at 10:22:18 AM UTC-5, Cancunia wrote:
Thanks for the pointers, I've implemented the changes as suggested and also changed weewx.conf so that "polling_interval = 300", I'm assuming that this will match the set interval of 5 mins. By coincidence it all started fine on powerup this time before I'd made the software changes! One thing that I had done was to use different USB ports for each device as part of a general cable tidy up. 

leave polling interval at 60 seconds.

it was the hardware record generation, especially with archive interval of 60 seconds, that was causing most of the usb chatter.

Reply all
Reply to author
Forward
0 new messages