basvanwesting

basvanwesting

Cannot connect using UART, only USB (cannot even find device over UART)

Hi,

I using the vintage_net_mobile library to establish a CAT-M1 cellular connection with the Sixfab Raspberry Pi Cellular IoT HAT.

If I understand correctly UART is enabled by default on the device v1.1.0. For the v1.3.0 HAT, UART is disabled by default and 2 jumpers need to be soldered. But I have the v1.1.0 version (and these jumpers don’t even exist).

Also UART doesn’t seem to have any non-default requirements for Nerves on rpi4.

Does anybody have experience with this kind of issue, to help me out a bit?

Using the USB connection this works beautifully:

iex> VintageNet.get_by_prefix(["interface", "ppp0"])
[
  {["interface", "ppp0", "addresses"],
   [
     %{
       address: {100, 85, 118, 2},
       family: :inet,
       netmask: {255, 255, 255, 255},
       prefix_length: 32,
       scope: :universe
     }
   ]},
  {["interface", "ppp0", "config"],
   %{
     type: VintageNetMobile,
     vintage_net_mobile: %{
       modem: VintageNetMobile.Modem.QuectelBG96,
       scan: [:lte_cat_m1],
       service_providers: [%{apn: "wm"}]
     }
   }},
  {["interface", "ppp0", "connection"], :internet},
  {["interface", "ppp0", "hw_path"], "/devices/virtual"},
  {["interface", "ppp0", "lower_up"], true},
  {["interface", "ppp0", "mobile", "access_technology"], "CAT-M1"},
  {["interface", "ppp0", "mobile", "band"], "LTE BAND 8"},
  {["interface", "ppp0", "mobile", "channel"], 3700},
  {["interface", "ppp0", "mobile", "cid"], 2639383},
  {["interface", "ppp0", "mobile", "iccid"], "..."},
  {["interface", "ppp0", "mobile", "imsi"], "..."},
  {["interface", "ppp0", "mobile", "lac"], 260},
  {["interface", "ppp0", "mobile", "mcc"], 204},
  {["interface", "ppp0", "mobile", "mnc"], 16},
  {["interface", "ppp0", "mobile", "network"], "T-Mobile NL"},
  {["interface", "ppp0", "mobile", "signal_4bars"], 4},
  {["interface", "ppp0", "mobile", "signal_asu"], 30},
  {["interface", "ppp0", "mobile", "signal_dbm"], -53},
  {["interface", "ppp0", "present"], true},
  {["interface", "ppp0", "state"], :configured},
  {["interface", "ppp0", "type"], VintageNetMobile}
]

It does claim 4 USB slots, but I’m not sure whether that is not normal.

iex()> Circuits.UART.enumerate
%{
  "ttyAMA0" => %{},
  "ttyS0" => %{},
  "ttyUSB0" => %{
    description: "Qualcomm CDMA Technologies MSM",
    manufacturer: "Qualcomm, Incorporated",
    product_id: 662,
    serial_number: "...",
    vendor_id: 11388
  },
  "ttyUSB1" => %{
    description: "Qualcomm CDMA Technologies MSM",
    manufacturer: "Qualcomm, Incorporated",
    product_id: 662,
    serial_number: "...",
    vendor_id: 11388
  },
  "ttyUSB2" => %{
    description: "Qualcomm CDMA Technologies MSM",
    manufacturer: "Qualcomm, Incorporated",
    product_id: 662,
    serial_number: "...",
    vendor_id: 11388
  },
  "ttyUSB3" => %{
    description: "Qualcomm CDMA Technologies MSM",
    manufacturer: "Qualcomm, Incorporated",
    product_id: 662,
    serial_number: "...",
    vendor_id: 11388
  }
}

But then I disconnect the USB, the modem cannot be found over UART alone.

iex(16)> Circuits.UART.enumerate
%{"ttyAMA0" => %{},  "ttyS0" => %{}}

It states as not present:

iex(5)> VintageNet.Info.info
VintageNet 0.9.2

All interfaces:       ["eth0", "lo", "wlan0", "wwan0"]
Available interfaces: ["wlan0"]

Interface ppp0
  Type: VintageNetMobile
  Present: false
  Configuration:
    %{
      type: VintageNetMobile,
      vintage_net_mobile: %{
        modem: VintageNetMobile.Modem.QuectelBG96,
        scan: [:lte_cat_m1],
        service_providers: [%{apn: "wm"}]
      }
    }

I did build a custom system-rpi4 with PPP and additional USB flags enabled as stated in the vintage_net_mobile docs. See GitHub - basvanwesting/custom_rpi4: nerves_system_rpi4 for mobile · GitHub for that custom system-rpi4 setup.

I did find a small deviation from the docs there as the CONFIG_USB_NET_CDC_NCM flag cannot be enabled explicitly through make linux-menuconfig, but seems implicitly enabled though CONFIG_USB_NET_HUAWEI_CDC_NCM, which also enabled CONFIG_USB_USBNET). So I just edited the linux-4.19.defconfig manually. But that doesn’t seem related. I just mentioned it for completeness.

Regards, Bas

First Post!

fhunleth

fhunleth

Co-author of Nerves

I have not used the Sixfab board. I have used the Quectel BG96, but only the USB connection. To use the UART connection instead, I’d create a new vintage_net_mobile modem implementation. Since there’s only one serial port, that one has to belong to the PPP connection. That means that the status pollers need to be turned off. I.e., no signal strength reports when connected. This issue turned out to be a non-starter for my company so I never implemented it.

My first try for the new modem implementation would be to remove required "wwan0" interface to enumerate (see VintageNet.Interface.RawConfig — vintage_net v0.13.12). Continue to use ppp0 for the ifname, but without the required interface, vintage_net will think that the modem is always ready to configure and use even if ppp0 doesn’t exist. Then keep the code to bring up the PPP connection, but point it to ttyAMA0 or ttyS0 (assuming that’s where the UART is connected). Retries are handled automatically be vintage_net, but you can tweak the timeouts in the raw config if you don’t like them. My hope is that this would get something for you that enables data to flow. You may want to look into vintage_net’s power management feature if you need to toggle a GPIO to turn the modem off and on. I’ve used it to get the modem unstuck if there are too many retries or to power it off completely when unused. From there, I’d look into adding AT commands to pull of modem status before the PPP connection is made, but that would require more thought - maybe the PPP chat script could do it and some code could be added to parse the results.

Frank

Where Next?

Popular in Questions Top

New
Tee
can someone please explain to me how Enum.reduce works with maps
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New

Other popular topics Top

Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
marick
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I’m a nov...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement