-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Expanding "shield" functionality (example uses WNC-M14A2A and SARA modem) #14057
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
Expanding "shield" functionality (example uses WNC-M14A2A and SARA modem) #14057
Conversation
|
All checks are passing now. Review history of this comment for details about previous failed status. |
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.
The approach looks sane.
I'd prefer it if we could express this pattern in DT source code, instead of in the toolchain, but AFAICT this is impossible.
This pattern needs documentation.
|
@SebastianBoe Thank you for the great feedback! I'll put up a v2 with your comments accounted for. |
005c048 to
8581444
Compare
|
Fixed gitlint issue |
|
@erwango Are you planning to be main CODEOWNER for boards/shields/? |
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.
This needs to be discussed as I think a change in our DTS processing is needed for:
- To remove the warning generated by these aliases using labels with a "gpios" portion in their name
OR - Perhaps we can make a change which would allow the actual GPIO setting in the modem DTS to be assigned a label:
mdm-boot-mode-sel-gpios = &arduino_d1;
This would make these hacky aliases go away.
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.
I'll try to discuss this at connect with dts guys.
I thought I was already, but indeed, it appears this is not the case. So, if you volunteer, please go ahead. Otherwise, answer is yes. |
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 @mike-scott for tackling this problem! It's been blocking me from converting the MCR20A to a shield for quite some time.
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.
What if instead we add a CONFIG_ARDUINO_SERIAL to drivers/serial/Kconfig, and then the boards can intelligently enable the right instance like they do with the console uart? Something like this in boards/arm/frdm_k64f/Kconfig.defconfig
if UART_MCUX
config UART_MCUX_0
default y if UART_CONSOLE
config UART_MCUX_2
default y if ARDUINO_SERIAL
config UART_MCUX_3
default y if BT_UART
endif # UART_MCUX
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.
@MaureenHelm I like this idea. I was struggling with the abstraction between a shield's UART (arduino_serial) and a HW specific UART (Like if the driver needed to be used directly).
A great example of this is the Particle.io Boron board which has a U-blox SARA-R41xx modem connected to the nRF52840 directly via UART1 vs. a SparkFun LTE Cat M1 shield which has the U-blox SARA-R41xx connected to Arduino R3-compatible headers.
The shield configuration should only reference the arduino_serial and stay away from anything too specific to the device.
However, this approach won't work for the WNC-M14A2A modem. The UART pins are on non-standard Arduino pins. The traditional Arduino UART is actually C16/C17 pins (UART_3) for K64F.
Technically, ARDUINO_SERIAL should enable UART_3 (where BT_UART is identified). And, the BT_UART setting could go away if we migrate that to a shield setup.
@erwango Feel free to take ownership of the boards/shields dir. My Zephyr plate is fairly full considering I'm working at a starving startup. :) |
8581444 to
fda5413
Compare
Following new shield introduction in zephyrproject-rtos#14057, it has been highlighted there was no codeowner for boards/shields/. Assign erwango as codeowner. Signed-off-by: Erwan Gouriou <[email protected]>
Following new shield introduction in #14057, it has been highlighted there was no codeowner for boards/shields/. Assign erwango as codeowner. Signed-off-by: Erwan Gouriou <[email protected]>
|
recheck |
Can you try testing w/ these 2 changes to the prj.conf: |
Caller will handle freeing packet if error is encountered. Fixes issue reported by Github User @weinholtendian: <err> net_pkt: *** ERROR *** pkt 0x20027e78 is freed already by offload_sendto():1717 (context_sendto():1473). Signed-off-by: Michael Scott <[email protected]>
Assert is checking the array size of pinconfig. Not the actual size of the structure. Fixes issue reported by Github User @weinholtendian Signed-off-by: Michael Scott <[email protected]>
The label binding was missed during initial development of the WNC-M14A2A modem. Let's add the binding so that during the migration to a shield, we can update the DTS correctly. Signed-off-by: Michael Scott <[email protected]>
This allows HW with compatible headers to define the related GPIOs Signed-off-by: Michael Scott <[email protected]>
Let's expose the Arduino R3-compatible pin definition as DTS for the frdm_k64f board. Signed-off-by: Michael Scott <[email protected]>
Let's expose the Arduino R3-compatible pin definition as DTS for the nrf542840_pca10056 board. Signed-off-by: Michael Scott <[email protected]>
Let's expose the Arduino R3-compatible pin definition as DTS for the disco_l475_iot1 board. Signed-off-by: Michael Scott <[email protected]>
Let's remove the sample-specific overlay files dealing with the WNC-M14A2A modem. Signed-off-by: Michael Scott <[email protected]>
Shields can often be very complex to setup in a generic way for several boards to support. Let's allow shields to have their own .conf files as well as specialized overlays per board (when needed). Signed-off-by: Michael Scott <[email protected]>
This shield uses a non-standard UART exposed via Arduino-R3 compatible header pins. It has configurations for FRDM_K64F and nRF52840_PCA10056. Signed-off-by: Michael Scott <[email protected]>
The WNC-M14A2A shield configuration has HW specific settings in place. We can remove those settings here. Signed-off-by: Michael Scott <[email protected]>
Let's change the specific WNC-M14A2A check into a more generic MODEM check for enabling ethernet. Many of these pins are used on the Arduino headers. Signed-off-by: Michael Scott <[email protected]>
Instead of using the now removed overlay files, use the SHIELD= command-line option for testing the WNC-M14A2A modem. Signed-off-by: Michael Scott <[email protected]>
The SARA-R4 series modules from U-Blox are size-optimized LTE-M / NB-IoT and EGPRS modules designed for low power consumption and longer battery life. The binding identifies the UART device, power GPIO and reset GPIO lines. Signed-off-by: Michael Scott <[email protected]>
The u-blox SARA-R4 modem modules are Ultra-compact LTE Cat M1 / NB1 ready: - Configurable with a single hardware version - Flexible mode selection as LTE Cat M1, LTE Cat NB1, EGPRS - only/preferred - Low power consumption and longer battery life - Extended range in buildings, basements, and with NB1, underground This driver introduces support for basic AT commands to query modem information as well as socket connection for TCP/UDP communication. Signed-off-by: Michael Scott <[email protected]>
Setup the SARA-R4 POWER and RESET pins as gpios. Signed-off-by: Michael Scott <[email protected]>
SparkFun offers an Arduino-R3 compatible shield using the SARA-R410M-02B LTE Cat M1/NB-IoT modem. Now, that the basic SARA-R4 modem driver is implemented, let's enable the shield for several MCUs supporting Arduino-R3 compatible headers. Product Link: https://www.sparkfun.com/products/14997 Signed-off-by: Michael Scott <[email protected]>
The Particle.io Boron is an nRF52840-based board with a connected u-blox SARA-R4 modem. The main board was previously upstreamed without modem support. Now that we have a driver to support the SARA-R4 modem, let's enable it for the Boron board. Signed-off-by: Michael Scott <[email protected]>
8870e9c to
a56e073
Compare
|
Rebased and addressed gitlint and license issues. |
I took some time today to see if I could setup a "shield" to represent the AT&T LTE-M WNC-M14A2A-based Arduino-R3 compatible shield.
This is very rough work and generates a few warnings when compiling, but this RFC patch series handles the following "special cases" which I encountered:
The following now works to build the LwM2M client for each of the 2 configured boards:
These warnings are generated since I named the alias "gpios":
However, it looks like the generated include file has the right defines/values in it.
I am also working on the U-blox SARA R41xx modem driver, which is present in the Particle.io Boron board as well as a SparkFun LTE-M Arduino shield. It uses the standard UART exposed by Arduino so it won't need per board .overlay files, but this series solves a lot of the issues I am hitting with that driver as well (reset and power GPIOs, etc).
Please discuss.