Connecting a WWAN modem to Genesys ZU - Hackster.io

2022-09-17 06:14:58 By : Ms. Yolanda Bai

Add the following snippet to your HTML:

In this project we are going to connect and configure a PCIe WWAN modem to a Zynq MPSOC using Petalinux and the Genesys ZU 5EV board.

Read up about this project on

In this project we are going to connect and configure a PCIe WWAN modem to a Zynq MPSOC using Petalinux and the Genesys ZU 5EV board.

That the world is connected is something that everybody knows, but to achieve this we need devices that allow not only one interface, but some of them in order to be connected to any other device, in anyplace of the world. If we take a look into the market, we can see cheap microcontrollers with UART, I2C, SPI, I2S and each one of these interfaces allow the connection to other devices. All of these interfacesare valid to communicate different peripherals inside the board or near to it.

If we need to communicate our design to another device on the other side of the world, we will need to connect to a network to which all the devices we need are connected. In general, we say we are going to connect our board to “Internet”, but technically, we are connecting our board to a Wide Area Network (WAN). In case we are using a Zynq MPSOC device, in order to communicate the device to the WAN we will need first an Ethernet PHY that implements a bridge between a digital protocol like Reduced Gigabit Media Independent Interface (RGMII), to the analog ethernet protocol. Then, the ethernet interface will be connected to a router in order to connect the Local Area Network (LAN) that our device is connected to a WAN. Usually, we will need another device that acts as bridge between the Ethernet protocol and the fiber optics interface or whatever be the protocol we are using. We have to notice that all of this is valid as long as we have access to the fiber optics network of our Internet Services Provider.

There are many cases where this connection is not available, the clearest example are the mobile phones, that are not connected physically to the network, but are connected via Wireless Wide Area Network. This kind of devices are also connected to the WAN using different standards like 2G, 3G, LTE, 4G or the newest 5G. So, can we connect a device like Zynq MPSOC to the WWAN using some of those protocols? there are not surprise at this point, the answer is obviously yes.

In order to connect any device to a WWAN we will need an element that act as a bridge between a digital protocol, and the WWAN protocol. That element is a wireless modem that support at east on of the available protocols.

The modem I will use is the MC7700 from Sierra Wireless. This module supports LTE, so we can connect to the networks of many providers. MC7700 is based on the chipset Qualcomm MD9200 and uses the QMI (Qualcomm MSM Interface), that is a protocol supported by Linux. The MC7700 board has a MiniPCIe form factor, and the interface used is USB 2.0. The board supports the configuration through AT commands so is expected that a new serial port will be created to make this configuration. For this project we will use the Digilent’s Genesys ZU. This board is based on Zynq Ultrascale+, and has a Mini PCIe expansion connector where we will connect the MC7700 modem.

If we check the schematics of the Genesys ZU, we can see that the Mini PCIe connector has access to the USB port of the Zynq UltraScale+, and also to the SIM card slot through the UIM interface.

Regarding the drivers, we have to check if this module is supported by the Linux kernel by default, since if it is supported, we do not have to design our own driver. To check the support, we have to open the qmi_wwan driver from the Linux kernel drivers provided by Xilinx, available in Github.

We can see how the MC7700 is supported by the driver, so it will make easy the integration. Now we can start the development.

First, we have to create a new project in Vivado.

In the project type window, we must select RTL Project, and check the option Do not specify sources at this time, since this project have not any source code, and we must uncheck the option Project is an Extensible Vitis platform.

Now we need to select the board we will use. In order to use the genesys ZU 5-EV you need to doanload the boardfile from the Digilent Github repository. Then you have to copy the corresponding folder to the Boards repository. In previous versions of Vivado, board files are stored in the installation directory. In newer versions, you can check where is your Board respository. To check it, you can open the Settings window of Vivado.

When the board is added to the board repository, in the project creation you will find the Genesys ZU-5EV.

Once the project is created, we are going to create a new block design.

In the block design, first we have to add the Zynq UltraSCALE+ IP. Now, on the top of the window, Vivado will ask us if we want to Run the block automation in order to apply the default preset to the Zynq PS.

Once the IP is ready, we will add an AXI GPIO in order to control the LEDS of the board and read the switches. These elements that are in the board, can be added to the block design by open in the Board tab in the left of the window, and drag and drop them When the LEDS are included in the board, a new AXI GPIO IP will be added automatically. The next is to add the switches, then Vivado will ask if we want to use the same AXI GPIO added for the LEDS. The resulting block design with all the elements that we will need is shown in the image below.

Once the block design is complete, we have to Verify it and Create the HDL Wrapper.

Next, we have to Generate the Bitstream.

Finally, when Vivado ends the all the processes, we need to Export the hardware in order to generate the.xsa file that we will use in t Petalinux build.

It is important that the hardware exported includes the bitstream.

Now, we must create the Petalinux project. The Petalinux distribution must include the needed drivers to control the USB peripherals and also a USB network cards. Drivers we will need will be selected in the kernel configuration.

In order to execute all the Petalinux commands, we have to set the enviromental variables. To do that we have to run the script settings.sh that is located in the Petalinux installation folder.

Once the script is executed, the next is create a new Petalinux project by executing the command

Running this command, a new blank Petalinux project will be created in a subfolder. Now we must link the hardware definition created in Vivado with the project. To do that, we have to execute the command

In addition to link the hardware description, this command will open the System configuration menu. In this menu I always change the configuration of the IP address in order to set it to 192.168.1.10. Notice that this IP is the Ethernet connection IP, not the WWAN IP. To change the IP configuration, we must navigate to Subsystem AUTO Hardware Settings > Ethernet Settings, uncheck the Auto option and set the new IP.

The rest of the options in this menu will remain as default. We have to Exit of the menu and the new configuration will be saved.

Now we will add all the needed drivers to manage the WWAN card. Remember that this card, although is connected to the PCIe socket, the processors communicate with it through the USB 2.0 connection, so most of the drivers included in the kernel will be related with the USB port.

In order to open the kernel configuration, we must execute the command

Unlike the first command, this one will take some time to open the menu.

The menu to configure the kernel will be opened in a new terminal window and will look like the image below.

There are some modules that we need to add to the kernel. The easy way to do that is to use the search menu to find the corresponding drivers. To open the search menu, we must press the key “/” and search the module we want to add. The first one will be CONFIG_USB_SERIAL. This module can be found navigating to Device Drivers > USB support > USB Serial Converter Support.

The next one is CONFIG_USB_SERIAL_GENERIC. You can find this module navigating to Device Drivers >USB Support > USB Serial Converter Support > USB Generic Serial Driver.

The next module is CONFIG_USB_SERIAL_OPTION. This module is specific for GSM and DMA modems, and it is located on Device Drivers > USB Support > USB Serial Converter Support > USB driver for GSM and CDMA modems.

Now we have to add the module to communicate with the chipset of the board. Remember that the manufacturer of the board is SIERRA, but it is based on a chipset of QUALCOMM. The module we must add is CONFIG_USB_SERIAL_QUALCOMM, that can be found in Device Drivers > USB Support > USB Serial Converter Support > USB Qualcomm Serial modem.

Finally, we have to add the module to support the Communication Device Class (CDC) Abstract Control Modem (ACM). This module is named CONFIG_USB_ACM and can be found in Device Drivers > USB Support > USB Modem (CDC ACM) support.

Now we have to add drivers for networking. The first one will be CONFIG_USB_USBNET, that can be found in Device Drivers > Network device support > USB Network Adapters > Multi-Purpose USB Networking Framework.

The next one is related to the QMI protocol, the CONFIG_USB_NET_QMI_WWAN, that can be found in Device Drivers > Network device support > USB Network Adapters > QMI WWAN driver for Qualcomm MSM based 3G and LTE modems.

The next module we need to add is CONFIG_USB_NET_CDCETHER, in Device Drivers > Network device support > USB Network Adapters > CDC Ethernet support (smart devices such as cable modems).

The next one is CONFIG_USB_NET_RNDIS_HOST. This module adds support to Remote Network Driver Interface Specification (RNDIS), and is used to link a virtual ethernet port through the USB. This module is located in Device Drivers > Network device support > USB Network Adapters > Host for RNDIS and ActiveSync devices.

The next one belongs to the Communication Device Class but add support to the Network Control Model (NCM) subclass, and is used to support ethernet communications through the USB port. The name of the module is CONFIG_USB_NET_CDC_NCM, and is located in Device Drivers > Network device support > USB Network Adapters > CDC NCM support.

The last one is CONFIG_USB_NET_CDC_MBIM, and adds support to the Universal Serial Bus (USB) Communications Class Subclass Specification for Mobile Broadband Interface Model (MBIM). This module is located in Device Drivers > Network device support > USB Network Adapters > CDC MBIM support.

Once all these modules are added, we can build the distribution by executing petalinux-build command, and go to take a coffee while the computer works.

After some time, the building is complete, and we will have all the needed files under the path ./images/linux.

In order to boot the Genesys ZU board from an SD card, we have to package the Petalinux build. We can do this by executing the command.

In order to support all variants of the Genesys ZU (more info here), we have to change the FSBL generated by Petalinux, by FSBL modified by Digilent. Once the FSBL is downloaded, we can generate the Petalinux images for the Genesys ZU.

Then in ./images/linux 3 files will be created, BOOT.bin, boot.scr and image.ub. For this test we will copy these 3 files to an SD card, and connect the jumper in the JP3 pin header in the SD position and insert the SD card. Finally, insert the SIM card in the socked in the bottom side of the Genesys ZU, and power up the board.

When Linux is booting in Genesys ZU board, we can see how the modem is identify correctly as USB device, with the product name MC7700 and the manufacturer Sierra Wireless Incorporated.

Also notice that a new network named wwan0 is detected for a CDC MBIM device. If we execute the command ip a we can see the ethernet connection (eth0), and also the WWAN connection (wwan0), that is not connected since the module is not configured.

As last check, we can list the devices connected, and we can find the cdc-wdm0 device. In order to configure the MC770 module, we will need to send it AT commands. These AT commands will be sent through a ttyUSBx port, but they are not created by default.

To create the ttyUSBx port, we need to change de mode of the card. To do that we have to execute the next command

When the command is executed, the card will create 3 different ttyUSB ports.

The port used to send the commands, according the MC7700 manual is the second. To test it, we can execute the command

that send the text AT+GMI, and asks the module by its manufacturer, through the ttyUSB2, then to check the response of the module, we have to execute

and we can see the manufacturer of the module.

To ask by its model name, we have to execute

A complete list of the available AT commands can be download from the Sierra webpage. For this project, we will need to insert the PIN code for the SIM card. If we ask to the modem about the PIN number, we can check that the modem is awaiting the PIN number.

Then we can send the PIN number to the Modem.

Now If we ask to the modem about the PIN configuration we can see how the modem has accepted the PIN number.

Now we have to configure in the modem the configuration to be able to connect the Genesys ZU to the WWAN network. This configuration is different for each provider, so you will need to search about the correct configuration for your provider. To do this first we have to change the mode of the modem.

Then, we can introduce the configuration of our internet provider, in my case I have used a SIM card from Digi.

The response will be the next.

Asking the modem for the service provider we can see how the modem has recognized the provider.

At this point we can check the status of the connection.

The response in this case can be different, but responses 0, 1 and 0, 5 means that the modem is connected.

Now we have to activate the data connection.

The response to this command must be OK, that indicates that the connection is stablished, but the provider has no give us a valid IP address. To do that, we have to activate the DHCP client in the Genesys ZU board. Petalinux has included the DHCP client udhcpc.

Once the provider has assign us an IP address, we can use the ping command to verify that the connection is established.

At this point we have the Genesys ZU 5EV board connected to the world with only the power supply as an external connection. The configuration I have used for this post is valid for Sierra Modems MC77xx, if you are using any other modem, you have to verify the AT command list in order to send the appropiate commands. A webpage that has been very helpful for me is M2MSupport, where I have found the steps to connect the modem.

This kind of connections are very useful if our board is designed to be in a remote place, for example if we need to take measures in a place without wired connection, but some kind of power supply available like a solar pannel with a battery charger. Zynq MPSOC also allow us to process data in the same place that are acquired so we will reduce the amount of data sent since all the raw data is processed at the edge.