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

Cellular refactor power and get_default_instance, also remove deprecated #9273

Conversation

AriParkkila
Copy link

@AriParkkila AriParkkila commented Jan 7, 2019

Description

This PR has the following related changes:

  • Move power on/off to device and remove CellularPower
  • Remove netsocket/generic_modem_driver
  • Add get_target_default_instance in CellularDevice
  • Default modem drivers with FF_ARDUINO (see review comments)
  • Power API updated to match onboard_modem_api (see review comments)

CELLULAR_DEVICE macro and onboard_modem_api (see review comments) is still left to be removed after these changes can be approved.

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[X] Breaking change

Reviewers

@jarvte
@mirelachirica
@kjbracey-arm

Teppo Järvelin and others added 30 commits December 4, 2018 11:01
Moved methods to classes CellularDevice and CellularInformation.
SIM interface was removed to simplify cellular usage and
methods better suite new classes.
Updated greentea and unit tests.
-added an API for checking network eps ciot optimization support
-renamed the API for getting the UE parameters
-the API for setting the UE parameters includes now a callback, which
will be called once network support for eps ciot optimization is known
…n_feature_branch

Cellular ciot eps on feature branch
Cellular: changed support features to CellularProperty array.
After this change we were able to change methods
ATHandler::set_urc_handler and CellularDevice::set_ready_cb to void
and simplify error handling.
Cellular: Removed unnecessary checks after new
This change enables removing function has_registration from
class AT_CellularNetwork and all targets inheriting
AT_CellularNetwork.
After AT_CellularNetwork::has_registration was replaced with
CellularProperties and better
AT_CellularNetwork::set_access_technology_impl default
implementation we can delete most of the target specific classes
that inherit AT_CellularNetwork.
Change usage of AT_CellularContext::stack_type_supported to
AT_CellularBase::get_property. This way we can rid of
targets overriding stack_type_supported and delete
unnecessary classes and simplify new targets.
Generic cellular module (GENERIC_AT3GPP) can by used as a default
module when porting new cellular module. It's a good starting point
and eases porting of new modules. GENERIC_AT3GPP uses only standard
3GPP AT commands when communicating with the modem.
_sim_pin was changed to pointer from array and length was checked with
strlen. If _sim_pin was null it caused crash. Fix by checking _sim_pin against NULL.
Power class could have been called without checking if power is NULL. Fix by checking
that power class is not null.
Fix state machine to return correct states when queried.
Cellular: added setting of data carrier support for UART.
@ciarmcom ciarmcom requested a review from a team January 7, 2019 12:00
@ciarmcom
Copy link
Member

ciarmcom commented Jan 7, 2019

@AriParkkila, thank you for your changes.
@mirelachirica @jarvte @kjbracey-arm @ARMmbed/mbed-os-wan @ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-maintainers please review.

Copy link
Contributor

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

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

As discussed offline, I think it would be good to pin down exactly what the power calls do as we're making this API change - make sure we don't need to make another one.

Aligning with the 4-call model from the original 5.7 design, your power_on and power_off could be the "power rail" "init" and "deinit" from there.

The "button" power on could be hidden inside "init", but not clear that the button-off call can be neatly hidden inside "shutdown".

I would suggest exposing all 4 calls, and then the state machine can be in control of them all: "button on" calls interleaved with its "device init"s, and could in future choose when to try the "button off" if it ever did shutdown.

@AriParkkila
Copy link
Author

@kjbracey-arm please re-review

Copy link
Contributor

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

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

Looking good, thanks - I'd just like a bit more text in the power calls to help people get a mental image.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 15, 2019

Note: feature-cellular-refactor will need a rebase from master, to resolve tools travis (fixed on master)

@juhoeskeli
Copy link
Contributor

I am wondering is it possible to change the baudrate for e.g. MTB_ADV_WISE_1570 in mbed_app.json after this change goes through? From what I am hearing this value will be hardcoded in the future. I feel we should not limit ourselves to one value. It is because how the modem stack operates on this device that if one reads the data out too slowly incoming data will be lost. Thus in these situations I would like to still be able to configure the baudrate.

@kjbracey
Copy link
Contributor

kjbracey commented Jan 15, 2019

Thus in these situations I would like to still be able to configure the baudrate.

Why would you ever want to configure it slow? If it can go faster, then we can just make it fixed at that faster speed, I would have thought. Going faster should save power - reducing our active time.

There's usually no need to make internal bus speeds configurable.

(Not that setting the baud rate fast is sufficient to cover your modem problem, as I understand it)

Oh, and note that the speed is only fixed for devices where it's "onboard", which suggests we know everything about the wiring. If you're a plug-in module, speed can be set in the constructor or JSON as usual.

@AriParkkila
Copy link
Author

@kjbracey-arm I copied some more docs from onboard_modem_api to here, and decreased trace levels from info to debug.

@AriParkkila
Copy link
Author

@0xc0170 can I merge this branch to master - rebase seems quite tricky... Another option would be to close this feature branch and merge commits from my fork that is up to date with master https://github.com/AriParkkila/mbed-os/tree/rebase-feature-cellular-refactor

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 16, 2019

@0xc0170 can I merge this branch to master

Which branch? There's another travis fix t hat is landing on master within a hour. To progress, either cherry pick it here to fix it or rebase the feature branch

@AriParkkila
Copy link
Author

@0xc0170 this commit is going to feature-cellular-refactor branch. Can I use git merge (no rebase) to update the feature-branch up to master?

@juhoeskeli
Copy link
Contributor

Thus in these situations I would like to still be able to configure the baudrate.

Why would you ever want to configure it slow? If it can go faster, then we can just make it fixed at that faster speed, I would have thought. Going faster should save power - reducing our active time.

Fast is good, I do prefer to have it that way. However, in this case the FW just comes with 9600 bps as default. At least in versions that we have available. Maybe that will change in the future FW version, who knows. I don't know how likely that is, but this is one example where configuration might be needed (unless the driver would be so smart as to "autosense" baudrate based on FW version or by trial&error).

There's usually no need to make internal bus speeds configurable.

(Not that setting the baud rate fast is sufficient to cover your modem problem, as I understand it)

You are correct it does not fix all problems. For some problems it seems to help though, which is why I configured it to 115200 instead of the factory default 9600. I was not able to download the 100kB+ file without doing that (and adjusting the amount of bytes read with one call to closer to the modem maximum).

Oh, and note that the speed is only fixed for devices where it's "onboard", which suggests we know everything about the wiring. If you're a plug-in module, speed can be set in the constructor or JSON as usual.

Noted, but I believe the device I am working with falls into that category.

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.

8 participants