You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/04.pro/carriers/portenta-mid-carrier/tutorials/user-manual/content.md
+249Lines changed: 249 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2338,6 +2338,255 @@ You may find additional examples within the library to try various functionaliti
2338
2338
2339
2339
For more details on how the library works, including a comprehensive guide on setup and usage of the above examples, please refer to this [library documentation](https://github.com/arduino-libraries/Arduino_Cellular/tree/main/docs).
2340
2340
2341
+
#### AT Commands Utility
2342
+
2343
+
This section explains using AT commands to interact with the Cat.4 modem. These instructions will guide you through setting up your environment, sending AT commands, and managing your modem effectively.
2344
+
2345
+
AT commands, also known as Hayes commands, are instructions used to control modems. These commands allow you to perform various functions, such as checking the modem status, signal quality, and network registration. Understanding how to send these commands is essential for managing and troubleshooting your Arduino Pro 4G Module.
2346
+
2347
+
#### Using Linux
2348
+
2349
+
This section provides instructions on using **ModemManager** and **mmcli** to send AT commands to your Cat.4 modem on the Portenta X8.
2350
+
2351
+
Ensure that the Pro 4G Module is properly mounted on the Portenta Mid Carrier and that the Portenta X8 recognizes it. You can always use the following commands to verify the connection:
2352
+
2353
+
```bash
2354
+
lsusb
2355
+
2356
+
# Or
2357
+
dmesg
2358
+
```
2359
+
2360
+
***Please set up the Pro 4G Module referring to [this section](#using-linux-4). Otherwise, the __ModemManager__ service may not work as intended or be recognized.***
2361
+
2362
+
First, identify the modem with:
2363
+
2364
+
```bash
2365
+
mmcli -L
2366
+
```
2367
+
2368
+
The output will list the modems detected as the Pro 4G Module. Note the modem's device ID, for example:
2369
+
2370
+
```bash
2371
+
/org/freedesktop/ModemManager1/Modem/0
2372
+
```
2373
+
2374
+

2375
+
2376
+
To send AT commands, *ModemManager* must be in debug mode.
2377
+
2378
+
```bash
2379
+
sudo systemctl stop ModemManager
2380
+
```
2381
+
2382
+
The command below starts *ModemManager* in the background and redirects its output to a log file.
| ATI | Retrieves the modem's basic information such as manufacturer, model, and firmware version. |
2401
+
| AT+CSQ | Checks the signal quality of the modem |
2402
+
| AT+GMI | Retrieves the manufacturer identification |
2403
+
| AT+GMM | Retrieves the model identification of the modem |
2404
+
| ATV | Displays the active configuration profile |
2405
+
| AT+CGMR | Retrieves the firmware version of the modem |
2406
+
| AT+CPAS | Reports the current status of the modem |
2407
+
| AT+CEER | Provides detailed information on the last error cause |
2408
+
| AT+QNWINFO | Retrieves the current network information |
2409
+
2410
+

2411
+
2412
+
You can use Docker to manage the dependencies and tools needed to send AT commands and ensure a consistent environment. The idea would be that you will have the environment running in a separate instance for testing purposes.
2413
+
2414
+
```
2415
+
# Use the official Debian image
2416
+
FROM debian:latest
2417
+
2418
+
# Install necessary packages
2419
+
RUN apt-get update && \
2420
+
apt-get install -y modemmanager && \
2421
+
apt-get install -y mmcli && \
2422
+
apt-get clean && \
2423
+
rm -rf /var/lib/apt/lists/*
2424
+
2425
+
# Set the working directory
2426
+
WORKDIR /app
2427
+
2428
+
# Set the default command to bash
2429
+
CMD ["bash"]
2430
+
```
2431
+
2432
+
Create a file named *Dockerfile* with the content above. This *Dockerfile* sets up a Debian-based image with *ModemManager* and *mmcli* installed.
2433
+
2434
+
Open a terminal in the directory containing the Dockerfile and build the Docker image:
2435
+
2436
+
```bash
2437
+
docker build -t modem-manager .
2438
+
```
2439
+
2440
+
Run the container with the Pro 4G Module attached. This command will start the container and open a bash shell:
2441
+
2442
+
```bash
2443
+
docker run --rm -it --device=/dev/cdc-wdm0 modem-manager
2444
+
```
2445
+
2446
+
Inside the Docker container, identify the modem and send AT commands:
2447
+
2448
+
```bash
2449
+
# List modems
2450
+
mmcli -L
2451
+
```
2452
+
2453
+
```bash
2454
+
# Replace `/org/freedesktop/ModemManager1/Modem/0` with your actual modem's device ID if required after verification
Save this script as run_mm_debug.sh, make it executable, and run it:
2477
+
2478
+
```bash
2479
+
chmod +x run_mm_debug.sh
2480
+
```
2481
+
2482
+
```bash
2483
+
./run_mm_debug.sh
2484
+
```
2485
+
2486
+
To stop the ModemManager process running in debug mode, find its process ID (PID) and kill it:
2487
+
2488
+
```bash
2489
+
ps aux | grep ModemManager
2490
+
```
2491
+
2492
+
```bash
2493
+
sudo kill<PID>
2494
+
```
2495
+
2496
+
Using **`nmcli`**, you can easily send AT commands to your Cat.4 modem to perform various tasks like checking the modem status, signal quality, and network registration. This method provides a straightforward way to interact with your modem from a Linux environment, whether you are performing a simple check or managing more advanced functions.
2497
+
2498
+
By following these steps, you can effectively manage and troubleshoot your modem using AT commands in the Linux environment.
2499
+
2500
+
#### Using Arduino
2501
+
2502
+
The AT commands can also be sent to the Pro 4G Module using the Portenta H7 or Portenta C33 with the Arduino IDE.
2503
+
2504
+
It will require [**Arduino_Cellular**](https://github.com/arduino-libraries/Arduino_cellular) library. You can access the library through the Arduino IDE's library manager by navigating to **Sketch -> Include Library -> Manage Libraries** or using the IDE's side panel with books icon.
2505
+
2506
+

2507
+
2508
+
Please ensure the mini PCIe power configuration is set as outlined in the [Mini PCIe Power Breakout Header](#mini-pcie-power-breakout-header-j9) section. The Portenta H7 or C33 requires **SERIAL1 Breakout** pins to be connected to designated **PCIe Breakout** pins :
***Please use a 5.0 V external power source when using an Arduino Pro 4G Module (EMEA / GNSS Global) or any other mPCIe modules due to their high power consumption. This is important for maintaining a stable power supply to the Portenta SOM and the carrier, particularly for extended periods of use.***
2519
+
2520
+
The image below shows the setup, featuring the Portenta H7 and Pro 4G Module connected to the Portenta Mid Carrier along with a mini PCIe power configuration:
2521
+
2522
+

2523
+
2524
+
The following example is called **ModemTerminal**, which can be found within the [**Arduino_Cellular**](https://github.com/arduino-libraries/Arduino_cellular) library, compatible with the Portenta H7 and Portenta C33.
2525
+
2526
+
```arduino
2527
+
/**
2528
+
* The ModemTerminal example demonstrates how to use the ArduinoCellular library to send raw AT commands to the modem.
2529
+
*
2530
+
* Instructions:
2531
+
* 1. Insert a SIM card with or without PIN code in the Arduino Pro 4G Module.
2532
+
* 2. Provide sufficient power to the Arduino Pro 4G Module. Ideally, use a 5V power supply
2533
+
* with a current rating of at least 2A and connect it to the VIN and GND pins.
2534
+
* 3. Specify the APN, login, and password for your cellular network provider.
2535
+
* 4. Upload the sketch to the connected Arduino board.
2536
+
* 5. Open the serial monitor and type AT commands to interact with the modem.
2537
+
*
2538
+
* Initial author: Cristian Dragomir
2539
+
*/
2540
+
2541
+
#include "ArduinoCellular.h"
2542
+
#include "arduino_secrets.h"
2543
+
2544
+
ArduinoCellular cellular = ArduinoCellular();
2545
+
2546
+
void setup(){
2547
+
Serial.begin(115200);
2548
+
while (!Serial);
2549
+
cellular.setDebugStream(Serial); // Uncomment this line to enable debug output
The example lets you send raw AT commands to the Pro 4G Module using the Arduino IDE with the Portenta H7 and Portenta C33. The script requires **arduino_secrets.h** to be defined with the following credentials:
2576
+
2577
+
- SIM Card PIN Number
2578
+
- GPRS APN
2579
+
- GPRS Login
2580
+
- GPRS Password
2581
+
2582
+
These parameters are always required to use the SIM functionalities within the modem. The image below shows an anticipated result of the modem detected and connecting to a network using the Portenta H7 as the core device:
2583
+
2584
+

2585
+
2586
+
It will show a similar result when the Portenta C33 is used as the core device with the Portenta Mid Carrier and the Pro 4G Module:
2587
+
2588
+

2589
+
2341
2590
#### Ethernet
2342
2591
2343
2592
The Portenta Mid Carrier features an Ethernet port with an RJ45 connector model _TRJK7003A97NL_ with integrated magnetics. These magnetics are crucial for voltage isolation, noise suppression, signal quality maintenance, and rejecting common mode noise, ensuring adherence to waveform standards.
0 commit comments