-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arm64/pinephone: Add driver for PinePhone LTE Modem (Quectel EG25-G) #9304
Conversation
This PR adds the PinePhone Driver for Quectel EG25-G LTE Modem. When the driver is started, the LTE Modem accepts AT Commands over UART3 and `/dev/ttyS1`. PinePhone's LTE Modem is explained in [this article](https://lupyuen.github.io/articles/lte). `src/pinephone_modem.c`, `pinephone_modem.h`: Driver for Quectel EG25-G LTE Modem `configs/modem/defconfig`: New Build Configuration `pinephone:modem` that enables the LTE Modem at UART3 and `/dev/ttyS1` `Kconfig`: Added Kconfig Setting `PINEPHONE_MODEM` to enable the LTE Modem at "Board Selection > Board-Specific Options > LTE Modem" `src/pinephone_bringup.c`: Start the LTE Modem if `PINEPHONE_MODEM` is selected `src/Makefile`: Added LTE Modem Driver to Makefile `platforms/arm/a64/boards/pinephone/index.rst`: Added Build Configuration `pinephone:modem` that enables the LTE Modem
Fixed the UART3 configuration. Sorry about that. |
----- | ||
|
||
Supports LTE Modem (EG25-G). Accepts AT Commands on UART3 | ||
at ``/dev/ttyS1``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we make /dev/ttySx match the datasheet number(UARTx)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately UARTx won't match ttySx on PinePhone. Here are the upcoming UART ports:
- UART0 (ttyS0): Serial Console
- UART1 (ttyS1): Bluetooth Module (Realtek RTL8723CS, not integrated with NuttX yet)
- UART2: Unused, wired to Light Sensor and Compass Sensor
- UART3 (ttyS2): LTE Modem (Quectel EG25-G, integrated with NuttX)
I could modify modem/defconfig
to enable UART1 on ttyS1 (Bluetooth). But UART3 will always map to ttyS2 (LTE Modem) because UART2 is unused.
Shall I make this change? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to adjust the tty driver register code to skip the unused hardware and port number at the same time, or always register all possible tty devices even some mayn't use in the current state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I'll disable UART2 and /dev/ttyS2 for PinePhone, so that UART3 will map correctly to /dev/ttyS3. This should make our Modem Apps a lot easier to find the right /dev/tty.
bool "LTE Modem" | ||
default n | ||
---help--- | ||
Select to enable support for Quectel EG25-G LTE Modem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we abstract a modem interface? So, the SoC can support the different modem, and the modem can support different SoC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I need to do some research to see how the SoC can support other modems. I don't believe NuttX has a modem interface today?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some in drivers/modem, but I am not sure where the common driver interface exists or not. It will be good additional to unify the interface between apps and all possible modem hardware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks let me take a look again. The last time I searched, I found AT Commands referenced in 2 places:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lupyuen I don't think there is a standard command driver for modems, because normally they are hardware dependent. Also I don't think these examples you cited are the right way to support Direct-IP modems on NuttX, Direct-IP modems need to use USRSOCK to integrated correctly with NuttX.
If this modem supports PPP protocol then this is a good way to go (even been a legacy protocol it is well supported on NuttX). I friend of mine (@duduita) is using BG770A and BG95 (Cat-M1 and NB-IoT) with PPP on NuttX and it works fine.
If this Quectel EG25-G is also connected to the USB and has support to MBIM protocol (MBIM and QMI are the most common protocols used on 4G modems) you can use the drivers/usbhost/usbhost_cdcmbim.c with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@acassis EG25-G supports PPP and QMI. @reference for QMI handling https://github.com/sailfishos/ofono
Sorry I shall take some time to rethink and redo this PR:
If anyone has started working on the Generic Modem Interface for NuttX, I'm happy to join you :-) Meanwhile I'll check out whether Zephyr OS has something similar. |
Summary
This PR adds the PinePhone Driver for Quectel EG25-G LTE Modem. When the driver is started, the LTE Modem accepts AT Commands over UART3 and
/dev/ttyS1
.PinePhone's LTE Modem is explained in this article.
New Files in
boards/arm64/a64/pinephone
src/pinephone_modem.c
,pinephone_modem.h
: Driver for Quectel EG25-G LTE Modemconfigs/modem/defconfig
: New Build Configurationpinephone:modem
that enables the LTE Modem at UART3 and/dev/ttyS1
Modified Files in
boards/arm64/a64/pinephone
Kconfig
: Added Kconfig SettingPINEPHONE_MODEM
to enable the LTE Modem at "Board Selection > Board-Specific Options > LTE Modem"src/pinephone_bringup.c
: Start the LTE Modem ifPINEPHONE_MODEM
is selectedsrc/Makefile
: Added LTE Modem Driver to MakefileUpdated Documentation
platforms/arm/a64/boards/pinephone/index.rst
: Added Build Configurationpinephone:modem
that enables the LTE ModemImpact
With this PR, NuttX Apps will be able to control the PinePhone LTE Modem with AT Commands over UART3 and
/dev/ttyS1
.There is no impact on existing code because the driver is not used currently.
Testing
We tested the LTE Modem Driver on PinePhone by sending AT Commands. For Regression Testing, we tested PinePhone with the LTE Modem Driver disabled.
LTE Modem Test
To test the LTE Modem Driver, we selected the
pinephone:modem
Build Configuration:We ran a Modem Test App that sends AT Commands to make phone calls and send SMS messages:
Modem Test App: hello_main.c
(As explained here)
The modem responds correctly to our AT Commands:
Regression Test
For Regression Testing, we selected the
pinephone:lvgl
Build Configuration that disables the LTE Modem:NuttX boots correctly and starts the LCD Display, with the LTE Modem disabled: