简体   繁体   中英

Quectel EC25EU 4G module prevents RaspAP from starting when there is no GSM connection

I have a Raspberry Pi 4 B+ with the Sixfab 4G/3G base hat and Quectel EC25-EU 4G/LTE PCIe module installed. I have RaspAP running with a slightly modified configuration:

  • /var/www/html/rasp instead of /var/www/html as root folder
  • lighttpd is on port 803 so as not to intersect with an instance of nginx , which runs on port 80 and with /var/www/html as root (could this be problematic?)
  • SSID and password are changed to suit me
  • dnsmasq and dhcpcd configs are standard RaspAP configs

The problem: When the 4G modem has no service, RaspAP fails to start for almost exactly 10 minutes after rebooting. Error logs indicate that the wlan0 interface is not usable. The logs don't tell me enough. When I run this command:

sudo /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/hostapd.conf

it outputs:

Configuration file: /etc/hostapd/hostapd.conf
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/hostapd/wlan0' manually if it is not used anymore
Failed to setup control interface for wlan0
wlan0: Unable to setup interface.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED 
wlan0: CTRL-EVENT-TERMINATING 
hostapd_free_hapd_data: Interface wlan0 wasn't started
nl80211: deinit ifname=wlan0 disabled_11b_rates=0

I have not used wlan0 to connect to any wireless internet or changed any setting before setting up RaspAP. Running dmesg gives the following error, sometime before the AP comes up:

ieee80211 phy0: brcmf_cfg80211_stop_ap: setting AP mode failed -52

I should also note that dmesg also shows this, each time at startup, with or without RaspAP installed:

[    9.639873] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled

I've replicated this problem with two different hats and modems and on two different Raspberry Pi 4Bs, I have tested with one of two modems on a third Raspberry and there it works fine, albeit without any nginx. I find it hard to imagine nginx can do this. The only theory I have so far is based on the fact that both modems have been configured for PPP and possibly QMI modes before the current configuration of ECM-mode. I haven't found a way to "clean" their firmware, could it be old configurations are intersecting with Raspbian's network manager, preventing something?

These components are all in a plastic enclosure. I've measured the temperature inside, it has reached 45 C right by the Quectel module. The Raspberry runs at up to 71 C, but no hotter. I don't think this is a heat problem from the Raspberry point of view, as it always happens on startup, but has also happened while running if the 4G service drops, which might have happened due to heat. Any ideas to confirm this hypothesis would be welcomed. I am at my wits end in trying to solve this!

The solution seems to be to edit the hostapd.service file ( /lib/systemd/system/hostapd.service ) and add After=network-online.target to the [Unit] section. This roughly translates to waiting while the network interfaces are started AND until they have an address (as I understand it). Great source here.

I've tested it with and without GSM service, multiple times. It only takes about 10-20 sec for the hotspot to show up on a Wifi scan after rebooting. I haven't eliminated the possibility that heat plays a role, should it fail during operation and not at startup.

A more shoddy solution was to add ExecStartPre=/bin/sleep 15 to the [Service] section to force the OS to delay starting the service. It seems, for some reason I still don't comprehend, that if hostapd starts too early, it hangs for 10 minutes as the wlan0 interface isn't ready. I suspect this may be a power issue with the Pi, as so many things are.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM