Skip to content
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

[topic-gpio] Convert modem drivers to the new API #22168

Merged

Conversation

carlescufi
Copy link
Member

Completely untested in hardware

@carlescufi
Copy link
Member Author

@mike-scott if you have a chance to test this I'd be very thankful.

@zephyrbot
Copy link
Collaborator

zephyrbot commented Jan 24, 2020

All checks are passing now.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

@carlescufi carlescufi force-pushed the drivers-modem-gpio branch 2 times, most recently from 3269ae0 to 731ebe0 Compare January 24, 2020 14:26
Copy link
Contributor

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested out these changes by building a sample for the Particle Boron board and enabling networking. The sample ran the same with these changes as it has compared to zephyr::v2.1.0. I did notice one new build warning, which should be simple to resolve.

Do let me know if you need me to run any additional tests.

drivers/modem/modem_pin.c Outdated Show resolved Hide resolved
Copy link
Collaborator

@pabigot pabigot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devicetree flags should still be used for configuration even if raw active value is specified by driver.

drivers/modem/wncm14a2a.c Outdated Show resolved Hide resolved
Copy link
Contributor

@mike-scott mike-scott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@mike-scott mike-scott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I noticed one issue for discussion.

drivers/modem/ublox-sara-r4.c Outdated Show resolved Hide resolved
Convert to the new API using raw access, since it's a common access
layer shared by multiple (right now only ublox-sara-r4) modems.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Conver to the new GPIO API using raw access, since the driver
has its own macros to define signal levels.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Copy link
Contributor

@mike-scott mike-scott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok LGTM

@mike-scott
Copy link
Contributor

Tested-By: Michael Scott mike@foundries.io
Board: K64F w/ SARA-R4 shield:

west build -b frdm_k64f -s zephyr/samples/net/lwm2m_client -- \
  -DSHIELD=sparkfun_sara_r4 \
  -DCONFIG_NET_CONFIG_PEER_IPV4_ADDR=\"23.97.187.154\" \
  -DCONFIG_NET_IPV6=n -DCONFIG_NET_CONFIG_NEED_IPV6=n \
  -DCONFIG_MODEM_UBLOX_SARA_R4_APN=\"hologram\" \
  -DCONFIG_MODEM_UBLOX_SARA_R4_MANUAL_MCCMNO=\"310410\" \
  -DCONFIG_COAP_INIT_ACK_TIMEOUT_MS=10000 -DCONFIG_MODEM_SHELL=y \
  -DCONFIG_LWM2M_SERVER_DEFAULT_PMIN=1 -DCONFIG_LWM2M_SERVER_DEFAULT_PMAX=360 \
  -DCONFIG_MODEM_LOG_LEVEL_DBG=y
[00:00:00.000,000] <inf> modem_ublox_sara_r4: Setting Modem Pins
[00:00:00.000,000] <dbg> modem_ublox_sara_r4.pin_init: MDM_RESET_PIN -> NOT_ASSERTED
[00:00:00.000,000] <dbg> modem_ublox_sara_r4.pin_init: MDM_POWER_PIN -> ENABLE
[00:00:04.000,000] <dbg> modem_ublox_sara_r4.pin_init: MDM_POWER_PIN -> DISABLE
[00:00:08.000,000] <dbg> modem_ublox_sara_r4.pin_init: MDM_POWER_PIN -> ENABLE
[00:00:17.000,000] <dbg> modem_ublox_sara_r4.pin_init: MDM_POWER_PIN -> DISABLE
[00:00:18.000,000] <dbg> modem_ublox_sara_r4.pin_init: MDM_POWER_PIN -> ENABLE
[00:00:28.000,000] <inf> modem_ublox_sara_r4: ... Done!
[00:00:28.000,000] <inf> modem_ublox_sara_r4: Waiting for modem to respond
[00:00:30.004,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:30.007,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:30.191,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:30.245,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:30.299,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:30.355,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:30.410,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [] (len:6)
[00:00:30.410,000] <inf> modem_ublox_sara_r4: Manufacturer: u-blox
[00:00:30.411,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:30.467,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [] (len:14)
[00:00:30.467,000] <inf> modem_ublox_sara_r4: Model: SARA-R410M-02B
[00:00:30.467,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:30.526,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [] (len:39)
[00:00:30.526,000] <inf> modem_ublox_sara_r4: Revision: L0.0.00.00.05.08 [Apr 17 2019 19:34:02]
[00:00:30.526,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:30.583,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [] (len:15)
[00:00:30.583,000] <inf> modem_ublox_sara_r4: IMEI: 352753092151842
[00:00:30.584,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:30.660,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:30.717,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:32.157,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:32.157,000] <inf> modem_ublox_sara_r4: Waiting for network
[00:00:32.158,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [+CREG: ] (len:8)
[00:00:32.158,000] <dbg> modem_ublox_sara_r4.on_cmd_socknotifycreg: CREG:5
[00:00:33.166,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [+CESQ: ] (len:28)
[00:00:33.166,000] <inf> modem_ublox_sara_r4: RSRP: -1000
[00:00:33.166,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:35.173,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [+CESQ: ] (len:28)
[00:00:35.173,000] <inf> modem_ublox_sara_r4: RSRP: -1000
[00:00:35.173,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:37.182,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [+CESQ: ] (len:25)
[00:00:37.182,000] <inf> modem_ublox_sara_r4: RSRP: -109
[00:00:37.182,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
uart:~$ *** Booting Zephyr OS build zephyr-v2.1.0-1287-g69a5c7c8bd78 ***
[00:00:39.182,000] <inf> modem_ublox_sara_r4: Network is ready.
[00:00:39.188,000] <dbg> net_lwm2m_engine.lwm2m_engine_init: LWM2M engine socket receive thread started
[00:00:39.188,000] <dbg> net_lwm2m_obj_security.security_create: Create LWM2M security instance: 0
[00:00:39.188,000] <dbg> net_lwm2m_obj_server.server_create: Create LWM2M server instance: 0
[00:00:39.188,000] <dbg> net_lwm2m_obj_device.device_create: Create LWM2M device instance: 0
[00:00:39.188,000] <dbg> net_lwm2m_obj_conn_mon.connmon_create: Create LWM2M connectivity monitoring instance: 0
[00:00:39.188,000] <dbg> net_lwm2m_obj_firmware.firmware_create: Create LWM2M firmware instance: 0
[00:00:39.188,000] <dbg> net_lwm2m_obj_location.location_create: Create Location instance: 0
[00:00:39.188,000] <inf> net_config: Initializing network
[00:00:39.188,000] <inf> net_config: IPv4 address: 192.0.2.1
[00:00:42.188,000] <inf> net_lwm2m_client_app: Run LWM2M client
[00:00:42.188,000] <dbg> net_lwm2m_engine.lwm2m_engine_set: path:0/0/2, value:0x20008ccf, len:1
[00:00:42.188,000] <dbg> net_lwm2m_engine.lwm2m_engine_create_obj_inst: path:3303/0
[00:00:42.188,000] <dbg> net_ipso_temp_sensor.temp_sensor_create: Create IPSO Temperature Sensor instance: 0
[00:00:42.189,000] <dbg> net_lwm2m_engine.lwm2m_engine_create_obj_inst: path:3311/0
[00:00:42.189,000] <dbg> net_ipso_light_control.light_control_create: Create IPSO Light Control instance: 0
[00:00:42.189,000] <dbg> net_lwm2m_engine.lwm2m_engine_create_obj_inst: path:3340/0
[00:00:42.189,000] <dbg> net_ipso_timer.timer_create: Create IPSO Timer instance: 0
[00:00:42.189,000] <inf> net_lwm2m_rd_client: Start LWM2M Client: frdm_k64f
[00:00:43.189,000] <dbg> net_lwm2m_engine.lwm2m_engine_get: path:0/0/1, buf:0x20008827, buflen:1
[00:00:43.189,000] <dbg> net_lwm2m_engine.lwm2m_engine_get: path:1/0/1, buf:0x200003e8, buflen:4
[00:00:43.189,000] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'frdm_k64f' with client lifetime 30
[00:00:43.189,000] <dbg> net_lwm2m_engine.lwm2m_parse_peerinfo: Parse url: <log_strdup alloc failed>
[00:00:43.204,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [+USOCR: ] (len:9)
[00:00:43.204,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:44.056,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [+USOST: ] (len:13)
[00:00:44.057,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:44.057,000] <dbg> net_lwm2m_rd_client.sm_send_registration: registration sent [23.97.187.154]
[00:00:44.393,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [+UUSORF: ] (len:13)
[00:00:44.404,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [+USORF: ] (len:72)
[00:00:44.405,000] <dbg> modem_cmd_handler.cmd_handler_process: match cmd [OK] (len:2)
[00:00:44.405,000] <dbg> net_lwm2m_engine.lwm2m_udp_receive: checking for reply from [23.97.187.154]
[00:00:44.405,000] <dbg> net_lwm2m_rd_client.do_registration_reply_cb: Registration callback (code:2.1)
[00:00:44.405,000] <dbg> net_lwm2m_client_app.rd_client_event: Registration complete
[00:00:44.405,000] <inf> net_lwm2m_rd_client: Registration Done (EP='r2uwi0RSDp')
[00:00:44.405,000] <dbg> net_lwm2m_engine.lwm2m_udp_receive: reply 0x200005d8 handled and removed

Copy link
Contributor

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved!

@carlescufi
Copy link
Member Author

Thanks @mike-scott for the review and testing

@carlescufi
Copy link
Member Author

Approved!

Thanks!

@MaureenHelm MaureenHelm merged this pull request into zephyrproject-rtos:topic-gpio Jan 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants